Shader compiler fails to build shaders correctly on SamplesProject

Hello, after shaders are compiled and game launches it is not displayed correctly: it looks like frame buffers aren’t being cleared on one device (screen is mostly black, can still see controls and some details but when i try to rotate camera everything floats, blurs and merges), on other i just see noise on one half screen, other side is just black.

Android studio shows for every shader:

$6[Warning] [SHADERS] GCM Global Cache Miss: <3>Water@WaterVS(%SUN_SHINE|%FOAM)(%_RT_QUALITY|%_RT_REVERSE_DEPTH)(0)(0)(0)(0)(VS)
Compile Water@WaterVS(RT10000040000)(VS) (0 instructions, 0 tempregs, 5/11 constants) …

This happens for debug and even release after packing all shaders into .apk file on one device (gles 3.0) and only happens on debug on other (gles 3.1) and game crashes after both splash screens on release and profile with no error generated on android studio.

Devices are Samsung s5 6.0 for gles3.0 and xiomi redmi note 4 6.0 for gles3.1.

Edit:

I should add that when i open my phone’s

Internal Storage > Android > data > com.lumberyard.samples > files > user > cache > shaders > shadercachemisses.txt

i find that for example watervolume shader is missing

[ShaderList_Gles3_1.txt]<3>Watervolume@WaterPS()(%_RT_FOG)(0)(0)(0)(0)(PS)
[ShaderList_Gles3_1.txt]<3>Watervolume@WaterVS()(%_RT_REVERSE_DEPTH)(0)(0)(0)(0)(VS)

however their files exist in

Internal Storage > Android > data > com.lumberyard.samples > files > user > cache > shaders > cache > gles3_1 > gmem128 > watervolume.cfxb
 Internal Storage > Android > data > com.lumberyard.samples >
files > user > cache > shaders > cache > gles3_1 > gmem128 > cgpshaders >watervolume@WaterReflPS.fxcb
 Internal Storage > Android > data > com.lumberyard.samples >
files > user > cache > shaders > cache > gles3_1 > gmem128 > cgpshaders >watervolume@WaterPS.fxcb
 Internal Storage > Android > data > com.lumberyard.samples >
files > user > cache > shaders > cache > gles3_1 > gmem128 > cgvshaders >watervolume@WaterVS.fxcb

The warning message about missing the cache and the file for shader cache misses only identifies the shaders that were not already on the device and needed to be requested to be compiled from the game.

Do you see any error or warning output from the remote shader compiler?

For the 3.0 devices the drivers tend to have a lot of bugs in them. We worked around a few of them but each device has its own set of special bugs. You may be hitting one of them unfortunately. Are you able to run the SamplesProject on the devices or do you get the same behavior? If it is the same behavior then most likely we are hitting driver bugs and would require a bit more in-depth debugging to figure out what is going on.

Some things to try:

  • Disable different features. Looks like you are running the 128 bit path for GMEM, which implies that you have blur or screen space reflections enabled. Try disabling those and see if that helps. You can also disable the gmem optimization path completely and see if that makes a different (setting in the Android config file(s) r_EnableGMEMPath = 0).

What version of Lumberyard are you running?

So, to get the higher framerate you need to set r_EnableGMEMPath = 1 as that will enable optimizations to the deferred renderer that are needed on mobile. Would you mind attaching the output from logcat with r_EnableGMEMPath=1 set so that I can look at what is going on? If you could filter the output to “LMBR” as I don’t need to see all the messages I would appreciate it. :slight_smile:

I’m hoping to see why the engine is choosing to use 128 bit instead of the 256 bit path for GMEM and see if there are any other errors/warnings that could provide a clue to why you see just a dark screen when GMEM is enabled.

Thanks!

Thank you, I’ll be waiting for your reply.

Hello, thank you for your reply.

Seems like blur and ssr were disabled to begin with but i managed to get the game running on 3.1 device by setting r_EnableGMEMPath = 0.

I should note that project settings can’t be set/saved from editor cause editor fails to save changes and config files aren’t being created by default.

There
still remains problems with water and glass shaders stretching and multiplying and lightning turning everything white but that seems to be fixed by changing from low graphic settings to very high.

I’m only
getting 4-7 frames per second on a relatively new device on very high and 14 fps on very low with occasional stuttering. How do i solve that?

