Unity - iOS: WARNING: Shader Unsupported: 'Hidden/BlitToDepth' - ios

I'm making a 2D game using Unity, i exported the game to Android and it runs smoothly with no problems, i exported the same game to Xcode and then i installed the game on my iPhone, it doesn't crash but the log gives me those warning:
GfxDevice: creating device client; threaded=1
Initializing Metal device caps: Apple A11 GPU
Initialize engine version: 2017.3.1f1 (fc1d3344e6ea)
WARNING: Shader Unsupported: 'Hidden/BlitToDepth' - Pass '' has no
vertex shader
WARNING: Shader Unsupported: 'Hidden/BlitToDepth' - Setting to default
shader.
WARNING: Shader Unsupported: 'Hidden/BlitToDepth_MSAA' - Pass '' has no
vertex shader
WARNING: Shader Unsupported: 'Hidden/BlitToDepth_MSAA' - Setting to
default shader.
Setting up 1 worker threads for Enlighten.
.....
...
And the movement in the game is a little bit laggy. (but on Android devices the movement is smooth)
I searched all over the internet and i tried every solution there is. Nothing seems to work.
Any suggestions?
EDIT
I tried this but it didn't work.
EDIT2
Unity says that this is a bug and the problem is resolved, i don't see the solution!.

Related

Are SIMD groups supported in Metal on iOS?

I can't figure out whether or not SIMD groups are supported on iOS.
The Metal Shading Language Specification states at the time of writing on page 59, section 4.4.1:
iOS: No support for SIMD-groups.
However, in Table 6.11., "SIMD-group functions in the Metal standard library", some SIMD-group functions are listed as supported on iOS. This is one of the ones I'd like to use:
T simd_shuffle_down(T data, ushort delta)
macOS: Since Metal 2.0.
iOS: Since Metal 2.2.
Similarly, table Table 5.7., "Attributes for kernel function input arguments", states that some attributes are available:
threads_per_simdgroup
macOS: Since Metal 2.0.
iOS: Since Metal 2.2.
So it's not clear from the documentation whether any SIMD group functionality is supposed to be supported. Using a function argument with the threads_per_simdgroup attribute in a compute kernel currently causes the run-time Metal compiler to crash on iPhone 7 and 8 (but not 11):
Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
All devices tested with iOS 13.3. Metal language version was 2.2. Xcode version 11.3.
I think that the claim that SIMD-groups are unsupported on iOS is either inaccurate, or not specific enough.
If you consult the Metal Feature Set Tables for Metal 2.2, you'll note that "SIMD-scoped permute operations" (simd_broadcast,
simd_shuffle, simd_shuffle_up, etc.) are supported on MTLGPUFamilyApple6, which includes devices with A13 processors. Hence why this works on iPhone 11.
The fact that using this attribute on unsupported devices causes a compiler crash is a bug, and I'd recommend that you file feedback.

'Incorrect Type of Metal Texture' - Fixed by Disabling Metal API Validation. Why?

I am loading a 3D object into ARKit on a MTLDevice with textures programmatically (.dae + .jpg) and it has transparency. However, when I set the objectNode.transparency property to anything other than 1.0 (the default float value), then I receive the following error and the app crashes: Function(commonprofile_frag): incorrect type of texture (MTLTextureTypeCubeArray) bound at texture binding at index 7 (expect MTLTextureTypeCube) for u_radianceTexture[0].' I have looked at Apple's documentation and developer blog and it seemed to be an error from an earlier Xcode version - however I am running the latest full release - 10.1 (10B61).
It turns out I actually solved this by popping into the Product>Scheme>EditScheme>Options tab and disabling "Metal API Validation". Everything seems to be working properly as of now... does this expose to scrutiny from Apple and/or possible errors? Why did this work as a solution?

iOS12 is causing an error on Metal Command Buffer execution, render is glitchy or doesn't occur

