We are using glslvalidator and spirv-cross tools to translate HLSL code to GLSL code ,and find glLinkProgram fails to link these shader on Qualcomm, Adreno 506.
Vertex shader:
#version 310 es layout(location = 0) in vec4 vertex_pos; layout(location = 1) in vec2 vertex_tex0; layout(location = 0) out vec2 input_TexCoord; void main() { gl_Position = vertex_pos; input_TexCoord = vertex_tex0; }
Fragment shader:
#version 310 es precision mediump float; precision highp int; layout(std140) uniform ColorTransformBlock { mat4 yuvCoef; } colorTransform; layout(binding = 0) uniform highp sampler2D YTex; layout(location = 0) in highp vec2 input_TexCoord; layout(location = 0) out highp vec4 _entryPointOutput; mat4 dummy(mat4 wrap) { return wrap; } void main() { _entryPointOutput = vec4(texture(YTex, input_TexCoord).x) * dummy(colorTransform.yuvCoef); // line A }
If we replace line A with these lines:
float y = texture(YTex, input_TexCoord).x; _entryPointOutput = vec4(y) * dummy(colorTransform.yuvCoef);
then glLinkProgram works perfectly, but they are truely same shaders. Any idea about that?
GLSE version:
GLES: Qualcomm, Adreno (TM) 506, OpenGL ES 3.2 [email protected] (GIT@cf751ce, Ia11ce2d146) (Date:12/22/20)
OpenGL ES Shader info:
2022-03-31 10:20:36.223 14253-14345/com.sample.moreteapots I/Adreno: QUALCOMM build : cf751ce, Ia11ce2d146
Build Date : 12/22/20
OpenGL ES Shader Compiler Version: EV031.20.00.04
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.6.5.R1.08.00.00.312.030
Remote Branch : NONE
Reconstruct Branch : NOTHING
Do you mean the shader compiling are all successful, but the program link is failed?
Do you get the log info after glLinkProgram?
https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glGetProgram...
Thanks
Bob Du
Hi, Bob Du
Yes, the shader can be compiled without any issues, only the link is failed. I tried glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength), but the return value of logLength is zero. I also tried glGetProgramInfoLog(prog, logLength, &logLength, log), empty string is returned. I am willing to help if there is any thing i can do!
Hi, Yafei
It is really strange you got zero lenght/empty of loginfo even when glLinkProgram() is failed.
To check why the glLinkProgram() is failed, is it possible your can provide your demop app binary then we can verify on internal device?
Meanwhile, do you run your demo app on a non-root device or a root device? If root device, we can provide other debug method.
Thanks
Bob Du
The demo app runs on non-root device. You can find this demo app and a cpp file here https://github.com/chimojs/linkissue. The app requires android lollipop and later. I also test it on XiaoMI 6 running on GLES: Qualcomm, Adreno (TM) 540, it works fine.