Edit: I’m running 1.15.0.0

I attached a log from shader compiler tough it only shows a few warnings about type truncation. 7558-shader-compiler-log.txt (22.6 KB)shader-compiler-log.txt

The
first time i set r_EnableGMEMPath = 1, after loading screen the game stopped and would switch every half minute between black screen
and screen with game character. A few minutes later my phone couldn’t handle it anymore and shut down. Wasn’t hot or anything, just crashed. I
atached the log of it 7556-logcat-first.txt (74.5 KB)logcat-first.txt.

Seems that i got

[Warning] OpenGL Error: [0x00000500]

Checked
again and r_EnableGMEMPath = 0 does not cause my phone to self destruct
while r_EnableGMEMPath = 1 does. This seems to only happen on my low settings where i tried to turn everything off to increase fps.

I changed to medium settings with r_EnableGMEMPath = 1 and it worked. I’m uploading the log 7557-logcat-second.txt (50 KB)logcat-second.txt.

7555-screenshot-2018-10-05-15-39-33-602-comlumberyardsa.png

Thanks for the logs and images! I have a busy day today so won’t be able to get to looking at the logs until Monday morning, PST. I’ll also share the logs with one of the Android rendering engineers to see if we can figure out what is going on.

I’m seeing a couple of OpenGL errors in the output, but not sure what is causing them and if they can be safely ignored or not. The 128 bit GMEM Path is being selected because the device does not support 256, so that explains that mystery to me. Basically the hardware only supports 128 bits of data in the Pixel Level Storage extension and so we can only enable a subset of optimizations on that device.

I’ve forwarded this thread to the Android rendering engineer to see if he can see anything else that I may have missed or provide some other insights into the issue.

Thanks for the reply. Let me know if you need more information on the issue.

Hi Vidas,

From the logs it looks like some shaders are not compiling correctly. Do you see any errors in the window of the Shader Compile server?

Also, just to be clear, the case that doesn’t work is when you set r_GraphicsQuality = 1 and r_EnableGMEMPath = 1?

Thanks

Hello,

i uploaded shader compiler server log in my previous post.

https://gamedev.amazon.com/forums/storage/attachments/7558-shader-compiler-log.txt

From what i can see there’s a bunch of warnings for truncation but no errors.

r_GraphicsQuality = 1 and r_EnableGMEMPath = 1 crashes but it’s most likely to do with the fact that i messed with graphic’s settings, altough

r_GraphicsQuality = 1 and r_EnableGMEMPath = 0 does not crash and runs fine except on low fps.

r_GraphicsQuality = 2 and r_EnableGMEMPath = 1 runs but i get graphical glitches and fps are only improved marginally if at all.

I should mention that i have resolution set to

r_MaxHeight=320

moreover, i managed to run the 2D UI sample (the one with button and widget tests) with

r_GraphicsQuality = 2 and r_EnableGMEMPath = 1

and no graphical glitches appeared on it but game was running very slow and hanging frequently for 5-30 seconds.

Hi Vidas,

For some reason I can’t reply directly to your last comment. From the logs it looks like the crosscompiler is crashing when compiling a shader. Let’s try the following. Go to your Tools\CrySCompileServer\x64\profile folder and delete the Cache, Error, Shaders and Temp folders. Edit the config.ini file and add DumpShaders=1. Delete the app from your device and run it again. Compress the “Shaders” folder in “Tools\CrySCompileServer\x64\profile” into a zip file and upload it to this thread. Also if possible, attach the shader compiler log from this specific run.

With that information I can try to cross compile the shaders locally and see why it’s crashing.

Akio

Hello Akio,

I’ve reconfigured and recompiled samples project, deleted Cache, Error, Shaders and Temp folders from shader compiler, set DumpShaders = 1, deployed and ran the game on android with settings on medium with r_EnableGMEMPath = 1.

I’m uploading my shader compiler folder with config and log files. 7670-profile.zip (936 KB)profile.zip

I have also found that other projects don’t run at all with gmem = 1 but works relatively fine with gmem = 0. However even with gmem = 0 If no water is present game runs fine but keeps crashing with water on.

Issue persists in lumberyard version 1.16. Still haven’t found a way to make game run well and consistent on android.