From a785bdec83ebb5a710fd395caa26791dbc3602af Mon Sep 17 00:00:00 2001 From: Xuelian Bai Date: Wed, 9 May 2018 22:59:11 +0800 Subject: [PATCH] glGetIntegerv return wrong value because type of Size and Stride in struct gl_array_attributes are changed, but get_hash_params.py wasn't changed accordingly. Change-Id: I9c26921986aad40d55b7eb3f4a14de4d21bcadce --- src/mesa/main/get.c | 14 +++++++++++++- src/mesa/main/get_hash_params.py | 14 +++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 90ab7ca..3b4dd3e 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -126,7 +126,9 @@ enum value_type { TYPE_DOUBLEN_2, TYPE_MATRIX, TYPE_MATRIX_T, - TYPE_CONST + TYPE_CONST, + TYPE_UBYTE, + TYPE_SHORT }; enum value_location { @@ -239,6 +241,8 @@ union value { #define ARRAY_ENUM(field) ARRAY_FIELD(field, TYPE_ENUM) #define ARRAY_ENUM16(field) ARRAY_FIELD(field, TYPE_ENUM16) #define ARRAY_BOOL(field) ARRAY_FIELD(field, TYPE_BOOLEAN) +#define ARRAY_UBYTE(field) ARRAY_FIELD(field, TYPE_UBYTE) +#define ARRAY_SHORT(field) ARRAY_FIELD(field, TYPE_SHORT) #define EXT(f) \ offsetof(struct gl_extensions, f) @@ -1865,6 +1869,14 @@ _mesa_GetIntegerv(GLenum pname, GLint *params) shift = d->type - TYPE_BIT_0; params[0] = (*(GLbitfield *) p >> shift) & 1; break; + + case TYPE_UBYTE: + params[0] = ((GLubyte *)p)[0]; + break; + + case TYPE_SHORT: + params[0] = ((GLshort *)p)[0]; + break; } } diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index f38a87d..d54a810 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -212,20 +212,20 @@ descriptor=[ [ "TEXTURE_MATRIX", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_valid_texture_unit" ], [ "TEXTURE_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, 0, extra_valid_texture_unit" ], [ "VERTEX_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_POS].Enabled), NO_EXTRA" ], - [ "VERTEX_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Size), NO_EXTRA" ], + [ "VERTEX_ARRAY_SIZE", "ARRAY_UBYTE(VertexAttrib[VERT_ATTRIB_POS].Size), NO_EXTRA" ], [ "VERTEX_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_POS].Type), NO_EXTRA" ], - [ "VERTEX_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_POS].Stride), NO_EXTRA" ], + [ "VERTEX_ARRAY_STRIDE", "ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_POS].Stride), NO_EXTRA" ], [ "NORMAL_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_NORMAL].Enabled), NO_EXTRA" ], [ "NORMAL_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA" ], - [ "NORMAL_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA" ], + [ "NORMAL_ARRAY_STRIDE", "ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA" ], [ "COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA" ], [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], [ "COLOR_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA" ], - [ "COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ], + [ "COLOR_ARRAY_STRIDE", "ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ], [ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_array_attributes, Enabled), NO_EXTRA" ], - [ "TEXTURE_COORD_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_attributes, Size), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_SIZE", "LOC_CUSTOM, TYPE_UBYTE, offsetof(struct gl_array_attributes, Size), NO_EXTRA" ], [ "TEXTURE_COORD_ARRAY_TYPE", "LOC_CUSTOM, TYPE_ENUM16, offsetof(struct gl_array_attributes, Type), NO_EXTRA" ], - [ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_attributes, Stride), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_SHORT, offsetof(struct gl_array_attributes, Stride), NO_EXTRA" ], # GL_ARB_multitexture [ "MAX_TEXTURE_UNITS", "CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA" ], @@ -255,7 +255,7 @@ descriptor=[ # OES_point_size_array [ "POINT_SIZE_ARRAY_OES", "ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled, TYPE_BOOLEAN), NO_EXTRA" ], [ "POINT_SIZE_ARRAY_TYPE_OES", "ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Type, TYPE_ENUM16), NO_EXTRA" ], - [ "POINT_SIZE_ARRAY_STRIDE_OES", "ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Stride, TYPE_INT), NO_EXTRA" ], + [ "POINT_SIZE_ARRAY_STRIDE_OES", "ARRAY_FIELD(VertexAttrib[VERT_ATTRIB_POINT_SIZE].Stride, TYPE_SHORT), NO_EXTRA" ], [ "POINT_SIZE_ARRAY_BUFFER_BINDING_OES", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], ]}, -- 2.7.4