[Mesa-dev] [PATCH 8/9] mesa: Add support for glGetIntegeri_v from GL_ARB_uniform_buffer_object.

Brian Paul brianp at vmware.com
Tue Jun 19 07:10:25 PDT 2012


On 06/18/2012 07:35 PM, Eric Anholt wrote:
> Fixes piglit ARB_uniform_buffer_object/getintegeri_v.
> ---
>   src/mesa/main/get.c |   24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
>
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 933bfe7..4798c02 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -2566,6 +2566,30 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
>   	 goto invalid_enum;
>         v->value_int = ctx->TransformFeedback.CurrentObject->BufferNames[index];
>         return TYPE_INT;
> +
> +   case GL_UNIFORM_BUFFER_BINDING:
> +      if (index>= ctx->Const.MaxUniformBufferBindings)
> +	 goto invalid_value;
> +      if (!ctx->Extensions.ARB_uniform_buffer_object)
> +	 goto invalid_enum;

I think it's a bit more natural to do the extension check before the 
index check.


> +      v->value_int = ctx->UniformBufferBindings[index].BufferObject->Name;
> +      return TYPE_INT;
> +
> +   case GL_UNIFORM_BUFFER_START:
> +      if (index>= ctx->Const.MaxUniformBufferBindings)
> +	 goto invalid_value;
> +      if (!ctx->Extensions.ARB_uniform_buffer_object)
> +	 goto invalid_enum;
> +      v->value_int = ctx->UniformBufferBindings[index].Offset;
> +      return TYPE_INT;
> +
> +   case GL_UNIFORM_BUFFER_SIZE:
> +      if (index>= ctx->Const.MaxUniformBufferBindings)
> +	 goto invalid_value;
> +      if (!ctx->Extensions.ARB_uniform_buffer_object)
> +	 goto invalid_enum;
> +      v->value_int = ctx->UniformBufferBindings[index].Size;
> +      return TYPE_INT;
>      }
>
>    invalid_enum:



More information about the mesa-dev mailing list