We have an app that uses Metal to render. This app works correctly on devices running iOS11. When using the same app on devices running iOS12, we started getting glitches and sometimes hangs in the rendering. We also tried recompiling for iOS12 and are getting the same bad behavior. On the console we are getting the following different messages:
2018-09-22 09:22:29.508576-0500 OurApp [1286:84481] Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)
2018-09-22 09:29:55.654426-0500 OurApp [1286:84625] Execution of the command buffer was aborted due to an error during execution. Caused GPU Hang Error (IOAF code 3)
2018-09-22 09:34:37.718054-0500 OurApp [1286:87354] Execution of the command buffer was aborted due to an error during execution. Ignored (for causing prior/excessive GPU errors) (IOAF code 4)
With the first two messages the rendering seems glitchy, where a blank screen is presented and then finally the rendering occurs on screen. With the last message the rendering doesn't actually occur and the message continues being displayed until we move to a different view.
This app uses SceneKit, instantiates a SCNView and uses a default CIContext. It also uses the Physically Based Lighting model, which forces the Metal renderer to be used. The app has a simple SCNNode geometry, a cylinder. Each geometry object of the cylinder gets a normal texture (3 in total). The same diffuse, metalness and roughness values are applied to all the geometry objects of the cylinder.
Has anybody ran into this problem? If so, how did you solve it?
Thanks
UPDATE: The problem seems to be caused when an image is used as the scene's lighting environment:
let scene = SCNScene()
scene.lightingEnvironment.contents = UIImage(named: "ourLightingEnvironmentImage")
When a lighting environment isn't used, the problem goes away. This is starting to look like an Apple bug, we will file one. We are stuck because we need the lighting environment to produce realistic reflections for the models in our app.
It's a bug, caused by high resolution environment lightning images.
The solution is to resize these images, 1000x500 is what we are using now. Works perfectly.
I was able to solve my issues for the moment by choosing OpenGL ES as render mode:
I just received an update to the bug I had filed with Apple:
Apple Developer Relations
We believe this issue is resolved in the latest iOS 12.2 beta. Please test with the latest iOS beta. If you still have issues, please update your bug report with any relevant logs or information that could help us investigate. iOS beta https://developer.apple.com/download/"
I seem to be having the exact same problem. Also using ARKit and the default sceneKit Editor, I kept getting the IOAF code 4 error infinitely when the screen freezes up.
I fixed my problem by changing the environment from "Procedural Sky" to "None". Doesn't lag or freeze anymore, but this is hardly the solution as my AR object now has no lighting or environment. I believe there is a fix coming in iOS 12.2 Beta, but have yet to update.
Hope my solution helps others.

Output of vertex shader 'v_gradient' not read by fragment shader

When i run my app on ios 10 device and xcode 8 i'm getting the following message in debug console. Can any one know why this is happening
ERROR /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit/VectorKit-1230.32.8.29.9/GeoGL/GeoGL/GLCoreContext.cpp 1763: InfoLog SolidRibbonShader:
ERROR /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit/VectorKit-1230.32.8.29.9/GeoGL/GeoGL/GLCoreContext.cpp 1764: WARNING: Output of vertex shader 'v_gradient' not read by fragment shader
The error is related to the Simulator's rendering methods & framework, as opposed to those of a real device.
The issue should not reproduce on a real device.
Please see a full answer here

Instanced drawing with OpenGL ES 2.0 on iOS

In short:
Can anyone confirm whether it is possible to use the built-in variable gl_InstanceID (or gl_InstanceIDEXT) in a vertex shader using OpenGL ES 2.0 on iOS with GL_EXT_draw_instanced enabled?
Longer:
I want to draw multiple instances of an object using glDrawArraysInstanced and gl_InstanceID, and I want my application to run on multiple platforms, including iOS.
The specification clearly says that these features require ES 3.0. According to the iOS Device Compatibility Reference ES 3.0 is only available on a few devices (those based on the A7 GPU; so iPhone 5s, but not on iPhone 5 or earlier).
So my first assumption was that I needed to avoid using instanced drawing on older iOS devices.
However, further down in the compatibility reference document it says that the EXT_draw_instanced extension is supported for all SGX Series 5 processors (that includes iPhone 5 and 4s).
This makes me think that I could indeed use instanced drawing on older iOS devices too, by looking up and using the appropriate extension function (EXT or ARB) for glDrawArraysInstanced.
I'm currently just running some test code using SDL and GLEW on Windows so I haven't tested anything on iOS yet.
However, in my current setup I'm having trouble using the gl_InstanceID built-in variable in a vertex shader. I'm getting the following error message:
'gl_InstanceID' : variable is not available in current GLSL version
Enabling the "draw_instanced" extension in GLSL has no effect:
#extension GL_ARB_draw_instanced : enable
#extension GL_EXT_draw_instanced : enable
The error goes away when I specifically declare that I need ES 3.0 (GLSL 300 ES):
#version 300 es
Although that seem to work fine on my Windows desktop machine in an ES 2.0 context I doubt that this would work on an iPhone 5.
So, shall I abandon the idea of being able to use instanced drawing on older iOS devices?
From here:
Instanced drawing is available in the core OpenGL ES 3.0 API and in
OpenGL ES 2.0 through the EXT_draw_instanced and EXT_instanced_arrays
extensions.
You can see that it's available on all of their GPUs, PowerVR SGX, Apple A7, A8.
(Looks like #Shammi's not coming back... if they do, you can change the accepted answer :)

Resources