[Mesa-dev] [PATCH] st/mesa: prefer formats without stencil for DEPTH_COMPONENT
Marek Olšák
maraeo at gmail.com
Tue May 24 05:32:17 PDT 2011
for fast Z clears to be used more often
---
src/mesa/state_tracker/st_format.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index b136210..d42bcb4 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -870,12 +870,16 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
return PIPE_FORMAT_Z16_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT24:
- if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- target, sample_count, bindings))
- return PIPE_FORMAT_Z24_UNORM_S8_USCALED;
- if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
- target, sample_count, bindings))
- return PIPE_FORMAT_S8_USCALED_Z24_UNORM;
+ {
+ static const enum pipe_format formats[] = {
+ PIPE_FORMAT_Z24X8_UNORM,
+ PIPE_FORMAT_X8Z24_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED,
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM,
+ };
+ return find_supported_format(screen, formats, Elements(formats),
+ target, sample_count, bindings);
+ }
/* fall-through */
case GL_DEPTH_COMPONENT32:
if (screen->is_format_supported(screen, PIPE_FORMAT_Z32_UNORM, target,
@@ -885,10 +889,12 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
case GL_DEPTH_COMPONENT:
{
static const enum pipe_format formats[] = {
+ PIPE_FORMAT_Z24X8_UNORM,
+ PIPE_FORMAT_X8Z24_UNORM,
PIPE_FORMAT_Z32_UNORM,
+ PIPE_FORMAT_Z16_UNORM,
PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_FORMAT_S8_USCALED_Z24_UNORM,
- PIPE_FORMAT_Z16_UNORM
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM
};
return find_supported_format(screen, formats, Elements(formats),
target, sample_count, bindings);
--
1.7.4.1
More information about the mesa-dev
mailing list