diff options
author | Marek Olšák <[email protected]> | 2017-01-31 22:56:38 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-03-30 14:44:33 +0200 |
commit | fc3c503b5d7fc9843220c8d89c6394f145f096af (patch) | |
tree | dd1020f3754e1b4f547a07c56c38b75503d9b311 /src | |
parent | 5abf60076ce42f3b061e149944a6b4c4ed2c5aa4 (diff) |
radeonsi/gfx9: enable clamping for Z UNORM formats promoted to Z32F
so that shaders don't have to do it.
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 92d2c78a56a..3e0708f9208 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2978,13 +2978,14 @@ 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 *desc; + const struct util_format_description *base_desc, *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}; @@ -3085,6 +3086,15 @@ 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; + } + if (!sampler && (res->target == PIPE_TEXTURE_CUBE || res->target == PIPE_TEXTURE_CUBE_ARRAY || |