summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-06-08 17:17:20 -0700
committerKenneth Graunke <[email protected]>2019-06-17 21:52:38 -0500
commite8cd7a30d53c8612d33079c40a8b0c8aa0ef341f (patch)
tree3cc133d04190c6589da7ab82b11a03a0921ad655 /src
parent3c10a2726bcf686f03e31e79e40786e3894ff063 (diff)
iris: Support more RGBX pipe formats.
Without them, the state tracker falls back to an RGBA format, but it doesn't always manage to override the swizzle for us. So we lose the information that the API expects an X channel, where alpha is garbage and reads back as 1. We have no equivalent ISL RGBX format for these, so we just use RGBA directly and override the swizzle in all cases.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/iris/iris_formats.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_formats.c b/src/gallium/drivers/iris/iris_formats.c
index 87bbcbd4069..7ae5806d6da 100644
--- a/src/gallium/drivers/iris/iris_formats.c
+++ b/src/gallium/drivers/iris/iris_formats.c
@@ -315,6 +315,16 @@ iris_isl_format_for_pipe_format(enum pipe_format pf)
[PIPE_FORMAT_ASTC_12x12_SRGB] = ISL_FORMAT_ASTC_LDR_2D_12X12_U8SRGB,
[PIPE_FORMAT_A1B5G5R5_UNORM] = ISL_FORMAT_A1B5G5R5_UNORM,
+
+ /* We support these so that we know the API expects no alpha channel.
+ * Otherwise, the state tracker would just give us a format with alpha
+ * and we wouldn't know to override the swizzle to 1.
+ */
+ [PIPE_FORMAT_R16G16B16X16_UINT] = ISL_FORMAT_R16G16B16A16_UINT,
+ [PIPE_FORMAT_R16G16B16X16_SINT] = ISL_FORMAT_R16G16B16A16_SINT,
+ [PIPE_FORMAT_R32G32B32X32_UINT] = ISL_FORMAT_R32G32B32A32_UINT,
+ [PIPE_FORMAT_R32G32B32X32_SINT] = ISL_FORMAT_R32G32B32A32_SINT,
+ [PIPE_FORMAT_R10G10B10X2_SNORM] = ISL_FORMAT_R10G10B10A2_SNORM,
};
assert(pf < PIPE_FORMAT_COUNT);
return table[pf];
@@ -326,6 +336,7 @@ iris_format_for_usage(const struct gen_device_info *devinfo,
isl_surf_usage_flags_t usage)
{
enum isl_format format = iris_isl_format_for_pipe_format(pformat);
+ const struct isl_format_layout *fmtl = isl_format_get_layout(format);
struct isl_swizzle swizzle = ISL_SWIZZLE_IDENTITY;
if (!util_format_is_srgb(pformat)) {
@@ -340,8 +351,8 @@ iris_format_for_usage(const struct gen_device_info *devinfo,
}
}
- if (pformat == PIPE_FORMAT_DXT1_RGB ||
- pformat == PIPE_FORMAT_DXT1_SRGB) {
+ /* When faking RGBX pipe formats with RGBA ISL formats, override alpha. */
+ if (!util_format_has_alpha(pformat) && fmtl->channels.a.type != ISL_VOID) {
swizzle = ISL_SWIZZLE(RED, GREEN, BLUE, ONE);
}