Mesa (main): freedreno/fdl6: Add support for texture swizzles of A/L/I/LA/RGBx.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 3 20:02:41 UTC 2021
Module: Mesa
Branch: main
Commit: 3050e202833ab3c3ee5e91ee82ee823d8efac563
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3050e202833ab3c3ee5e91ee82ee823d8efac563
Author: Emma Anholt <emma at anholt.net>
Date: Tue Oct 19 10:25:46 2021 -0700
freedreno/fdl6: Add support for texture swizzles of A/L/I/LA/RGBx.
To convert freedreno over, we need to support these formats where we remap
R or RG formats to GL compat ones, or RGBA to RGBx.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13635>
---
src/freedreno/fdl/fd6_view.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/freedreno/fdl/fd6_view.c b/src/freedreno/fdl/fd6_view.c
index 37a46781ccf..8b611080996 100644
--- a/src/freedreno/fdl/fd6_view.c
+++ b/src/freedreno/fdl/fd6_view.c
@@ -89,7 +89,33 @@ fdl6_texswiz(const struct fdl_view_args *args, bool has_z24uint_s8uint)
format_swiz[1] = PIPE_SWIZZLE_0;
}
break;
+
default:
+ /* Our I, L, A, and LA formats use R or RG HW formats. */
+ if (util_format_is_alpha(args->format)) {
+ format_swiz[0] = PIPE_SWIZZLE_0;
+ format_swiz[1] = PIPE_SWIZZLE_0;
+ format_swiz[2] = PIPE_SWIZZLE_0;
+ format_swiz[3] = PIPE_SWIZZLE_X;
+ } else if (util_format_is_luminance(args->format)) {
+ format_swiz[0] = PIPE_SWIZZLE_X;
+ format_swiz[1] = PIPE_SWIZZLE_X;
+ format_swiz[2] = PIPE_SWIZZLE_X;
+ format_swiz[3] = PIPE_SWIZZLE_1;
+ } else if (util_format_is_intensity(args->format)) {
+ format_swiz[0] = PIPE_SWIZZLE_X;
+ format_swiz[1] = PIPE_SWIZZLE_X;
+ format_swiz[2] = PIPE_SWIZZLE_X;
+ format_swiz[3] = PIPE_SWIZZLE_X;
+ } else if (util_format_is_luminance_alpha(args->format)) {
+ format_swiz[0] = PIPE_SWIZZLE_X;
+ format_swiz[1] = PIPE_SWIZZLE_X;
+ format_swiz[2] = PIPE_SWIZZLE_X;
+ format_swiz[3] = PIPE_SWIZZLE_Y;
+ } else if (!util_format_has_alpha(args->format)) {
+ /* for rgbx, force A to 1. Harmless for R/RG, where we already get 1. */
+ format_swiz[3] = PIPE_SWIZZLE_1;
+ }
break;
}
More information about the mesa-commit
mailing list