[Mesa-dev] [PATCH v4 (part2) 44/59] mesa: Add queries for GL_SHADER_STORAGE_BUFFER

Iago Toral itoral at igalia.com
Wed Aug 5 23:44:55 PDT 2015


On Wed, 2015-08-05 at 12:23 -0400, Ilia Mirkin wrote:
> On Wed, Aug 5, 2015 at 4:30 AM, Iago Toral Quiroga <itoral at igalia.com> wrote:
> > These handle querying the buffer name attached to a giving binding point
> > as well as the start offset and size of that buffer.
> > ---
> >  src/mesa/main/get.c | 31 +++++++++++++++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> >
> > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> > index 307a5ff..e2bfb5f 100644
> > --- a/src/mesa/main/get.c
> > +++ b/src/mesa/main/get.c
> > @@ -1044,6 +1044,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
> >     case GL_UNIFORM_BUFFER_BINDING:
> >        v->value_int = ctx->UniformBuffer->Name;
> >        break;
> > +   /* GL_ARB_shader_storage_buffer_object */
> > +   case GL_SHADER_STORAGE_BUFFER_BINDING:
> > +      v->value_int = ctx->ShaderStorageBuffer->Name;
> > +      break;
> >     /* GL_ARB_timer_query */
> >     case GL_TIMESTAMP:
> >        if (ctx->Driver.GetTimestamp) {
> > @@ -1932,6 +1936,33 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
> >        v->value_int = ctx->UniformBufferBindings[index].Size;
> >        return TYPE_INT;
> >
> > +   /* ARB_shader_storage_buffer_object */
> > +   case GL_SHADER_STORAGE_BUFFER_BINDING:
> > +      if (index >= ctx->Const.MaxShaderStorageBufferBindings)
> > +         goto invalid_value;
> > +      if (!ctx->Extensions.ARB_shader_storage_buffer_object)
> > +         goto invalid_enum;
> 
> It definitely strikes me as odd as checking the ext second, after
> other things. Is there a reason for doing it this way? (Same below.)

It is what we do for everything else in this file, so we just followed
the example. I suppose it does not really matter much in the end, but if
we think it does we should probably fix all cases together in a separate
patch.

Iago

> > +      v->value_int = ctx->ShaderStorageBufferBindings[index].BufferObject->Name;
> > +      return TYPE_INT;
> > +
> > +   case GL_SHADER_STORAGE_BUFFER_START:
> > +      if (index >= ctx->Const.MaxShaderStorageBufferBindings)
> > +         goto invalid_value;
> > +      if (!ctx->Extensions.ARB_shader_storage_buffer_object)
> > +         goto invalid_enum;
> > +      v->value_int = ctx->ShaderStorageBufferBindings[index].Offset < 0 ? 0 :
> > +                     ctx->ShaderStorageBufferBindings[index].Offset;
> > +      return TYPE_INT;
> > +
> > +   case GL_SHADER_STORAGE_BUFFER_SIZE:
> > +      if (index >= ctx->Const.MaxShaderStorageBufferBindings)
> > +         goto invalid_value;
> > +      if (!ctx->Extensions.ARB_shader_storage_buffer_object)
> > +         goto invalid_enum;
> > +      v->value_int = ctx->ShaderStorageBufferBindings[index].Size < 0 ? 0 :
> > +                     ctx->ShaderStorageBufferBindings[index].Size;
> > +      return TYPE_INT;
> > +
> >     /* ARB_texture_multisample / GL3.2 */
> >     case GL_SAMPLE_MASK_VALUE:
> >        if (index != 0)
> > --
> > 1.9.1
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 




More information about the mesa-dev mailing list