diff options
author | Dave Airlie <[email protected]> | 2020-04-03 14:25:51 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2020-04-04 12:37:20 +1000 |
commit | aa95b6aed5bca8c56bb09d9d0a2c92184f1ba671 (patch) | |
tree | 990a4ec0142370c08c3bbfd73b94351b59e344c7 /src/gallium/auxiliary/gallivm | |
parent | 03204dadbc1829128f3e0a5e74f4f85851f6e708 (diff) |
gallivm/rgtc: enable fast path for snorm types.
As per Roland's suggestions it should be easy to enable the
fast path fetch for rgtc snorm as well here.
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4425>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_format_soa.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c index 69e3185f4fa..ab130deb151 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c @@ -741,13 +741,14 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm, /* * Try calling lp_build_fetch_rgba_aos for all pixels. * Should only really hit subsampled, compressed - * (for s3tc srgb too, for rgtc the unorm ones only) by now. + * (for s3tc srgb and rgtc too). * (This is invalid for plain 8unorm formats because we're lazy with * the swizzle since some results would arrive swizzled, some not.) */ if ((format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) && (util_format_fits_8unorm(format_desc) || + format_desc->layout == UTIL_FORMAT_LAYOUT_RGTC || format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) && type.floating && type.width == 32 && (type.length == 1 || (type.length % 4 == 0))) { @@ -757,6 +758,10 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm, const struct util_format_description *flinear_desc; const struct util_format_description *frgba8_desc; unsigned chan; + bool is_signed = (format_desc->format == PIPE_FORMAT_RGTC1_SNORM || + format_desc->format == PIPE_FORMAT_RGTC2_SNORM || + format_desc->format == PIPE_FORMAT_LATC1_SNORM || + format_desc->format == PIPE_FORMAT_LATC2_SNORM); lp_build_context_init(&bld, gallivm, type); @@ -769,6 +774,7 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm, tmp_type.width = 8; tmp_type.length = type.length * 4; tmp_type.norm = TRUE; + tmp_type.sign = is_signed; packed = lp_build_fetch_rgba_aos(gallivm, flinear_desc, tmp_type, aligned, base_ptr, offset, i, j, cache); @@ -778,7 +784,7 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm, * The values are now packed so they match ordinary (srgb) RGBA8 format, * hence need to use matching format for unpack. */ - frgba8_desc = util_format_description(PIPE_FORMAT_R8G8B8A8_UNORM); + frgba8_desc = util_format_description(is_signed ? PIPE_FORMAT_R8G8B8A8_SNORM : PIPE_FORMAT_R8G8B8A8_UNORM); if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) { assert(format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC); frgba8_desc = util_format_description(PIPE_FORMAT_R8G8B8A8_SRGB); @@ -815,7 +821,7 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm, * in particular if the formats have less than 4 channels. * * Right now, this should only be hit for: - * - RGTC snorm formats + * - ETC formats * (those miss fast fetch functions hence they are terrible anyway) */ |