Mesa (master): st/mesa: support EXT_texture_shared_exponent

Marek Olšák mareko at kemper.freedesktop.org
Fri Apr 29 02:36:29 PDT 2011


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Apr 26 02:23:33 2011 +0200

st/mesa: support EXT_texture_shared_exponent

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/state_tracker/st_cb_drawpixels.c |    4 ++++
 src/mesa/state_tracker/st_extensions.c    |    6 ++++++
 src/mesa/state_tracker/st_format.c        |   13 +++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 1707f82..be0cd61 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -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;
          }
       }
    }
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 339e00d..0ad1eda 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -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;
+   }
 }
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 4e7bef2..91afab6 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -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;
    }



More information about the mesa-commit mailing list