summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-06-01 20:50:17 +0100
committerCarl Worth <cworth@cworth.org>2014-06-23 11:21:03 -0700
commit1d7b8bc0859d5be351b6d72efd1f224c43e99528 (patch)
treecdac638f29aa986dcd49d0d129dd52a39e8f2c3c
parent28896085345b9a1818143d462127146ce51e25b8 (diff)
mesa: Make glGetIntegerv(GL_*_ARRAY_SIZE) return GL_BGRA.
Same as b026b6bbfe3f15c8a7296ac107dc3d31f74e401e, but COLOR_ARRAY_SIZE/SECONDARY_COLOR_ARRAY_SIZE. Ideally we wouldn't munge the incoming state, so that we wouldn't need to unmunge it back on glGet*. But the array size state is copied and referred in many places, many of which couldn't take an GLenum like GL_BGRA instead of a plain integer. So just hack around on glGet*, to ensure there is no risk of introducing regressions elsewhere. This bug causes problems to Apitrace, resulting in wrong traces. See https://github.com/apitrace/apitrace/issues/261 for details. Tested with piglit arb_vertex_array_bgra-get, which was created for this purpose. Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org> (cherry picked from commit e3e13d6b857b3083e2553457fe30ddfd4eddead4)
-rw-r--r--src/mesa/main/get.c10
-rw-r--r--src/mesa/main/get_hash_params.py4
2 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 6a388c40d53..8397b468d66 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -842,6 +842,16 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
v->value_int = ctx->Array.ArrayObj->ElementArrayBufferObj->Name;
break;
+ /* ARB_vertex_array_bgra */
+ case GL_COLOR_ARRAY_SIZE:
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0];
+ v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE:
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1];
+ v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size;
+ break;
+
/* ARB_copy_buffer */
case GL_COPY_READ_BUFFER:
v->value_int = ctx->CopyReadBuffer->Name;
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index e49bd9ab079..f20f6729120 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -199,7 +199,7 @@ descriptor=[
[ "NORMAL_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA" ],
[ "NORMAL_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA" ],
[ "COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA" ],
- [ "COLOR_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Size), NO_EXTRA" ],
+ [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
[ "COLOR_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA" ],
[ "COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ],
[ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA" ],
@@ -546,7 +546,7 @@ descriptor=[
[ "SECONDARY_COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled), NO_EXTRA" ],
[ "SECONDARY_COLOR_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR1].Type), NO_EXTRA" ],
[ "SECONDARY_COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride), NO_EXTRA" ],
- [ "SECONDARY_COLOR_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Size), NO_EXTRA" ],
+ [ "SECONDARY_COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
# GL_EXT_fog_coord
[ "CURRENT_FOG_COORDINATE", "CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), extra_flush_current" ],