Module: Mesa
Branch: 17.2
Commit: 7f5d86ebaa854ff3f60ba1a201bc2171d25f558b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f5d86ebaa854ff3f60ba1a201bc2171d25f558b

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Thu Aug 10 22:29:54 2017 +0200

radeonsi/gfx9: use the VI codepath for clamping Z

This fixes corrupted shadows in Unigine Valley.
The corruption disappeared when I stopped setting IMG_DATA_FORMAT_24_8
for depth.

Cc: 17.2 <mesa-sta...@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com>
(cherry picked from commit 27fef5d52d44c8684fa4e7a21bd7a4284f3688ee)

---

 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |  2 +-
 src/gallium/drivers/radeonsi/si_state.c           | 12 +-----------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index 3b50ca5341..76b8f57f23 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -1400,7 +1400,7 @@ static void tex_fetch_args(
                 * It's unnecessary if the original texture format was
                 * Z32_FLOAT, but we don't know that here.
                 */
-               if (ctx->screen->b.chip_class == VI)
+               if (ctx->screen->b.chip_class >= VI)
                        z = ac_build_clamp(&ctx->ac, z);
 
                address[count++] = z;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index b7f55668e0..f5d3f1b8bc 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3162,14 +3162,13 @@ si_make_texture_descriptor(struct si_screen *screen,
                           uint32_t *fmask_state)
 {
        struct pipe_resource *res = &tex->resource.b.b;
-       const struct util_format_description *base_desc, *desc;
+       const struct util_format_description *desc;
        unsigned char swizzle[4];
        int first_non_void;
        unsigned num_format, data_format, type;
        uint64_t va;
 
        desc = util_format_description(pipe_format);
-       base_desc = util_format_description(res->format);
 
        if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
                const unsigned char swizzle_xxxx[4] = {0, 0, 0, 0};
@@ -3270,15 +3269,6 @@ si_make_texture_descriptor(struct si_screen *screen,
                data_format = 0;
        }
 
-       /* Enable clamping for UNORM depth formats promoted to Z32F. */
-       if (screen->b.chip_class >= GFX9 &&
-           util_format_has_depth(desc) &&
-           num_format == V_008F14_IMG_NUM_FORMAT_FLOAT &&
-           util_get_depth_format_type(base_desc) != UTIL_FORMAT_TYPE_FLOAT) {
-               /* NUM_FORMAT=FLOAT and DATA_FORMAT=24_8 means "clamp to 
[0,1]". */
-               data_format = V_008F14_IMG_DATA_FORMAT_24_8;
-       }
-
        /* S8 with Z32 HTILE needs a special format. */
        if (screen->b.chip_class >= GFX9 &&
            pipe_format == PIPE_FORMAT_S8_UINT &&

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to