summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-05-30 12:54:23 -0400
committerIlia Mirkin <[email protected]>2016-08-30 20:25:15 -0400
commit10663c648e58762eb39c7670c9397b74521e8134 (patch)
treed60fdb18fcf7a7c59bc8dc7c946caadc9e666091
parent3b81c998a214a2ad7a4a712577277b1fc7b9be4e (diff)
mesa: add support for GL_PRIMITIVE_BOUNDING_BOX storage and query
Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/mesa/main/bbox.c19
-rw-r--r--src/mesa/main/get.c28
-rw-r--r--src/mesa/main/get_hash_params.py3
-rw-r--r--src/mesa/main/mtypes.h7
4 files changed, 57 insertions, 0 deletions
diff --git a/src/mesa/main/bbox.c b/src/mesa/main/bbox.c
index 0ef5705532c..21843308bf6 100644
--- a/src/mesa/main/bbox.c
+++ b/src/mesa/main/bbox.c
@@ -36,9 +36,28 @@ _mesa_PrimitiveBoundingBox(
GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW,
GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW)
{
+ GET_CURRENT_CONTEXT(ctx);
+
+ ctx->PrimitiveBoundingBox[0] = minX;
+ ctx->PrimitiveBoundingBox[1] = minY;
+ ctx->PrimitiveBoundingBox[2] = minZ;
+ ctx->PrimitiveBoundingBox[3] = minW;
+ ctx->PrimitiveBoundingBox[4] = maxX;
+ ctx->PrimitiveBoundingBox[5] = maxY;
+ ctx->PrimitiveBoundingBox[6] = maxZ;
+ ctx->PrimitiveBoundingBox[7] = maxW;
}
void
_mesa_init_bbox(struct gl_context *ctx)
{
+ ctx->PrimitiveBoundingBox[0] =
+ ctx->PrimitiveBoundingBox[1] =
+ ctx->PrimitiveBoundingBox[2] = -1.0f;
+
+ ctx->PrimitiveBoundingBox[3] =
+ ctx->PrimitiveBoundingBox[4] =
+ ctx->PrimitiveBoundingBox[5] =
+ ctx->PrimitiveBoundingBox[6] =
+ ctx->PrimitiveBoundingBox[7] = 1.0f;
}
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index def2ca55986..810ccb9e396 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -111,6 +111,7 @@ enum value_type {
TYPE_FLOAT_2,
TYPE_FLOAT_3,
TYPE_FLOAT_4,
+ TYPE_FLOAT_8,
TYPE_FLOATN,
TYPE_FLOATN_2,
TYPE_FLOATN_3,
@@ -218,6 +219,7 @@ union value {
#define CONTEXT_FLOAT2(field) CONTEXT_FIELD(field, TYPE_FLOAT_2)
#define CONTEXT_FLOAT3(field) CONTEXT_FIELD(field, TYPE_FLOAT_3)
#define CONTEXT_FLOAT4(field) CONTEXT_FIELD(field, TYPE_FLOAT_4)
+#define CONTEXT_FLOAT8(field) CONTEXT_FIELD(field, TYPE_FLOAT_8)
#define CONTEXT_MATRIX(field) CONTEXT_FIELD(field, TYPE_MATRIX)
#define CONTEXT_MATRIX_T(field) CONTEXT_FIELD(field, TYPE_MATRIX_T)
@@ -467,6 +469,7 @@ EXTRA_EXT(NVX_gpu_memory_info);
EXTRA_EXT(ARB_cull_distance);
EXTRA_EXT(EXT_window_rectangles);
EXTRA_EXT(KHR_blend_equation_advanced_coherent);
+EXTRA_EXT(OES_primitive_bounding_box);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
@@ -1391,6 +1394,11 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params)
params[0] = INT_TO_BOOLEAN(d->offset);
break;
+ case TYPE_FLOAT_8:
+ params[7] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[7]);
+ params[6] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[6]);
+ params[5] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[5]);
+ params[4] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[4]);
case TYPE_FLOAT_4:
case TYPE_FLOATN_4:
params[3] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[3]);
@@ -1479,6 +1487,11 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params)
params[0] = (GLfloat) d->offset;
break;
+ case TYPE_FLOAT_8:
+ params[7] = ((GLfloat *) p)[7];
+ params[6] = ((GLfloat *) p)[6];
+ params[5] = ((GLfloat *) p)[5];
+ params[4] = ((GLfloat *) p)[4];
case TYPE_FLOAT_4:
case TYPE_FLOATN_4:
params[3] = ((GLfloat *) p)[3];
@@ -1567,6 +1580,11 @@ _mesa_GetIntegerv(GLenum pname, GLint *params)
params[0] = d->offset;
break;
+ case TYPE_FLOAT_8:
+ params[7] = IROUND(((GLfloat *) p)[7]);
+ params[6] = IROUND(((GLfloat *) p)[6]);
+ params[5] = IROUND(((GLfloat *) p)[5]);
+ params[4] = IROUND(((GLfloat *) p)[4]);
case TYPE_FLOAT_4:
params[3] = IROUND(((GLfloat *) p)[3]);
case TYPE_FLOAT_3:
@@ -1661,6 +1679,11 @@ _mesa_GetInteger64v(GLenum pname, GLint64 *params)
params[0] = d->offset;
break;
+ case TYPE_FLOAT_8:
+ params[7] = IROUND64(((GLfloat *) p)[7]);
+ params[6] = IROUND64(((GLfloat *) p)[6]);
+ params[5] = IROUND64(((GLfloat *) p)[5]);
+ params[4] = IROUND64(((GLfloat *) p)[4]);
case TYPE_FLOAT_4:
params[3] = IROUND64(((GLfloat *) p)[3]);
case TYPE_FLOAT_3:
@@ -1755,6 +1778,11 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params)
params[0] = d->offset;
break;
+ case TYPE_FLOAT_8:
+ params[7] = ((GLfloat *) p)[7];
+ params[6] = ((GLfloat *) p)[6];
+ params[5] = ((GLfloat *) p)[5];
+ params[4] = ((GLfloat *) p)[4];
case TYPE_FLOAT_4:
case TYPE_FLOATN_4:
params[3] = ((GLfloat *) p)[3];
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 35af48b96aa..a206c851f7e 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -607,6 +607,9 @@ descriptor=[
# GL_ARB_texture_buffer_range
[ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ],
+
+# GL_OES_primitive_bounding_box
+ [ "PRIMITIVE_BOUNDING_BOX_ARB", "CONTEXT_FLOAT8(PrimitiveBoundingBox), extra_OES_primitive_bounding_box" ],
]},
# Remaining enums are only in OpenGL
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c7ed1b3cfd4..d2bc0b5fa90 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4673,6 +4673,13 @@ struct gl_context
* Once this field becomes true, it is never reset to false.
*/
GLboolean ShareGroupReset;
+
+ /**
+ * \name OES_primitive_bounding_box
+ *
+ * Stores the arguments to glPrimitiveBoundingBox
+ */
+ GLfloat PrimitiveBoundingBox[8];
};
/**