st/mesa: support EXT_texture_shared_exponent
authorMarek Olšák <maraeo@gmail.com>
Tue, 26 Apr 2011 00:23:33 +0000 (02:23 +0200)
committerMarek Olšák <maraeo@gmail.com>
Fri, 29 Apr 2011 09:31:55 +0000 (11:31 +0200)
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_format.c

index 1707f827cc802eda2475bc4514a04cf61249c15c..be0cd618dd52498512e28d46845886c4753e932a 100644 (file)
@@ -372,6 +372,10 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
             return
                ctx->Extensions.ARB_texture_float ? GL_RGBA32F :
                ctx->Extensions.EXT_texture_snorm ? GL_RGBA16_SNORM : GL_RGBA16;
+
+         case GL_UNSIGNED_INT_5_9_9_9_REV:
+            assert(ctx->Extensions.EXT_texture_shared_exponent);
+            return GL_RGB9_E5;
          }
       }
    }
index 339e00d309ccfae340d5e9e986229b81e74ebaf3..0ad1eda63c19d8fc551c9a4667b44b96597ed348 100644 (file)
@@ -576,4 +576,10 @@ void st_init_extensions(struct st_context *st)
    if (st->pipe->texture_barrier) {
       ctx->Extensions.NV_texture_barrier = GL_TRUE;
    }
+
+   if (screen->is_format_supported(screen, PIPE_FORMAT_R9G9B9E5_FLOAT,
+                                   PIPE_TEXTURE_2D, 0,
+                                   PIPE_BIND_SAMPLER_VIEW)) {
+      ctx->Extensions.EXT_texture_shared_exponent = GL_TRUE;
+   }
 }
index 4e7bef2d2ad1681f757d9e9e80681d09968f1133..91afab6594b31bafc0984590ccd6459cd5483bab 100644 (file)
@@ -325,6 +325,9 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
    case MESA_FORMAT_SIGNED_I16:
       return PIPE_FORMAT_I16_SNORM;
 
+   case MESA_FORMAT_RGB9_E5_FLOAT:
+      return PIPE_FORMAT_R9G9B9E5_FLOAT;
+
    default:
       assert(0);
       return PIPE_FORMAT_NONE;
@@ -545,6 +548,9 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
    case PIPE_FORMAT_I16_SNORM:
       return MESA_FORMAT_SIGNED_I16;
 
+   case PIPE_FORMAT_R9G9B9E5_FLOAT:
+      return MESA_FORMAT_RGB9_E5_FLOAT;
+
    default:
       assert(0);
       return MESA_FORMAT_NONE;
@@ -1483,6 +1489,13 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
                target, sample_count, bindings);
       }
 
+   case GL_RGB9_E5:
+      if (screen->is_format_supported(screen, PIPE_FORMAT_R9G9B9E5_FLOAT, target,
+                                      sample_count, bindings)) {
+         return PIPE_FORMAT_R9G9B9E5_FLOAT;
+      }
+      return PIPE_FORMAT_NONE;
+
    default:
       return PIPE_FORMAT_NONE;
    }