From f150e05afcbce73ff8422ffef2ce02536f691f2c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 27 Jun 2009 10:57:03 -0700 Subject: [PATCH] r300g: Fix EXT_packed_depth_stencil functionality. Allow Z24S8 to be a true texture. --- src/gallium/drivers/r300/r300_screen.c | 8 ++++++-- src/gallium/drivers/r300/r300_texture.h | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 6817d7163d6..42a7009481a 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -214,10 +214,14 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, /* Z buffer */ case PIPE_FORMAT_Z16_UNORM: - /* Z buffer with stencil */ - case PIPE_FORMAT_Z24S8_UNORM: return usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL; + /* Z buffer with stencil or texture */ + case PIPE_FORMAT_Z24S8_UNORM: + return usage & + (PIPE_TEXTURE_USAGE_DEPTH_STENCIL | + PIPE_TEXTURE_USAGE_SAMPLER); + /* Definitely unsupported formats. */ /* Non-usable Z buffer/stencil formats. */ case PIPE_FORMAT_Z24X8_UNORM: diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 28157de57bf..5511cca48cb 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -55,10 +55,14 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) /* DXT5 */ case PIPE_FORMAT_DXT5_RGBA: return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5); + /* W24_FP */ + case PIPE_FORMAT_Z24S8_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); default: debug_printf("r300: Implementation error: " "Got unsupported texture format %s in %s\n", pf_name(format), __FUNCTION__); + assert(0); break; } return 0; -- 2.30.2