[Mesa-dev] [PATCH 4/4] mesa: Support querying GL_MAX_ELEMENT_INDEX in ES 3

Matt Turner mattst88 at gmail.com
Wed Nov 28 13:22:03 PST 2012


The ES 3 spec says that the minumum allowable value is 2^24-1, but the
GL 4.3 and ARB_ES3_compatibility specs require 2^32-1, so return 2^32-1.

Fixes es3conform's element_index_uint_constants test.
---
 src/mesa/main/context.c          |    3 +++
 src/mesa/main/get.c              |    6 ++++++
 src/mesa/main/get_hash_params.py |    3 +++
 src/mesa/main/mtypes.h           |    3 +++
 4 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index f5f3131..4f0a4a0 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -656,6 +656,9 @@ _mesa_init_constants(struct gl_context *ctx)
 
    /* PrimitiveRestart */
    ctx->Const.PrimitiveRestartInSoftware = GL_FALSE;
+
+   /* ES 3.0 */
+   ctx->Const.MaxElementIndex = UINT_MAX;
 }
 
 
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 0351b37..d474336 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -338,6 +338,12 @@ static const int extra_ARB_ES2_compatibility_api_es2_api_es3[] = {
    EXTRA_END
 };
 
+static const int extra_ARB_ES3_compatibility_api_es3[] = {
+   EXT(ARB_ES3_compatibility),
+   EXTRA_API_ES3,
+   EXTRA_END
+};
+
 static const int extra_ARB_sync_api_es3[] = {
    EXT(ARB_sync),
    EXTRA_API_ES3,
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index c9815e7..5494cb5 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -693,6 +693,9 @@ descriptor=[
   [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), extra_ARB_ES2_compatibility_api_es2_api_es3" ],
   [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility_api_es2_api_es3" ],
   [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility_api_es2_api_es3" ],
+
+# GL_ARB_ES3_compatibility
+  [ "MAX_ELEMENT_INDEX", "CONTEXT_INT64(Const.MaxElementIndex), extra_ARB_ES3_compatibility_api_es3"],
 ]}
 
 ]
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ce92cd7..600b159 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2938,6 +2938,9 @@ struct gl_constants
 
    /** GL_ARB_map_buffer_alignment */
    GLuint MinMapBufferAlignment;
+
+   /** ES 3.0 */
+   GLint64 MaxElementIndex;
 };
 
 
-- 
1.7.8.6



More information about the mesa-dev mailing list