Mesa (master): Add ES 3 handling to get.c and get_hash_generator.py

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


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Dec 14 14:22:28 2012 -0800

Add ES 3 handling to get.c and get_hash_generator.py

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

---

 src/mesa/main/get.c                 |   16 ++++++++++++++++
 src/mesa/main/get_hash_generator.py |    8 +++++++-
 src/mesa/main/mtypes.h              |    1 +
 3 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 273a79f..bfa7d96 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -131,6 +131,7 @@ enum value_extra {
    EXTRA_API_GL,
    EXTRA_API_GL_CORE,
    EXTRA_API_ES2,
+   EXTRA_API_ES3,
    EXTRA_NEW_BUFFERS, 
    EXTRA_NEW_FRAG_CLAMP,
    EXTRA_VALID_DRAW_BUFFER,
@@ -874,6 +875,12 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
 	    enabled++;
 	 }
 	 break;
+      case EXTRA_API_ES3:
+	 if (_mesa_is_gles3(ctx)) {
+	    total++;
+	    enabled++;
+	 }
+	 break;
       case EXTRA_API_GL:
 	 if (_mesa_is_desktop_gl(ctx)) {
 	    total++;
@@ -973,6 +980,15 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
    int api;
 
    api = ctx->API;
+   /* We index into the table_set[] list of per-API hash tables using the API's
+    * value in the gl_api enum. Since GLES 3 doesn't have an API_OPENGL* enum
+    * value since it's compatible with GLES2 its entry in table_set[] is at the
+    * end.
+    */
+   STATIC_ASSERT(Elements(table_set) == API_OPENGL_LAST + 2);
+   if (_mesa_is_gles3(ctx)) {
+      api = API_OPENGL_LAST + 1;
+   }
    mask = Elements(table(api)) - 1;
    hash = (pname * prime_factor);
    while (1) {
diff --git a/src/mesa/main/get_hash_generator.py b/src/mesa/main/get_hash_generator.py
index 4b3f5f4..04bf9ff 100644
--- a/src/mesa/main/get_hash_generator.py
+++ b/src/mesa/main/get_hash_generator.py
@@ -44,7 +44,7 @@ prime_factor = 89
 prime_step = 281
 hash_table_size = 1024
 
-gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2"])
+gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3"])
 
 def print_header():
    print "typedef const unsigned short table_t[%d];\n" % (hash_table_size)
@@ -67,6 +67,7 @@ api_enum = [
    'GLES',
    'GLES2',
    'GL_CORE',
+   'GLES3', # Not in gl_api enum in mtypes.h
 ]
 
 def api_index(api):
@@ -166,6 +167,9 @@ def generate_hash_tables(enum_list, enabled_apis, param_descriptors):
 
          for api in valid_apis:
             add_to_hash_table(tables[api], hash_val, len(params))
+            # Also add GLES2 items to the GLES3 hash table
+            if api == "GLES2":
+               add_to_hash_table(tables["GLES3"], hash_val, len(params))
 
          params.append(["GL_" + enum_name, param[1]])
 
@@ -183,6 +187,8 @@ def opt_to_apis(feature):
    apis = set([_map[feature]])
    if "GL" in apis:
       apis.add("GL_CORE")
+   if "GLES2" in apis:
+      apis.add("GLES3")
 
    return apis
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7c513a1..ad99988 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3358,6 +3358,7 @@ typedef enum
    API_OPENGLES,
    API_OPENGLES2,
    API_OPENGL_CORE,
+   API_OPENGL_LAST = API_OPENGL_CORE,
 } gl_api;
 
 /**




More information about the mesa-commit mailing list