Posts

Post marked as solved
9 Replies
OK I finally "solved" this. The issue is that the newly compiled Metal shader library is NOT compatible with the iPhone 5s with iOS version 10.1.1. So calling the method: - (nullable id MTLLibrary)newDefaultLibrary; with the compiled Metal library file will not work. The solution is to run time compile the metal shaders on the target platform with the method: (nullable id MTLLibrary)newLibraryWithSource:(NSString *)source options:(nullable MTLCompileOptions *)options error:(__autoreleasing NSError **)error; With this method I was able to load and run the game. It had negligible impact on the load time of my game.
Post marked as solved
9 Replies
I did notice that when I downloaded XCode 12 and loaded my project it "recommended" that I update the deployment target to 12. Perhaps it is as you state that the Metal Shader compilers are generating code that the drivers on iOS 10 are not compatible with. I will write the Feedback just the same for completeness. I will try to fix this on my end and if not I guess I will have to upgrade to iOS version on myiPhone5s to 12. Thanks, Juan
Post marked as solved
9 Replies
Yes the Deferred Lighting demo running on my iPhone 5s with iOS version 10.1.1 will have the same issue and the same error when you create a render pipe line. I keep an old version of iOS on this phone for compatibility issues. I made sure the deployment target in the Deferred Lighting demo was 10. ie. I changed it to run as the minimum deployment target to be 10. I will write a report with Feedback Assistant. But it may be hard to debug this if you don't have an iPhone with an old iOS version. Thanks for helping me!
Post marked as solved
9 Replies
Also running the EXACT SAME code on a newer iPhone with iOS 13.6.1 runs perfectly with no crashes. I also tried the Metal deffered shading demo from Apple and it exhibits the same crash issue: Could not resolve texture/samplers references But on the newer phone with iOS 13.6.1 the Deffered shading demo runs without a hitch.
Post marked as solved
9 Replies
The shaders are pretty standard stuff really. Here is the vertex and pixel shaders: struct sVertexInput { packed_float3 m_cPosition; packed_float2 m_cTextureCoords; }; struct sVertexOutput { float4 m_cPosition [[position]]; float2 m_cTextureCoords; }; //============================================================================== // Diffuse vertex shader // // psVertices - input vertices // rsUniforms - uniforms buffer // iVertexID - vertex index // // Returns: sVertexOutput - vertex output //============================================================================== vertex sVertexOutput diffuse_vp_main_vs (const device sVertexInput *psVertices [[buffer (0)]], constant sVPUniforms &rsUniforms [[buffer (1)]], uint iVertexID [[vertex_id]]) { sVertexOutput sVertexOutput; float4 cPosition = float4 (psVertices [iVertexID].m_cPosition, 1.0f); sVertexOutput.m_cPosition = cPosition * rsUniforms.m_cViewProjection; sVertexOutput.m_cTextureCoords = psVertices [iVertexID].m_cTextureCoords; return sVertexOutput; } //============================================================================== // Diffuse fragment shader // // sVertex - output vertex from vertex shader // cDiffuseTexture - diffuse texture // smplDiffuse - diffuse sampler // // Returns: half4 - sampled diffuse texture //============================================================================== fragment half4 diffuse_main_ps (sVertexOutput sVertex [[stage_in]], texture2d float cDiffuseTexture [[texture (0)]], sampler smplDiffuse [[sampler (0)]]) { // sample the diffuse texture half4 cColor = (half4) (cDiffuseTexture.sample (smplDiffuse, sVertex.m_cTextureCoords)); return cColor; }