Is this the right place to report problems with the GPU Driver?
I'm an engine developer, just added GLES3 support to my engine and I've noticed that on Android Galaxy Note 4 SM-N910U, ARM Mali-T760 MP6, the alpha tested shadows aren't working correctly.I suspect OpenGL Driver fault, as the same code works fine on iOS, Windows, Mac, Linux, etc.
Shadows that don't use alpha-test (discard) work correctly, but those that use discard, don't display at all.
Shader for alpha-tested materials is below:
Vertex Shader:#version 300 es#ifdef GL_ES#define LP lowp#define MP mediump#define HP highpprecision HP float;precision HP int;#else#define LP#define MP#define HP#endif#if __VERSION__>=300#define attribute in#define varying out#endifvarying vec4 GL_Tex0;varying vec4 GL_Tex1;varying vec4 GL_Tex2;struct VS_PS{vec3 _pos9;vec3 _nrm2;vec2 _tex3;};VS_PS _O1;vec3 _TMP225;vec4 _m0228[3];vec4 _TMP344;attribute vec4 ATTR0;attribute vec4 ATTR3;vec3 _TMP348;vec3 _TMP349;vec3 _TMP350;vec3 _TMP351;vec4 _TMP352;vec4 _TMP353;vec4 _TMP354;vec4 _TMP355;uniform vec4 ProjMatrix[4];uniform vec4 ViewMatrix[180];void main(){vec4 _O_vtx;_m0228[0]=ViewMatrix[(3*gl_InstanceID+0)];_m0228[1]=ViewMatrix[(3*gl_InstanceID+1)];_m0228[2]=ViewMatrix[(3*gl_InstanceID+2)];_TMP348.x=_m0228[0].x;_TMP348.y=_m0228[1].x;_TMP348.z=_m0228[2].x;_TMP349.x=_m0228[0].y;_TMP349.y=_m0228[1].y;_TMP349.z=_m0228[2].y;_TMP350.x=_m0228[0].z;_TMP350.y=_m0228[1].z;_TMP350.z=_m0228[2].z;_TMP351.x=_m0228[0].w;_TMP351.y=_m0228[1].w;_TMP351.z=_m0228[2].w;_TMP225=ATTR0.x*_TMP348+ATTR0.y*_TMP349+ATTR0.z*_TMP350+_TMP351;_O1._pos9=_TMP225;_O1._tex3=ATTR3.xy;_TMP352.x=ProjMatrix[0].x;_TMP352.y=ProjMatrix[1].x;_TMP352.z=ProjMatrix[2].x;_TMP352.w=ProjMatrix[3].x;_TMP353.x=ProjMatrix[0].y;_TMP353.y=ProjMatrix[1].y;_TMP353.z=ProjMatrix[2].y;_TMP353.w=ProjMatrix[3].y;_TMP354.x=ProjMatrix[0].z;_TMP354.y=ProjMatrix[1].z;_TMP354.z=ProjMatrix[2].z;_TMP354.w=ProjMatrix[3].z;_TMP355.x=ProjMatrix[0].w;_TMP355.y=ProjMatrix[1].w;_TMP355.z=ProjMatrix[2].w;_TMP355.w=ProjMatrix[3].w;_TMP344=_TMP225.x*_TMP352+_TMP225.y*_TMP353+_TMP225.z*_TMP354+_TMP355;_O_vtx=_TMP344;GL_Tex1.xyz=_O1._nrm2;gl_Position=_TMP344;GL_Tex2.xy=ATTR3.xy;GL_Tex0.xyz=_TMP225;}
#version 300 es
#ifdef GL_ES
#define LP lowp
#define MP mediump
#define HP highp
precision HP float;
precision HP int;
#else
#define LP
#define MP
#define HP
#endif
#if __VERSION__>=300
#define attribute in
#define varying out
varying vec4 GL_Tex0;
varying vec4 GL_Tex1;
varying vec4 GL_Tex2;
struct VS_PS{
vec3 _pos9;
vec3 _nrm2;
vec2 _tex3;
};
VS_PS _O1;
vec3 _TMP225;
vec4 _m0228[3];
vec4 _TMP344;
attribute vec4 ATTR0;
attribute vec4 ATTR3;
vec3 _TMP348;
vec3 _TMP349;
vec3 _TMP350;
vec3 _TMP351;
vec4 _TMP352;
vec4 _TMP353;
vec4 _TMP354;
vec4 _TMP355;
uniform vec4 ProjMatrix[4];
uniform vec4 ViewMatrix[180];
void main()
{
vec4 _O_vtx;
_m0228[0]=ViewMatrix[(3*gl_InstanceID+0)];
_m0228[1]=ViewMatrix[(3*gl_InstanceID+1)];
_m0228[2]=ViewMatrix[(3*gl_InstanceID+2)];
_TMP348.x=_m0228[0].x;
_TMP348.y=_m0228[1].x;
_TMP348.z=_m0228[2].x;
_TMP349.x=_m0228[0].y;
_TMP349.y=_m0228[1].y;
_TMP349.z=_m0228[2].y;
_TMP350.x=_m0228[0].z;
_TMP350.y=_m0228[1].z;
_TMP350.z=_m0228[2].z;
_TMP351.x=_m0228[0].w;
_TMP351.y=_m0228[1].w;
_TMP351.z=_m0228[2].w;
_TMP225=ATTR0.x*_TMP348+ATTR0.y*_TMP349+ATTR0.z*_TMP350+_TMP351;
_O1._pos9=_TMP225;
_O1._tex3=ATTR3.xy;
_TMP352.x=ProjMatrix[0].x;
_TMP352.y=ProjMatrix[1].x;
_TMP352.z=ProjMatrix[2].x;
_TMP352.w=ProjMatrix[3].x;
_TMP353.x=ProjMatrix[0].y;
_TMP353.y=ProjMatrix[1].y;
_TMP353.z=ProjMatrix[2].y;
_TMP353.w=ProjMatrix[3].y;
_TMP354.x=ProjMatrix[0].z;
_TMP354.y=ProjMatrix[1].z;
_TMP354.z=ProjMatrix[2].z;
_TMP354.w=ProjMatrix[3].z;
_TMP355.x=ProjMatrix[0].w;
_TMP355.y=ProjMatrix[1].w;
_TMP355.z=ProjMatrix[2].w;
_TMP355.w=ProjMatrix[3].w;
_TMP344=_TMP225.x*_TMP352+_TMP225.y*_TMP353+_TMP225.z*_TMP354+_TMP355;
_O_vtx=_TMP344;
GL_Tex1.xyz=_O1._nrm2;
gl_Position=_TMP344;
GL_Tex2.xy=ATTR3.xy;
GL_Tex0.xyz=_TMP225;
}
Pixel Shader:#version 300 es#extension GL_EXT_shader_texture_lod:enable#extension GL_EXT_shadow_samplers:enable#ifdef GL_ES#define LP lowp#define MP mediump#define HP highpprecision HP float;precision HP int;precision HP sampler2D;#if __VERSION__<300#define gl_InstanceID 0#endif#else#define LP#define MP#define HP#endif#if __VERSION__>=300#define texture2D texture#define varying in#else#endifvarying vec4 GL_Tex2;struct MaterialClass{vec4 _color;vec4 _ambient_specular;vec4 _sss_glow_rough_bump;vec4 _texscale_detscale_detpower_reflect;};float _c0079;uniform MaterialClass Material;uniform sampler2D Col;void main(){_c0079=texture2D(Col,GL_Tex2.xy).w+(false?float(Material._color.w)*5.00000000E-001-1.00000000E+000:float((Material._color.w-1.00000000E+000)));if(_c0079<0.00000000E+000){discard;}}
#extension GL_EXT_shader_texture_lod:enable
#extension GL_EXT_shadow_samplers:enable
precision HP sampler2D;
#if __VERSION__<300
#define gl_InstanceID 0
#define texture2D texture
#define varying in
struct MaterialClass{
vec4 _color;
vec4 _ambient_specular;
vec4 _sss_glow_rough_bump;
vec4 _texscale_detscale_detpower_reflect;
float _c0079;
uniform MaterialClass Material;
uniform sampler2D Col;
_c0079=texture2D(Col,GL_Tex2.xy).w+(false?float(Material._color.w)*5.00000000E-001-1.00000000E+000:float((Material._color.w-1.00000000E+000)));
if(_c0079<0.00000000E+000){
discard;
Expected result from Windows:
What I'm getting on Galaxy Note 4:
The tree model is composed of 2 materials (trunk that has no "discard", and the leaves that use the "discard" shader). Both shaders are shadow shaders, don't output any color, their only purpose is write to the depth buffer.
Here is the link to the APK that you can test by yourself:
www.dropbox.com/.../Application 3D.7z
One minor correction here:
Daniele Di Donato said:... using a texture as depth attachment but at the same time you are passing the same texture as a texture object to the shader. That is not allowed by the OpenGL ES spec.
It's allowed (e.g. not an error), but the results are implementation defined if you actually modify the attachment while concurrently using it as a source texture.
It's quite a common use case to attach depth from a previous render pass and use it read-only (e.g. for depth testing, but with all depth writes masked) while also reading it as a texture.
Cheers, Pete