From: Courtney Goeltzenleuchter Date: Wed, 13 Nov 2013 20:25:32 +0000 (-0700) Subject: mesa: Add new get entrypoints for ARB_viewport_array X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d9c0011a05a2137ca40fa9ed720520fcc29578f;p=mesa.git mesa: Add new get entrypoints for ARB_viewport_array v2 (idr): Fix several "comparison between signed and unsigned integer expressions" warnings. Signed-off-by: Courtney Goeltzenleuchter Signed-off-by: Ian Romanick Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index c8accb6d261..9edf05620a9 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1730,6 +1730,31 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) v->value_int_4[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0; return TYPE_INT_4; + case GL_SCISSOR_BOX: + if (index >= ctx->Const.MaxViewports) + goto invalid_value; + v->value_int_4[0] = ctx->Scissor.ScissorArray[index].X; + v->value_int_4[1] = ctx->Scissor.ScissorArray[index].Y; + v->value_int_4[2] = ctx->Scissor.ScissorArray[index].Width; + v->value_int_4[3] = ctx->Scissor.ScissorArray[index].Height; + return TYPE_INT_4; + + case GL_VIEWPORT: + if (index >= ctx->Const.MaxViewports) + goto invalid_value; + v->value_float_4[0] = ctx->ViewportArray[index].X; + v->value_float_4[1] = ctx->ViewportArray[index].Y; + v->value_float_4[2] = ctx->ViewportArray[index].Width; + v->value_float_4[3] = ctx->ViewportArray[index].Height; + return TYPE_FLOAT_4; + + case GL_DEPTH_RANGE: + if (index >= ctx->Const.MaxViewports) + goto invalid_value; + v->value_double_2[0] = ctx->ViewportArray[index].Near; + v->value_double_2[1] = ctx->ViewportArray[index].Far; + return TYPE_DOUBLEN_2; + case GL_TRANSFORM_FEEDBACK_BUFFER_START: if (index >= ctx->Const.MaxTransformFeedbackBuffers) goto invalid_value; @@ -1938,6 +1963,26 @@ _mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint *params ) find_value_indexed("glGetIntegeri_v", pname, index, &v); switch (type) { + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = IROUND(v.value_float_4[3]); + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = IROUND(v.value_float_4[2]); + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = IROUND(v.value_float_4[1]); + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = IROUND(v.value_float_4[0]); + break; + + case TYPE_DOUBLEN_2: + params[1] = IROUND(v.value_double_2[1]); + case TYPE_DOUBLEN: + params[0] = IROUND(v.value_double_2[0]); + break; + case TYPE_INT: params[0] = v.value_int; break; @@ -1980,6 +2025,150 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params ) } } +void GLAPIENTRY +_mesa_GetFloati_v(GLenum pname, GLuint index, GLfloat *params) +{ + int i; + GLmatrix *m; + union value v; + enum value_type type = + find_value_indexed("glGetFloati_v", pname, index, &v); + + switch (type) { + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = v.value_float_4[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = v.value_float_4[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = v.value_float_4[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = v.value_float_4[0]; + break; + + case TYPE_DOUBLEN_2: + params[1] = (GLfloat) v.value_double_2[1]; + case TYPE_DOUBLEN: + params[0] = (GLfloat) v.value_double_2[0]; + break; + + case TYPE_INT_4: + params[3] = (GLfloat) v.value_int_4[3]; + case TYPE_INT_3: + params[2] = (GLfloat) v.value_int_4[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = (GLfloat) v.value_int_4[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = (GLfloat) v.value_int_4[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_FLOAT(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = (GLfloat) v.value_int64; + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_FLOAT(v.value_bool); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = m->m[transpose[i]]; + break; + + default: + ; + } +} + +void GLAPIENTRY +_mesa_GetDoublei_v(GLenum pname, GLuint index, GLdouble *params) +{ + int i; + GLmatrix *m; + union value v; + enum value_type type = + find_value_indexed("glGetDoublei_v", pname, index, &v); + + switch (type) { + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = (GLdouble) v.value_float_4[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = (GLdouble) v.value_float_4[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = (GLdouble) v.value_float_4[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = (GLdouble) v.value_float_4[0]; + break; + + case TYPE_DOUBLEN_2: + params[1] = v.value_double_2[1]; + case TYPE_DOUBLEN: + params[0] = v.value_double_2[0]; + break; + + case TYPE_INT_4: + params[3] = (GLdouble) v.value_int_4[3]; + case TYPE_INT_3: + params[2] = (GLdouble) v.value_int_4[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = (GLdouble) v.value_int_4[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = (GLdouble) v.value_int_4[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = (GLdouble) INT_TO_FLOAT(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = (GLdouble) v.value_int64; + break; + + case TYPE_BOOLEAN: + params[0] = (GLdouble) BOOLEAN_TO_FLOAT(v.value_bool); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = (GLdouble) m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = (GLdouble) m->m[transpose[i]]; + break; + + default: + ; + } +} + void GLAPIENTRY _mesa_GetFixedv(GLenum pname, GLfixed *params) { diff --git a/src/mesa/main/get.h b/src/mesa/main/get.h index 0f72508a79e..ce97cc586d4 100644 --- a/src/mesa/main/get.h +++ b/src/mesa/main/get.h @@ -65,6 +65,12 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params ); extern void GLAPIENTRY _mesa_GetPointerv( GLenum pname, GLvoid **params ); +extern void GLAPIENTRY +_mesa_GetFloati_v(GLenum target, GLuint index, GLfloat *data); + +extern void GLAPIENTRY +_mesa_GetDoublei_v(GLenum target, GLuint index, GLdouble *data); + extern const GLubyte * GLAPIENTRY _mesa_GetString( GLenum name );