[Mesa-dev] [PATCH v3 6/6] main: fix length of values written to glGetProgramResourceiv() for ACTIVE_VARIABLES

Timothy Arceri t_arceri at yahoo.com.au
Wed Oct 7 15:53:21 PDT 2015


On Wed, 2015-10-07 at 09:21 +0200, Samuel Iglesias Gonsalvez wrote:
> Return the number of values written.
> 
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>

Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>

Are you guys going to split SSBO into their own list? There was talk
about this recently, but I don't recall what the outcome was.

If so we will need to remember to undo all these work arounds.

> ---
>  src/mesa/main/shader_query.cpp | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/main/shader_query.cpp
> b/src/mesa/main/shader_query.cpp
> index 3bf4311..ecae3de 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -1188,7 +1188,8 @@ get_buffer_property(struct gl_shader_program
> *shProg,
>              (*val)++;
>           }
>           return 1;
> -      case GL_ACTIVE_VARIABLES:
> +      case GL_ACTIVE_VARIABLES: {
> +         unsigned num_values = 0;
>           for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms;
> i++) {
>              const char *iname = RESOURCE_UBO(res)
> ->Uniforms[i].IndexName;
>              struct gl_program_resource *uni =
> @@ -1198,8 +1199,10 @@ get_buffer_property(struct gl_shader_program
> *shProg,
>                 continue;
>              *val++ =
>                 _mesa_program_resource_index(shProg, uni);
> +            num_values++;
>           }
> -         return RESOURCE_UBO(res)->NumUniforms;
> +         return num_values;
> +      }
>        }
>     } else if (res->Type == GL_SHADER_STORAGE_BLOCK) {
>        switch (prop) {
> @@ -1221,7 +1224,8 @@ get_buffer_property(struct gl_shader_program
> *shProg,
>              (*val)++;
>           }
>           return 1;
> -      case GL_ACTIVE_VARIABLES:
> +      case GL_ACTIVE_VARIABLES: {
> +         unsigned num_values = 0;
>           for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms;
> i++) {
>              const char *iname = RESOURCE_UBO(res)
> ->Uniforms[i].IndexName;
>              struct gl_program_resource *uni =
> @@ -1231,8 +1235,10 @@ get_buffer_property(struct gl_shader_program
> *shProg,
>                 continue;
>              *val++ =
>                 _mesa_program_resource_index(shProg, uni);
> +            num_values++;
>           }
> -         return RESOURCE_UBO(res)->NumUniforms;
> +         return num_values;
> +      }
>        }
>     } else if (res->Type == GL_ATOMIC_COUNTER_BUFFER) {
>        switch (prop) {


More information about the mesa-dev mailing list