mesa/extensions: expose OES_vertex_half_float for ES2
authorKevin Strasser <kevin.strasser@intel.com>
Mon, 10 Oct 2016 21:29:58 +0000 (14:29 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 9 Nov 2016 22:35:20 +0000 (14:35 -0800)
Half float support already exists for desktop GL. Reuse the
ARB_half_float_vertex enable bit and account for the different enum to
enable the extension for ES2.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_draw_upload.c
src/mesa/main/extensions_table.h
src/mesa/main/glformats.c
src/mesa/main/varray.c
src/mesa/state_tracker/st_atom_array.c

index ab2fc505c79806334e5ebf41d4ee23282fee5a57..b138cb7ef6259215c90026b19c876ce27f7c877c 100644 (file)
@@ -290,6 +290,7 @@ brw_get_vertex_surface_type(struct brw_context *brw,
       case GL_DOUBLE: return double_types(brw, size, glarray->Doubles);
       case GL_FLOAT: return float_types[size];
       case GL_HALF_FLOAT:
+      case GL_HALF_FLOAT_OES:
          if (brw->gen < 6 && size == 3)
             return half_float_types[4];
          else
@@ -368,6 +369,7 @@ brw_get_vertex_surface_type(struct brw_context *brw,
       case GL_DOUBLE: return double_types(brw, size, glarray->Doubles);
       case GL_FLOAT: return float_types[size];
       case GL_HALF_FLOAT:
+      case GL_HALF_FLOAT_OES:
          if (brw->gen < 6 && size == 3)
             return half_float_types[4];
          else
index 2dbd7da6c900343f2acbf1bdce31d2e5d8959017..036e62b23e53b149e26bc099857495e21b89eaff 100644 (file)
@@ -392,6 +392,7 @@ EXT(OES_texture_npot                        , ARB_texture_non_power_of_two
 EXT(OES_texture_stencil8                    , ARB_texture_stencil8                   ,  x ,  x ,  x ,  30, 2014)
 EXT(OES_texture_storage_multisample_2d_array, ARB_texture_multisample                ,  x ,  x ,  x ,  31, 2014)
 EXT(OES_vertex_array_object                 , dummy_true                             ,  x ,  x , ES1, ES2, 2010)
+EXT(OES_vertex_half_float                   , ARB_half_float_vertex                  ,  x ,  x ,  x , ES2, 2005)
 EXT(OES_viewport_array                      , OES_viewport_array                     ,  x ,  x ,  x ,  31, 2010)
 
 EXT(S3_s3tc                                 , ANGLE_texture_compression_dxt          , GLL, GLC,  x ,  x , 1999)
index 85d00af487fe4dd580808fec05962ffb6a1e4c69..a95909c9bc9724e65caf03e50c66c606c1226566 100644 (file)
@@ -546,6 +546,7 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
    case GL_FLOAT:
       return comps * sizeof(GLfloat);
    case GL_HALF_FLOAT_ARB:
+   case GL_HALF_FLOAT_OES:
       return comps * sizeof(GLhalfARB);
    case GL_DOUBLE:
       return comps * sizeof(GLdouble);
index 656cb3479c72a496f517b95498f741f6110a2076..c4283551882ea7286b45ccb86c3fe6ece3e57011 100644 (file)
@@ -102,6 +102,7 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
    case GL_UNSIGNED_INT:
       return UNSIGNED_INT_BIT;
    case GL_HALF_FLOAT:
+   case GL_HALF_FLOAT_OES:
       if (ctx->Extensions.ARB_half_float_vertex)
          return HALF_BIT;
       else
@@ -236,8 +237,10 @@ get_legal_types_mask(const struct gl_context *ctx)
          legalTypesMask &= ~(UNSIGNED_INT_BIT |
                              INT_BIT |
                              UNSIGNED_INT_2_10_10_10_REV_BIT |
-                             INT_2_10_10_10_REV_BIT |
-                             HALF_BIT);
+                             INT_2_10_10_10_REV_BIT);
+
+         if (!_mesa_has_OES_vertex_half_float(ctx))
+            legalTypesMask &= ~HALF_BIT;
       }
    }
    else {
index 5ab10de83a248e3c04d5625f20c1e4d0114a91fe..221b2c7db3ffbbf6dc643a388296b2b046c20c7b 100644 (file)
@@ -212,6 +212,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
 {
    assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
           type == GL_FIXED || type == GL_HALF_FLOAT ||
+          type == GL_HALF_FLOAT_OES ||
           type == GL_INT_2_10_10_10_REV ||
           type == GL_UNSIGNED_INT_2_10_10_10_REV ||
           type == GL_UNSIGNED_INT_10F_11F_11F_REV);
@@ -281,7 +282,8 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
       switch (type) {
       case GL_DOUBLE: return double_types[size-1];
       case GL_FLOAT: return float_types[size-1];
-      case GL_HALF_FLOAT: return half_float_types[size-1];
+      case GL_HALF_FLOAT:
+      case GL_HALF_FLOAT_OES: return half_float_types[size-1];
       case GL_INT: return int_types_norm[size-1];
       case GL_SHORT: return short_types_norm[size-1];
       case GL_BYTE: return byte_types_norm[size-1];
@@ -296,7 +298,8 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
       switch (type) {
       case GL_DOUBLE: return double_types[size-1];
       case GL_FLOAT: return float_types[size-1];
-      case GL_HALF_FLOAT: return half_float_types[size-1];
+      case GL_HALF_FLOAT:
+      case GL_HALF_FLOAT_OES: return half_float_types[size-1];
       case GL_INT: return int_types_scale[size-1];
       case GL_SHORT: return short_types_scale[size-1];
       case GL_BYTE: return byte_types_scale[size-1];