[Mesa-dev] [PATCH v4 (part2) 45/59] glsl: fix UNIFORM_BUFFER_START or UNIFORM_BUFFER_SIZE query when no buffer object is bound

Iago Toral itoral at igalia.com
Fri Sep 4 06:19:17 PDT 2015


I've just noticed that I never really added Ian in the CC...

On Thu, 2015-08-06 at 08:35 +0200, Iago Toral wrote:
> On Thu, 2015-08-06 at 08:53 +0300, Tapani Pälli wrote:
> > Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
> > 
> > On 08/05/2015 11:30 AM, Iago Toral Quiroga wrote:
> > > From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> > >
> > > According to ARB_uniform_buffer_object spec:
> > >
> > > "If the parameter (starting offset or size) was not specified when the
> > >   buffer object was bound (e.g. if bound with BindBufferBase), or if no
> > >   buffer object is bound to <index>, zero is returned."
> > 
> > BTW it seems that this was changed from OpenGL 4.1 to 4.2 (?) for 
> > UNIFORM_BUFFER_SIZE 4.1 core spec still says
> > 
> > "If the parameter (starting offset or size) was not specified when the 
> > buffer object was bound, zero is returned. If no buffer object is bound 
> > to index, -1 is returned"
> > 
> > while 4.2 changed "If not buffer object is bound to index" value to 0, 
> > GLES 3.1 also says 0.
> 
> Ha, good catch... It seems that the text in the OpenGL 4.2 spec is the
> one that persisted, at least I see that in the OpenGL 4.5 spec as well.
> I guess it is not worth to special case this only for OpenGL 4.1...
> 
> Ian, what do you think?
> 
> > > Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> > > ---
> > >   src/mesa/main/get.c | 6 ++++--
> > >   1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> > > index e2bfb5f..b89c49f 100644
> > > --- a/src/mesa/main/get.c
> > > +++ b/src/mesa/main/get.c
> > > @@ -1925,7 +1925,8 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
> > >   	 goto invalid_value;
> > >         if (!ctx->Extensions.ARB_uniform_buffer_object)
> > >   	 goto invalid_enum;
> > > -      v->value_int = ctx->UniformBufferBindings[index].Offset;
> > > +      v->value_int = ctx->UniformBufferBindings[index].Offset < 0 ? 0 :
> > > +                     ctx->UniformBufferBindings[index].Offset;
> > >         return TYPE_INT;
> > >   
> > >      case GL_UNIFORM_BUFFER_SIZE:
> > > @@ -1933,7 +1934,8 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
> > >   	 goto invalid_value;
> > >         if (!ctx->Extensions.ARB_uniform_buffer_object)
> > >   	 goto invalid_enum;
> > > -      v->value_int = ctx->UniformBufferBindings[index].Size;
> > > +      v->value_int = ctx->UniformBufferBindings[index].Size < 0 ? 0 :
> > > +                     ctx->UniformBufferBindings[index].Size;
> > >         return TYPE_INT;
> > >   
> > >      /* ARB_shader_storage_buffer_object */
> > 
> > 
> 
> 
> _______________________________________________
> 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