From e3e13d6b857b3083e2553457fe30ddfd4eddead4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 1 Jun 2014 20:50:17 +0100 Subject: 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 Reviewed-by: Ian Romanick Cc: "10.1 10.2" --- src/mesa/main/get.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 80a5839..267b5f2 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -847,6 +847,16 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu v->value_int = ctx->Array.VAO->IndexBufferObj->Name; break; + /* ARB_vertex_array_bgra */ + case GL_COLOR_ARRAY_SIZE: + array = &ctx->Array.VAO->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.VAO->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; -- cgit v1.1