summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-12-01 17:07:09 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:10 -0800
commit90274bd48fac640af8a7f6a673ae72363aaa4491 (patch)
treed948fa78a57903cf3a097b351da0b55bd36aff48
parent47d4ea1a162a965538358710ddc33482887c05e5 (diff)
iris: fix alpha channel for RGB BC1 formats
-rw-r--r--src/gallium/drivers/iris/iris_formats.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gallium/drivers/iris/iris_formats.c b/src/gallium/drivers/iris/iris_formats.c
index 38963de5182..9bb8ec773de 100644
--- a/src/gallium/drivers/iris/iris_formats.c
+++ b/src/gallium/drivers/iris/iris_formats.c
@@ -353,15 +353,20 @@ iris_format_for_usage(const struct gen_device_info *devinfo,
{
struct isl_swizzle swizzle = ISL_SWIZZLE_IDENTITY;
- if ((usage & ISL_SURF_USAGE_TEXTURE_BIT) && !util_format_is_srgb(pformat)) {
- if (util_format_is_intensity(pformat)) {
- swizzle = ISL_SWIZZLE(RED, RED, RED, RED);
- } else if (util_format_is_luminance(pformat)) {
- swizzle = ISL_SWIZZLE(RED, RED, RED, ONE);
- //} else if (util_format_is_alpha(pformat)) {
- //pformat = alpha_to_red(pformat);
- //swizzle = ISL_SWIZZLE(ZERO, ZERO, ZERO, RED);
+ if (usage & ISL_SURF_USAGE_TEXTURE_BIT) {
+ if (!util_format_is_srgb(pformat)) {
+ if (util_format_is_intensity(pformat)) {
+ swizzle = ISL_SWIZZLE(RED, RED, RED, RED);
+ } else if (util_format_is_luminance(pformat)) {
+ swizzle = ISL_SWIZZLE(RED, RED, RED, ONE);
+ //} else if (util_format_is_alpha(pformat)) {
+ //pformat = alpha_to_red(pformat);
+ //swizzle = ISL_SWIZZLE(ZERO, ZERO, ZERO, RED);
+ }
}
+ if (pformat == PIPE_FORMAT_DXT1_RGB ||
+ pformat == PIPE_FORMAT_DXT1_SRGB)
+ swizzle = ISL_SWIZZLE(RED, GREEN, BLUE, ONE);
}
enum isl_format format = iris_isl_format_for_pipe_format(pformat);