Hi,

The vertex and fragment shaders shown below fail to link on the iMX6. However, the shader program log is empty and no other error is generated/shown. When functionality related to isampler2D is removed, then the shader links successfully again.

Does anyone know what is going on here or have a work-around for this ?

QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this);

QString vsrc =

"#ifdef GL_ES\n"

"precision mediump float;\n"

"precision mediump sampler2D;\n"

"precision mediump isampler2D;\n"

"#endif\n"

"in vec4 vertex;\n"

"in vec2 texCoord;\n"

"flat out int materialID;\n"

"out vec2 texc;\n"

"uniform int rotIndex;\n"

"uniform sampler2D floatSampler;\n"

"uniform isampler2D intSampler;\n"

"\n"

"int getRotoationIndex(void);\n"

"mat4 getRotationMatrix(int Index);\n"

"mat4 getRotationMatrix(void);\n"

"\n"

"int getMaterialId(int Index);\n"

"int getMaterialId(void);\n"

"\n"

"int getRotationIndex(void) { return rotIndex; }\n"

"mat4 getRotationMatrix(void) { return getRotationMatrix(getRotationIndex()); }\n"

"mat4 getRotationMatrix(int index) { return mat4(texelFetch(floatSampler, ivec2(0+5*index,0), 0), texelFetch(floatSampler, ivec2(1+5*index,0), 0), texelFetch(floatSampler, ivec2(2+5*index,0), 0), texelFetch(floatSampler, ivec2(3+5*index,0), 0)); }\n"

"\n"

"int getMaterialId(int index) { return int(texelFetch(intSampler, ivec2(4+5*index,0), 0).r); }\n"

"int getMaterialId(void) { return getMaterialId(getRotationIndex()); }\n"

"\n"

"void main(void)\n"

"{\n"

" mat4 rotMatrix = getRotationMatrix(rotIndex);\n"

" gl_Position = rotMatrix * vertex;\n"

" materialID = getMaterialId();\n"

" texc = texCoord;\n"

"}\n";

#endif

QOpenGLShader *fshader = new QOpenGLShader(QOpenGLShader::Fragment, this);

QString fsrc =

"#ifdef GL_ES\n"

"precision mediump float;\n"

"precision mediump sampler2D;\n"

"precision mediump isampler2D;\n"

"#endif\n"

"in vec2 texc;\n"

"flat in int materialID;"

"out vec4 fragColor;\n"

"uniform sampler2D tex;\n"

"void main(void)\n"

"{\n"

" if (materialID == 1) {\n"

" fragColor = mix(texture(tex, texc), vec4(1.0, 0.0, 0.0, 0.5), 0.4);\n"

" }\n"

" if (materialID == 7) {\n"

" fragColor = mix(texture(tex, texc), vec4(0.0, 0.0, 1.0, 0.5), 0.4);\n"

" }\n"

"}\n";

**Original Attachment has been moved to: GLWidget.cpp.zip**

**Original Attachment has been moved to: GLWidget.h.zip**

Hi Hartmut,

iSampler2d is part of EXT_gpu_shader4: https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_gpu_shader4.txt

Mx6Devices support OpenGL ES3.x based on EXT_gpu_shader5: https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_gpu_shader5.txt

You can see the changes for specific functionality, however I think the main change is that the shading lenguage had changed dramatically using multisample instead of sampler variant.

regards