[Mesa-dev] [PATCH 1/1] mesa: initial work for OES_vertex_type_10_10_10_2 extension support.

Oliver McFadden oliver.mcfadden at linux.intel.com
Tue May 22 00:55:36 PDT 2012


Currently not supported by any driver implementation; this only adds the
API framework.

Signed-off-by: Oliver McFadden <oliver.mcfadden at linux.intel.com>
---
 src/mesa/main/APIspec.xml  |    7 +++----
 src/mesa/main/extensions.c |    1 +
 src/mesa/main/glheader.h   |    5 +++++
 src/mesa/main/mtypes.h     |    1 +
 src/mesa/main/varray.c     |   14 +++++++++++++-
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index f23857a..71cc47e 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -2691,15 +2691,13 @@
 		<value name="GL_FLOAT"/>
 		<value name="GL_FIXED"/>
 		<value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
-		<value name="GL_UNSIGNED_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
-		<value name="GL_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
 	</desc>
 
-	<desc name="type" category="OES_vertex_type_10_10_10_2">
+	<desc name="type" error="GL_INVALID_VALUE" category="OES_vertex_type_10_10_10_2">
 		<value name="GL_UNSIGNED_INT_10_10_10_2_OES"/>
 		<value name="GL_INT_10_10_10_2_OES"/>
 
-		<desc name="size">
+		<desc name="size" error="GL_INVALID_VALUE">
 			<value name="3"/>
 			<value name="4"/>
 		</desc>
@@ -4122,6 +4120,7 @@
 <api name="GLES2.0">
 	<category name="GLES2.0"/>
 
+	<category name="OES_vertex_type_10_10_10_2"/>
 	<category name="OES_compressed_paletted_texture"/>
 	<category name="OES_compressed_ETC1_RGB8_texture"/>
 	<category name="OES_depth24"/>
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index a843a40..9b74f1c 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -258,6 +258,7 @@ static const struct extension extension_table[] = {
    { "GL_OES_texture_env_crossbar",                o(ARB_texture_env_crossbar),                     ES1,       2005 },
    { "GL_OES_texture_mirrored_repeat",             o(dummy_true),                                   ES1,       2005 },
    { "GL_OES_texture_npot",                        o(ARB_texture_non_power_of_two),                       ES2, 2005 },
+   { "GL_OES_vertex_type_10_10_10_2",              o(OES_vertex_type_10_10_10_2),                         ES2, 2008 },
 
    /* Vendor extensions */
    { "GL_3DFX_texture_compression_FXT1",           o(TDFX_texture_compression_FXT1),           GL,             1999 },
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 3152323..30ce34d 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -143,6 +143,11 @@ typedef void *GLeglImageOES;
 #define GL_ETC1_RGB8_OES                                        0x8D64
 #endif
 
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_UNSIGNED_INT_10_10_10_2_OES                          0x8DF6
+#define GL_INT_10_10_10_2_OES                                   0x8DF7
+#endif
 
 /**
  * Internal token to represent a GLSL shader program (a collection of
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index eefe5e7..51ebc00 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2964,6 +2964,7 @@ struct gl_extensions
    GLboolean EXT_timer_query;
    GLboolean EXT_vertex_array_bgra;
    GLboolean OES_standard_derivatives;
+   GLboolean OES_vertex_type_10_10_10_2;
    /* vendor extensions */
    GLboolean AMD_seamless_cubemap_per_texture;
    GLboolean APPLE_packed_pixels;
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index efa63b0..376e62f 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -61,6 +61,8 @@
 #define FIXED_GL_BIT         0x800
 #define UNSIGNED_INT_2_10_10_10_REV_BIT 0x1000
 #define INT_2_10_10_10_REV_BIT 0x2000
+#define UNSIGNED_INT_10_10_10_2_OES_BIT 0x8000
+#define INT_10_10_10_2_OES_BIT 0x10000
 
 
 /** Convert GL datatype enum into a <type>_BIT value seen above */
@@ -97,6 +99,10 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
       return UNSIGNED_INT_2_10_10_10_REV_BIT;
    case GL_INT_2_10_10_10_REV:
       return INT_2_10_10_10_REV_BIT;
+   case GL_UNSIGNED_INT_10_10_10_2_OES:
+      return UNSIGNED_INT_10_10_10_2_OES_BIT;
+   case GL_INT_10_10_10_2_OES:
+      return INT_10_10_10_2_OES_BIT;
    default:
       return 0;
    }
@@ -144,6 +150,10 @@ update_array(struct gl_context *ctx,
       legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
                           INT_2_10_10_10_REV_BIT);
    }
+   if (!ctx->Extensions.OES_vertex_type_10_10_10_2) {
+      legalTypesMask &= ~(UNSIGNED_INT_10_10_10_2_OES_BIT |
+                          INT_10_10_10_2_OES_BIT);
+   }
 
    typeBit = type_to_bit(ctx, type);
    if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) {
@@ -434,7 +444,9 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
                                   HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
                                   FIXED_ES_BIT | FIXED_GL_BIT |
                                   UNSIGNED_INT_2_10_10_10_REV_BIT |
-                                  INT_2_10_10_10_REV_BIT);
+                                  INT_2_10_10_10_REV_BIT |
+                                  UNSIGNED_INT_10_10_10_2_OES_BIT |
+                                  INT_10_10_10_2_OES_BIT);
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-- 
1.7.8



More information about the mesa-dev mailing list