mesa: Allow query of GL_VERTEX_BINDING_BUFFER
authorMarta Lofstedt <marta.lofstedt@intel.com>
Mon, 31 Aug 2015 13:04:18 +0000 (15:04 +0200)
committerMarta Lofstedt <marta.lofstedt@linux.intel.com>
Wed, 9 Sep 2015 07:29:04 +0000 (09:29 +0200)
According to OpenGL ES 3.1 specification table : 20.2 and
OpenGL specification 4.4 table 23.4. The glGetIntegeri_v
functions should report the name  of the buffer bound
when called with GL_VERTEX_BINDING_BUFFER.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/mesa/main/get.c

index 4855187aa6f45602482b35f434f166a8084fb2e0..d5df53057d795e01b693bf0611fcc11874f78838 100644 (file)
@@ -1992,6 +1992,14 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
       v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
       return TYPE_INT;
 
+   case GL_VERTEX_BINDING_BUFFER:
+      if (ctx->API == API_OPENGLES2 && ctx->Version < 31)
+         goto invalid_enum;
+      if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
+         goto invalid_value;
+      v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name;
+      return TYPE_INT;
+
    /* ARB_shader_image_load_store */
    case GL_IMAGE_BINDING_NAME: {
       struct gl_texture_object *t;