[Mesa-dev] [PATCH 3/4] st/mesa: support EXT_packed_float
Marek Olšák
maraeo at gmail.com
Thu Apr 28 05:04:24 PDT 2011
---
src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++++
src/mesa/state_tracker/st_extensions.c | 7 +++++++
src/mesa/state_tracker/st_format.c | 11 +++++++++++
3 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index be0cd61..31360fd 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -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;
}
}
}
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index f280279..388d2d6 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -580,4 +580,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;
+ }
}
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 4b3a175..55aec86 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -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);
@@ -1477,6 +1481,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;
}
--
1.7.4.1
More information about the mesa-dev
mailing list