st/mesa: support EXT_packed_float
authorMarek Olšák <maraeo@gmail.com>
Tue, 26 Apr 2011 00:28:33 +0000 (02:28 +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 be0cd618dd52498512e28d46845886c4753e932a..31360fd3c110e10966c1207e1ff619f97d25950f 100644 (file)
@@ -376,6 +376,10 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
          case GL_UNSIGNED_INT_5_9_9_9_REV:
             assert(ctx->Extensions.EXT_texture_shared_exponent);
             return GL_RGB9_E5;
+
+         case GL_UNSIGNED_INT_10F_11F_11F_REV:
+            assert(ctx->Extensions.EXT_packed_float);
+            return GL_R11F_G11F_B10F;
          }
       }
    }
index 0ad1eda63c19d8fc551c9a4667b44b96597ed348..a5324df55497ed78b23f079b40a57d3e24ff7231 100644 (file)
@@ -582,4 +582,11 @@ void st_init_extensions(struct st_context *st)
                                    PIPE_BIND_SAMPLER_VIEW)) {
       ctx->Extensions.EXT_texture_shared_exponent = GL_TRUE;
    }
+
+   if (screen->is_format_supported(screen, PIPE_FORMAT_R11G11B10_FLOAT,
+                                   PIPE_TEXTURE_2D, 0,
+                                   PIPE_BIND_RENDER_TARGET |
+                                   PIPE_BIND_SAMPLER_VIEW)) {
+      ctx->Extensions.EXT_packed_float = GL_TRUE;
+   }
 }
index 91afab6594b31bafc0984590ccd6459cd5483bab..b1362108f0ad263d87456f7bd84ab32944853f43 100644 (file)
@@ -327,6 +327,8 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
 
    case MESA_FORMAT_RGB9_E5_FLOAT:
       return PIPE_FORMAT_R9G9B9E5_FLOAT;
+   case MESA_FORMAT_R11_G11_B10_FLOAT:
+      return PIPE_FORMAT_R11G11B10_FLOAT;
 
    default:
       assert(0);
@@ -550,6 +552,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
 
    case PIPE_FORMAT_R9G9B9E5_FLOAT:
       return MESA_FORMAT_RGB9_E5_FLOAT;
+   case PIPE_FORMAT_R11G11B10_FLOAT:
+      return MESA_FORMAT_R11_G11_B10_FLOAT;
 
    default:
       assert(0);
@@ -1496,6 +1500,13 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
       }
       return PIPE_FORMAT_NONE;
 
+   case GL_R11F_G11F_B10F:
+      if (screen->is_format_supported(screen, PIPE_FORMAT_R11G11B10_FLOAT, target,
+                                      sample_count, bindings)) {
+         return PIPE_FORMAT_R11G11B10_FLOAT;
+      }
+      return PIPE_FORMAT_NONE;
+
    default:
       return PIPE_FORMAT_NONE;
    }