Mesa (master): mesa: Support querying GL_MAX_ELEMENT_INDEX in ES 3

Matt Turner mattst88 at kemper.freedesktop.org
Thu Jan 10 19:00:28 UTC 2013


Module: Mesa
Branch: master
Commit: 532e05a9d094fdcdeb2c8dfd0bec6eab82dc8163
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=532e05a9d094fdcdeb2c8dfd0bec6eab82dc8163

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sat Dec  8 17:24:19 2012 -0800

mesa: Support querying GL_MAX_ELEMENT_INDEX in ES 3

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.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 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           |   11 +++++++++++
 4 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index fc2db12..561eb46 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 or ARB_ES3_compatibility */
+   ctx->Const.MaxElementIndex = 0xffffffffu;
 }
 
 
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 6490db2..e15cbd4 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -309,6 +309,12 @@ static const int extra_ARB_ES2_compatibility_api_es2[] = {
    EXTRA_END
 };
 
+static const int extra_ARB_ES3_compatibility_api_es3[] = {
+   EXT(ARB_ES3_compatibility),
+   EXTRA_API_ES3,
+   EXTRA_END
+};
+
 EXTRA_EXT(ARB_texture_cube_map);
 EXTRA_EXT(MESA_texture_array);
 EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 3ad61d3..c0826c7 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -321,6 +321,9 @@ descriptor=[
 
 # Enums in  OpenGL and ES 3.0
 { "apis": ["GL", "GL_CORE", "GLES3"], "params": [
+# GL_ARB_ES3_compatibility
+  [ "MAX_ELEMENT_INDEX", "CONTEXT_INT64(Const.MaxElementIndex), extra_ARB_ES3_compatibility_api_es3"],
+
 # GL_ARB_fragment_shader
   [ "MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents), extra_ARB_fragment_shader" ],
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ad99988..318dcb5 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2962,6 +2962,17 @@ struct gl_constants
     * Drivers that support transform feedback must set this value to GL_FALSE.
     */
    GLboolean DisableVaryingPacking;
+
+   /*
+    * Maximum value supported for an index in DrawElements and friends.
+    *
+    * This must be at least (1ull<<24)-1.  The default value is
+    * (1ull<<32)-1.
+    *
+    * \since ES 3.0 or GL_ARB_ES3_compatibility
+    * \sa _mesa_init_constants
+    */
+   GLuint64 MaxElementIndex;
 };
 
 




More information about the mesa-commit mailing list