Forums - glLinkProgram fails to link a correct program

5 posts / 0 new
Last post
glLinkProgram fails to link a correct program
YafeiLiu
Join Date: 30 Mar 22
Posts: 3
Posted: Wed, 2022-03-30 19:44
  •  

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] ([email protected], 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

  • Up0
  • Down0
DuBo
Join Date: 9 Dec 13
Posts: 41
Posted: Thu, 2022-04-21 21:38

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

 

 

  • Up0
  • Down0
YafeiLiu
Join Date: 30 Mar 22
Posts: 3
Posted: Sat, 2022-04-23 19:02

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!

  • Up0
  • Down0
DuBo
Join Date: 9 Dec 13
Posts: 41
Posted: Thu, 2022-05-12 20:26

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

  • Up0
  • Down0
YafeiLiu
Join Date: 30 Mar 22
Posts: 3
Posted: Sun, 2022-06-05 08:29

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.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.