I tried one of my mobile GearVR projects (that cooks fine on 4.11.2 Launcher version but goes black after some head movement) with the promoted branch from GitHub (which announces itself as 4.13; the exact commit is 93f30b6
for CL 2947560) and found some interresting shader compile errors:
[2016.04.23-15.37.38:320][563]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2016.04.23-15.37.38:319][ 0]LogCook:Display: Cooking /Game/StarterContent/Materials/M_Ceramic_Tile_Checker -> C:/Users/BhaaL/Documents/Unreal Projects/AV_Test 4.13/Saved/Cooked/Android_ETC2/AV_Test/Content/StarterContent/Materials/M_Ce [2016.04.23-15.37.38:320][563]MainFrameActions: Packaging (Android (ETC2)): ramic_Tile_Checker.uasset [2016.04.23-15.37.38:329][564]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2016.04.23-15.37.38:320][ 0]LogShaderCompilers:Warning: 1 Shader compiler errors compiling M_Ceramic_Tile_Checker for platform GLSL_ES2: [2016.04.23-15.37.38:329][564]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2016.04.23-15.37.38:320][ 0]LogShaderCompilers:Warning: Engine/Shaders/BasePassForForwardShadingPixelShader.usf(): Shader TBasePassForForwardShadingPSFDistanceFieldShadowsLightMapAndCSMLightingPolicyINT32_MAXLDRGamma32Skylight, VF FLandscapeVertexFactoryMobile: [2016.04.23-15.37.38:329][564]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: shader uses 9 samplers exceeding the limit of 8 [2016.04.23-15.37.40:978][586]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2016.04.23-15.37.40:978][586]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2016.04.23-15.37.40:687][ 0]LogShaderCompilers:Warning: Failed to compile Material /Game/StarterContent/Materials/M_Ceramic_Tile_Checker.M_Ceramic_Tile_Checker for platform GLSL_ES2, Default Material will be used in game. [2016.04.23-15.37.40:978][586]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2016.04.23-15.37.40:687][ 0]LogShaders:Warning: (): shader uses 9 samplers exceeding the limit of 8 [2016.04.23-15.37.40:979][586]MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2016.04.23-15.37.40:691][ 0]LogSavePackage:Display: Finished SavePackage C:/Users/BhaaL/Documents/Unreal Projects/AV_Test 4.13/Saved/Cooked/Android_ETC2/AV_Test/Content/StarterContent/Materials/M_Ceramic_Tile_Checker.uasset
The fun part is that the very same material yields the following Mobile stats on 4.11.2:
Info Base pass shader with static lighting: 109 instructions Info Base pass shader with only dynamic lighting: 79 instructions Info Vertex shader: 31 instructions Info Texture samplers: 8/16 Info Mobile base pass shader with only dynamic lighting (LDR): 114 instructions Info Mobile base pass vertex shader (LDR): 38 instructions Info Mobile texture samplers: 8/8
and those on promoted:
Info Base pass shader with static lighting: 108 instructions Info Base pass shader with only dynamic lighting: 75 instructions Info Vertex shader: 42 instructions Info Texture samplers: 8/16 Info Mobile base pass shader with only dynamic lighting (LDR): 131 instructions Info Mobile base pass vertex shader (LDR): 49 instructions Info Mobile texture samplers: 9/8
Where does this extra Texture Sampler come from?
This is probably closely related to my other report over here where moving a material node bumps the texture sampler count. What I did was changing the texture slightly (by scaling the UV coordinates) to make the tiles a bit larger.
With this increased sampler count, the material would not build any more.
I can’t seem to reproduce this on a newly created material, where the stats are similar and sampler counts are the same, but something must be going on there. Even when deleting all nodes from the graph, I still get a difference of +1 texture sampler being used.
Steps to reproduce (at least I guess; since I didn’t try with an empty project yet, and I won’t be able to do so until tomorrow):
- Create a new project with Desktop / Console and Maximum Quality settings, then add the Starter Content
- Open up StarterContent/Materials/M_Ceramic_Tiles_Checker
- Add a Texture Coordinates node, set the UV scale to 0.5 each (so the tiles get larger)
- Hook the TexCoords node to the Tile color and Normal Texture samplers
- Cook the project for Android ETC2 (or at least check mobile stats)