Hey,
I think I ran into a shader compiler bug on my S8. I create a OpenGL ES 3.0 context and I verify that 3.1 is supported. I then try to compile my fragment shader but if the shader happens to write to a SSBO, the code fails to compile with a empty info log and info log length is = 0. Here is the shader in question:"#version 310 es\n""precision highp int;\n""precision highp float;\n""\n""struct shadow_dir_light_uniforms\n""{\n"" mat4 VpTransform;\n"" mat4 ShadowMapTransform;\n"" vec3 Dir;\n"" float AmbientIntensity;\n"" vec3 Color;\n"" float DiffuseIntensity;\n""};\n""struct entity_vs_data\n""{\n"" mat4 WTransform;\n"" mat4 WVPTransform;\n""};\n""struct entity_ps_data\n""{\n"" vec4 TintColor;\n"" uint PickObjTag;\n"" uint PickObjSlotId;\n"" uint Pad[2];\n""};\n""struct mouse_interaction\n""{\n"" uint PickObjTag;\n"" uint PickObjSlotId;\n"" uint PickObjFilter;\n"" uint WindowHeight;\n"" uint MouseX;\n"" uint MouseY;\n"" uint Padding[2];\n"" vec3 MouseTerrainPos;\n"" uint DidIntersectTerrain;\n""};\n"" uint GetEntityHandleType(uint Tag)\n""{\n"" uint Mask =(1u << uint(4))- 1u;\n"" uint Result = Tag & Mask;\n"" return Result;\n""}\n""\n""\n""layout(binding = 0)uniform sampler2D DiffuseSampler;\n""layout(binding = 1)uniform sampler2D ShadowSampler;\n""layout(binding = 2)uniform shadow_dir_light_uniforms_data\n""{\n"" shadow_dir_light_uniforms ShadowDirLight;\n""};\n""layout(binding = 3)uniform entity_vs_data_array\n""{\n"" entity_vs_data GlobalEntityVsData;\n""};\n""layout(binding = 4)uniform entity_ps_data_array\n""{\n"" entity_ps_data GlobalEntityPsData;\n""};\n""layout(binding = 5)uniform sampler2D HeightMapSampler;\n""layout(binding = 6)buffer mouse_interaction_buffer\n""{\n"" mouse_interaction GlobalMouseInteraction;\n""};\n""in vec3 InWorldPos;\n""in vec3 InWorldNormal;\n""centroid in vec2 InTexCoord;\n""out vec4 OutColor;\n""void main()\n""{\n"" entity_ps_data EntityPsData = GlobalEntityPsData;\n"" vec3 Normal = normalize(InWorldNormal);\n"" float ShadowFactor = 1.0;\n"" vec3 AmbientColor = ShadowDirLight . AmbientIntensity * ShadowDirLight . Color;\n"" float DiffuseIntensity = 0.8;\n"" float DiffuseFactor = clamp(dot(Normal, - ShadowDirLight . Dir), 0.0, 1.0);\n"" vec3 DiffuseColor = ShadowFactor * ShadowDirLight . DiffuseIntensity * DiffuseFactor * ShadowDirLight . Color;\n"" vec4 TextureColor = texture(DiffuseSampler, InTexCoord);\n"" vec4 FinalColor = vec4((AmbientColor + DiffuseColor)* TextureColor . rgb, 1)* EntityPsData . TintColor;\n"" OutColor = FinalColor;\n"" uint PixelX = uint(floor(gl_FragCoord . x));\n"" uint PixelY = GlobalMouseInteraction . WindowHeight - 1u - uint(floor(gl_FragCoord . y));\n"" if(PixelX == GlobalMouseInteraction . MouseX && PixelY == GlobalMouseInteraction . MouseY)\n"" {\n"" GlobalMouseInteraction . DidIntersectTerrain = 1;\n""// GlobalMouseInteraction . MouseTerrainPos = InWorldPos;\n"" }\n""}\n";
Below is the none C++ string version:
#version 310 es
#pragma onceprecision highp int;precision highp float;
#pragma oncestruct shadow_dir_light_uniforms{ mat4 VpTransform; mat4 ShadowMapTransform; vec3 Dir; float AmbientIntensity; vec3 Color; float DiffuseIntensity;};struct entity_vs_data{ mat4 WTransform; mat4 WVPTransform;};struct entity_ps_data{ vec4 TintColor; uint PickObjTag; uint PickObjSlotId; uint Pad[2];};struct mouse_interaction{ uint PickObjTag; uint PickObjSlotId; uint PickObjFilter; uint WindowHeight; uint MouseX; uint MouseY; uint Padding[2]; vec3 MouseTerrainPos; uint DidIntersectTerrain;}; uint GetEntityHandleType(uint Tag){ uint Mask =(1u << uint(4))- 1u; uint Result = Tag & Mask; return Result;}
layout(binding = 0)uniform sampler2D DiffuseSampler;layout(binding = 1)uniform sampler2D ShadowSampler;layout(binding = 2)uniform shadow_dir_light_uniforms_data{ shadow_dir_light_uniforms ShadowDirLight;};layout(binding = 3)uniform entity_vs_data_array{ entity_vs_data GlobalEntityVsData;};layout(binding = 4)uniform entity_ps_data_array{ entity_ps_data GlobalEntityPsData;};layout(binding = 5)uniform sampler2D HeightMapSampler;layout(binding = 6)buffer mouse_interaction_buffer{ mouse_interaction GlobalMouseInteraction;};layout(location = 0)in vec3 InWorldPos;layout(location = 1)in vec3 InWorldNormal;layout(location = 2)in vec2 InTexCoord;layout(location = 0)out vec4 OutColor;void main(){ entity_ps_data EntityPsData = GlobalEntityPsData; vec3 Normal = normalize(InWorldNormal); float ShadowFactor = 1.0; vec3 AmbientColor = ShadowDirLight . AmbientIntensity * ShadowDirLight . Color; float DiffuseIntensity = 0.8; float DiffuseFactor = clamp(dot(Normal, - ShadowDirLight . Dir), 0.0, 1.0); vec3 DiffuseColor = ShadowFactor * ShadowDirLight . DiffuseIntensity * DiffuseFactor * ShadowDirLight . Color; vec4 TextureColor = texture(DiffuseSampler, InTexCoord); vec4 FinalColor = vec4((AmbientColor + DiffuseColor)* TextureColor . rgb, 1)* EntityPsData . TintColor; OutColor = FinalColor; uint PixelX = uint(floor(gl_FragCoord . x)); uint PixelY = GlobalMouseInteraction . WindowHeight - 1u - uint(floor(gl_FragCoord . y)); if(PixelX == GlobalMouseInteraction . MouseX && PixelY == GlobalMouseInteraction . MouseY) { GlobalMouseInteraction . DidIntersectTerrain = 1; GlobalMouseInteraction . MouseTerrainPos = InWorldPos; }}
Compiling this shader causes it to fail with a empty info log, but commenting out the last two lines that write to GLobalMouseInteraction makes it work. I'm not sure if I'm doing anything wrong on my end, but there should be a compiler error in the info log I think to at least help devs figure out whats wrong. Please let me know if you need anything else, I'm running the most up to date version of Android as of writing this post.
The Mali Offline Compiler (part of Arm Mobile Studio - download free here: http://developer.arm.com/mobile-studio) can help debugging this type of issue if the on-target drivers don't have a clear error (although normally they are pretty good at showing the errors - it's the same compiler).
In your case I get:
ERROR: 0:88: S0001: Type mismatch, cannot convert from 'int' to 'uint'
This bit:
GlobalMouseInteraction.DidIntersectTerrain = 1;
... needs to be "1u".
Download Mobile Studio and give it a go.
Kind regards, Pete
Ah that solves the issue! Thanks for letting me know about the offline compiler, that should help a lot with debugging these kinds of issues. Thanks for your help!