summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/get.c
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>2015-05-14 07:39:52 +0200
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>2015-09-25 08:39:23 +0200
commit3b2037f88c974ce6b194f099db32716f152b15e7 (patch)
tree5bf03e4f05cc3786ac93c6cd1656f70be19e4f52 /src/mesa/main/get.c
parent2e16dd1350703865104253a9d871e4c0a3257933 (diff)
downloadexternal_mesa3d-3b2037f88c974ce6b194f099db32716f152b15e7.zip
external_mesa3d-3b2037f88c974ce6b194f099db32716f152b15e7.tar.gz
external_mesa3d-3b2037f88c974ce6b194f099db32716f152b15e7.tar.bz2
glsl: fix UNIFORM_BUFFER_START or UNIFORM_BUFFER_SIZE query when no buffer object is bound
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." Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r--src/mesa/main/get.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 2390850..77184ee 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1932,7 +1932,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:
@@ -1940,7 +1941,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 */