[Mesa-dev] [PATCH 09/11] mesa: Add Get* support for ARB_vertex_attrib_binding
Fredrik Höglund
fredrik at kde.org
Mon Oct 28 23:33:52 CET 2013
---
src/mesa/main/get.c | 24 ++++++++++++++++++++++++
src/mesa/main/get_hash_params.py | 3 +++
src/mesa/main/varray.c | 9 +++++++++
3 files changed, 36 insertions(+)
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index b39fdfb..caa163e 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1692,6 +1692,30 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
goto invalid_enum;
v->value_int = ctx->Multisample.SampleMaskValue;
return TYPE_INT;
+
+ case GL_VERTEX_BINDING_DIVISOR:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum;
+ if (index >= ctx->Const.VertexProgram.MaxAttribs)
+ goto invalid_value;
+ v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
+ return TYPE_INT;
+
+ case GL_VERTEX_BINDING_OFFSET:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum;
+ if (index >= ctx->Const.VertexProgram.MaxAttribs)
+ goto invalid_value;
+ v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
+ return TYPE_INT;
+
+ case GL_VERTEX_BINDING_STRIDE:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum;
+ if (index >= ctx->Const.VertexProgram.MaxAttribs)
+ goto invalid_value;
+ v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
+ return TYPE_INT;
}
invalid_enum:
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 3204940..4e2f7d2 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -722,6 +722,9 @@ descriptor=[
[ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather"],
[ "MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxProgramTextureGatherComponents), extra_ARB_texture_gather"],
+# GL_ARB_vertex_attrib_binding
+ [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", "CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
+ [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
]},
# Enums restricted to OpenGL Core profile
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 6c56ddd..5b5b8b2 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -762,6 +762,15 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
|| _mesa_is_gles3(ctx)) {
return gl_vertex_buffer_binding(ctx, array->VertexBinding)->InstanceDivisor;
}
+ case GL_VERTEX_ATTRIB_BINDING:
+ if (_mesa_is_desktop_gl(ctx)) {
+ return array->VertexBinding - VERT_ATTRIB_GENERIC0;
+ }
+ goto error;
+ case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
+ if (_mesa_is_desktop_gl(ctx)) {
+ return array->RelativeOffset;
+ }
goto error;
default:
; /* fall-through */
--
1.7.10.4
More information about the mesa-dev
mailing list