aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/get.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/get.c')
-rw-r--r--mesalib/src/mesa/main/get.c229
1 files changed, 221 insertions, 8 deletions
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index b13f9a3db..16dce5b65 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -113,6 +113,7 @@ enum value_type {
TYPE_FLOATN_3,
TYPE_FLOATN_4,
TYPE_DOUBLEN,
+ TYPE_DOUBLEN_2,
TYPE_MATRIX,
TYPE_MATRIX_T,
TYPE_CONST
@@ -162,6 +163,7 @@ struct value_desc {
union value {
GLfloat value_float;
GLfloat value_float_4[4];
+ GLdouble value_double_2[2];
GLmatrix *value_matrix;
GLint value_int;
GLint value_int_4[4];
@@ -389,6 +391,7 @@ EXTRA_EXT(ARB_texture_gather);
EXTRA_EXT(ARB_shader_atomic_counters);
EXTRA_EXT(ARB_draw_indirect);
EXTRA_EXT(ARB_shader_image_load_store);
+EXTRA_EXT(ARB_viewport_array);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
@@ -665,10 +668,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
case GL_SCISSOR_BOX:
- v->value_int_4[0] = ctx->Scissor.X;
- v->value_int_4[1] = ctx->Scissor.Y;
- v->value_int_4[2] = ctx->Scissor.Width;
- v->value_int_4[3] = ctx->Scissor.Height;
+ v->value_int_4[0] = ctx->Scissor.ScissorArray[0].X;
+ v->value_int_4[1] = ctx->Scissor.ScissorArray[0].Y;
+ v->value_int_4[2] = ctx->Scissor.ScissorArray[0].Width;
+ v->value_int_4[3] = ctx->Scissor.ScissorArray[0].Height;
+ break;
+
+ case GL_SCISSOR_TEST:
+ v->value_bool = ctx->Scissor.EnableFlags & 1;
break;
case GL_LIST_INDEX:
@@ -685,10 +692,15 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
case GL_VIEWPORT:
- v->value_int_4[0] = ctx->Viewport.X;
- v->value_int_4[1] = ctx->Viewport.Y;
- v->value_int_4[2] = ctx->Viewport.Width;
- v->value_int_4[3] = ctx->Viewport.Height;
+ v->value_float_4[0] = ctx->ViewportArray[0].X;
+ v->value_float_4[1] = ctx->ViewportArray[0].Y;
+ v->value_float_4[2] = ctx->ViewportArray[0].Width;
+ v->value_float_4[3] = ctx->ViewportArray[0].Height;
+ break;
+
+ case GL_DEPTH_RANGE:
+ v->value_double_2[0] = ctx->ViewportArray[0].Near;
+ v->value_double_2[1] = ctx->ViewportArray[0].Far;
break;
case GL_ACTIVE_STENCIL_FACE_EXT:
@@ -1235,6 +1247,8 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params)
params[0] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[0]);
break;
+ case TYPE_DOUBLEN_2:
+ params[1] = FLOAT_TO_BOOLEAN(((GLdouble *) p)[1]);
case TYPE_DOUBLEN:
params[0] = FLOAT_TO_BOOLEAN(((GLdouble *) p)[0]);
break;
@@ -1321,6 +1335,8 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params)
params[0] = ((GLfloat *) p)[0];
break;
+ case TYPE_DOUBLEN_2:
+ params[1] = (GLfloat) (((GLdouble *) p)[1]);
case TYPE_DOUBLEN:
params[0] = (GLfloat) (((GLdouble *) p)[0]);
break;
@@ -1413,6 +1429,8 @@ _mesa_GetIntegerv(GLenum pname, GLint *params)
params[0] = FLOAT_TO_INT(((GLfloat *) p)[0]);
break;
+ case TYPE_DOUBLEN_2:
+ params[1] = FLOAT_TO_INT(((GLdouble *) p)[1]);
case TYPE_DOUBLEN:
params[0] = FLOAT_TO_INT(((GLdouble *) p)[0]);
break;
@@ -1505,6 +1523,8 @@ _mesa_GetInteger64v(GLenum pname, GLint64 *params)
params[0] = FLOAT_TO_INT64(((GLfloat *) p)[0]);
break;
+ case TYPE_DOUBLEN_2:
+ params[1] = FLOAT_TO_INT64(((GLdouble *) p)[1]);
case TYPE_DOUBLEN:
params[0] = FLOAT_TO_INT64(((GLdouble *) p)[0]);
break;
@@ -1591,6 +1611,8 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params)
params[0] = ((GLfloat *) p)[0];
break;
+ case TYPE_DOUBLEN_2:
+ params[1] = ((GLdouble *) p)[1];
case TYPE_DOUBLEN:
params[0] = ((GLdouble *) p)[0];
break;
@@ -1719,6 +1741,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;
@@ -1927,6 +1974,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;
@@ -1970,6 +2037,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)
{
const struct value_desc *d;
@@ -2000,6 +2211,8 @@ _mesa_GetFixedv(GLenum pname, GLfixed *params)
params[0] = FLOAT_TO_FIXED(((GLfloat *) p)[0]);
break;
+ case TYPE_DOUBLEN_2:
+ params[1] = FLOAT_TO_FIXED(((GLdouble *) p)[1]);
case TYPE_DOUBLEN:
params[0] = FLOAT_TO_FIXED(((GLdouble *) p)[0]);
break;