diff options
author | Brian Paul <[email protected]> | 2018-05-09 19:46:32 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-05-10 08:08:11 -0600 |
commit | d07466fe18522cde1acadfc597583f80b69c15b7 (patch) | |
tree | c9dc41915b9d3fe45e01f4174852d34156c442f7 /src/mesa/main/get.c | |
parent | 45dfa6f4e77fbb21f312eb6101db6c25acd4d483 (diff) |
mesa: fix glGetInteger/Float/etc queries for vertex arrays attribs
The vertex array Size and Stride attributes are now ubyte and short,
respectively. The glGet code needed to be updated to handle those
types, but wasn't.
Fixes the new piglit test gl-1.5-get-array-attribs test.
v2: fix inadvertant whitespace change, change COLOR_ARRAY_SIZE to UBYTE,
misc fixes suggested by Justin
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106450
Fixes: d5f42f96e16 ("mesa: shrink size of gl_array_attributes (v2)")
Cc: [email protected]
Reviewed-by: Mathias Fröhlich <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r-- | src/mesa/main/get.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 44b7b838a3e..62d4f1ea5d7 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -105,6 +105,8 @@ enum value_type { TYPE_ENUM, TYPE_ENUM_2, TYPE_BOOLEAN, + TYPE_UBYTE, + TYPE_SHORT, TYPE_BIT_0, TYPE_BIT_1, TYPE_BIT_2, @@ -188,6 +190,8 @@ union value { GLint value_int_4[4]; GLint64 value_int64; GLenum value_enum; + GLubyte value_ubyte; + GLshort value_short; /* Sigh, see GL_COMPRESSED_TEXTURE_FORMATS_ARB handling */ struct { @@ -235,10 +239,13 @@ union value { #define CONTEXT_MATRIX(field) CONTEXT_FIELD(field, TYPE_MATRIX) #define CONTEXT_MATRIX_T(field) CONTEXT_FIELD(field, TYPE_MATRIX_T) +/* Vertex array fields */ #define ARRAY_INT(field) ARRAY_FIELD(field, TYPE_INT) #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) @@ -1520,6 +1527,10 @@ get_value_size(enum value_type type, const union value *v) return sizeof(GLenum) * 2; case TYPE_BOOLEAN: return sizeof(GLboolean); + case TYPE_UBYTE: + return sizeof(GLubyte); + case TYPE_SHORT: + return sizeof(GLshort); case TYPE_BIT_0: case TYPE_BIT_1: case TYPE_BIT_2: @@ -1631,6 +1642,14 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params) params[0] = ((GLboolean*) p)[0]; break; + case TYPE_UBYTE: + params[0] = INT_TO_BOOLEAN(((GLubyte *) p)[0]); + break; + + case TYPE_SHORT: + params[0] = INT_TO_BOOLEAN(((GLshort *) p)[0]); + break; + case TYPE_MATRIX: m = *(GLmatrix **) p; for (i = 0; i < 16; i++) @@ -1738,6 +1757,14 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params) params[0] = BOOLEAN_TO_FLOAT(*(GLboolean*) p); break; + case TYPE_UBYTE: + params[0] = (GLfloat) ((GLubyte *) p)[0]; + break; + + case TYPE_SHORT: + params[0] = (GLfloat) ((GLshort *) p)[0]; + break; + case TYPE_MATRIX: m = *(GLmatrix **) p; for (i = 0; i < 16; i++) @@ -1845,6 +1872,14 @@ _mesa_GetIntegerv(GLenum pname, GLint *params) params[0] = BOOLEAN_TO_INT(*(GLboolean*) p); break; + case TYPE_UBYTE: + params[0] = ((GLubyte *) p)[0]; + break; + + case TYPE_SHORT: + params[0] = ((GLshort *) p)[0]; + break; + case TYPE_MATRIX: m = *(GLmatrix **) p; for (i = 0; i < 16; i++) @@ -2065,6 +2100,14 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params) params[0] = *(GLboolean*) p; break; + case TYPE_UBYTE: + params[0] = ((GLubyte *) p)[0]; + break; + + case TYPE_SHORT: + params[0] = ((GLshort *) p)[0]; + break; + case TYPE_MATRIX: m = *(GLmatrix **) p; for (i = 0; i < 16; i++) @@ -2144,6 +2187,8 @@ _mesa_GetUnsignedBytevEXT(GLenum pname, GLubyte *data) case TYPE_ENUM: case TYPE_ENUM_2: case TYPE_BOOLEAN: + case TYPE_UBYTE: + case TYPE_SHORT: case TYPE_FLOAT: case TYPE_FLOATN: case TYPE_FLOAT_2: @@ -2793,6 +2838,14 @@ _mesa_GetFloati_v(GLenum pname, GLuint index, GLfloat *params) params[0] = BOOLEAN_TO_FLOAT(v.value_bool); break; + case TYPE_UBYTE: + params[0] = (GLfloat) v.value_ubyte; + break; + + case TYPE_SHORT: + params[0] = (GLfloat) v.value_short; + break; + case TYPE_MATRIX: m = *(GLmatrix **) &v; for (i = 0; i < 16; i++) @@ -2876,6 +2929,14 @@ _mesa_GetDoublei_v(GLenum pname, GLuint index, GLdouble *params) params[0] = (GLdouble) BOOLEAN_TO_FLOAT(v.value_bool); break; + case TYPE_UBYTE: + params[0] = (GLdouble) v.value_ubyte; + break; + + case TYPE_SHORT: + params[0] = (GLdouble) v.value_short; + break; + case TYPE_MATRIX: m = *(GLmatrix **) &v; for (i = 0; i < 16; i++) @@ -2928,6 +2989,8 @@ _mesa_GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data) case TYPE_ENUM: case TYPE_ENUM_2: case TYPE_BOOLEAN: + case TYPE_UBYTE: + case TYPE_SHORT: case TYPE_FLOAT: case TYPE_FLOATN: case TYPE_FLOAT_2: @@ -3021,6 +3084,14 @@ _mesa_GetFixedv(GLenum pname, GLfixed *params) params[0] = BOOLEAN_TO_FIXED(((GLboolean*) p)[0]); break; + case TYPE_UBYTE: + params[0] = INT_TO_FIXED(((GLubyte *) p)[0]); + break; + + case TYPE_SHORT: + params[0] = INT_TO_FIXED(((GLshort *) p)[0]); + break; + case TYPE_MATRIX: m = *(GLmatrix **) p; for (i = 0; i < 16; i++) |