From: Marek Olšák Date: Tue, 26 Apr 2011 00:23:33 +0000 (+0200) Subject: st/mesa: support EXT_texture_shared_exponent X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1da44f5923c5715d78a48dc300bbc6cbd3f3ea99;p=mesa.git st/mesa: support EXT_texture_shared_exponent Reviewed-by: Brian Paul --- diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 1707f827cc8..be0cd618dd5 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 339e00d309c..0ad1eda63c1 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 4e7bef2d2ad..91afab6594b 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; }