Forums - Adreno OpenGL ES 2.0 driver reports multiple active uniforms for a single array

3 posts / 0 new
Last post
Adreno OpenGL ES 2.0 driver reports multiple active uniforms for a single array
markc
Join Date: 21 Feb 13
Posts: 4
Posted: Thu, 2013-04-11 23:30

The OpenGL ES specification 2.0.25 on p37 states "There will be only one active uniform reported by the GL per uniform array." However with the Adreno OpenGL ES 2.0 with the following shaders, the code has the incorrect results shown below. This has been observed on multiple Adreno devices (and no others) including the Android Nexus One.

static const char gVertexShader1[] =
    "attribute vec4 erp_texcoord0;\n"
    "varying vec4 erp_var_texcoord0;\n"
    "attribute vec4 erp_texcoord1;\n"
    "varying vec4 erp_var_texcoord1;\n"
    "uniform mat4 erp_matrix[7];\n"
    "attribute vec4 erp_position;\n"
    "void main() {\n"
    "gl_Position = erp_matrix[0] * erp_position;\n"
    "erp_var_texcoord0 = erp_matrix[5] * erp_texcoord0;\n"
    "erp_var_texcoord1 = erp_matrix[6] * erp_texcoord1;\n"
    "}\n";

static const char gFragmentShader1[] =
    "precision mediump float;\n"
    "varying vec4 erp_var_texcoord0;\n"
    "varying vec4 erp_var_texcoord1;\n"
    "uniform sampler2D erp_texture[2];\n"
    "uniform vec4 erp_materialColor[5];\n"
    "void main() {\n"
    "gl_FragColor = erp_materialColor[0];\n"
    "vec4 col;\n"
    "col = texture2D(erp_texture[0], erp_var_texcoord0.st);\n"
    "gl_FragColor = col;\n"
    "col = texture2D(erp_texture[1], erp_var_texcoord1.st);\n"
    "gl_FragColor = vec4(mix(gl_FragColor.rgb, col.rgb, col.a), gl_FragColor.a);\n"
    "}\n";


glGetProgramiv(programId, GL_ACTIVE_UNIFORMS, &vnum);
  →vnum == 4

It should be 3. Adreno is obviously reporting a uniform for each slot of the erp_texture array that is used.

glGetActiveUniform(programId, 0, MCE_MAX_UNIFORM_NAME_LENGTH + 5, &length, &size, &type, name);
  →name == "erp_materialColor[0]"

glGetActiveUniform(programId, 1, MCE_MAX_UNIFORM_NAME_LENGTH + 5, &length, &size, &type, name);
  →name == "erp_matrix[0]"

glGetActiveUniform(programId, 2, MCE_MAX_UNIFORM_NAME_LENGTH + 5, &length, &size, &type, name);
  →name == "erp_texture[0]"

glGetActiveUniform(programId, 3, MCE_MAX_UNIFORM_NAME_LENGTH + 5, &length, &size, &type, name);
  →name == "erp_texture[1]"

If vnum was returning 3, then this should raise an INVALID_VALUE error. If vnum == 4 was allowed, this would still be wrong. According to the spec. on p36 "If the active uniform is an array, the uniform name returned in name will always be the name of the uniform array appended with "[0]".

It would sure be nice if you had a proper bug reporting system we could put this kind of issue in.

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Fri, 2013-04-19 08:08

Hi Mark -

I had discussed this with our driver team and after some investigation, we've made a change to our sampler array logic in the current driver code and it is now reporting the correct number of uniforms as you pointed out.  This will be propogated out into future releases of the driver.

 

Many thanks for bringing this to our attention!

 

-mark f.

 

  • Up0
  • Down0
cogniscientofficial
Join Date: 26 Jun 20
Posts: 1
Posted: Fri, 2020-06-26 01:12

Compatible with Microsoft Office, it allows you to select from a variety of report formats and gives you control access to information displayed. With this SAP Business One ERP, you can save time and money on third-party reporting and tailor forms and queries to meet your business requirements.

  • 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.