aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_formats.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-08-13 16:41:19 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:08 -0800
commitea19d359ccfff6db0aef0a234e90d6855e094ab8 (patch)
tree754a37bfaef89f77fd6cfbe9d6a895c5025f77f8 /src/gallium/drivers/iris/iris_formats.c
parent906becec7068d06e8a0947be951658a9c8a6083d (diff)
iris: Convert RGBX to RGBA for rendering.
Fixes a bunch of RGB bugs.
Diffstat (limited to 'src/gallium/drivers/iris/iris_formats.c')
-rw-r--r--src/gallium/drivers/iris/iris_formats.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_formats.c b/src/gallium/drivers/iris/iris_formats.c
index 7bb227175e0..06c48a5583b 100644
--- a/src/gallium/drivers/iris/iris_formats.c
+++ b/src/gallium/drivers/iris/iris_formats.c
@@ -398,6 +398,26 @@ iris_isl_format_for_pipe_format(enum pipe_format pf)
return table[pf];
}
+enum isl_format
+iris_isl_format_for_usage(const struct gen_device_info *devinfo,
+ enum pipe_format pformat,
+ isl_surf_usage_flags_t usage)
+{
+ enum isl_format format = iris_isl_format_for_pipe_format(pformat);
+
+ /* Convert RGBX into RGBA for rendering or typed image access. */
+ if (isl_format_is_rgbx(format) &&
+ (((usage & ISL_SURF_USAGE_RENDER_TARGET_BIT) &&
+ !isl_format_supports_rendering(devinfo, format)) ||
+ ((usage & ISL_SURF_USAGE_STORAGE_BIT) &&
+ !(isl_format_supports_typed_writes(devinfo, format) &&
+ isl_format_supports_typed_reads(devinfo, format))))) {
+ format = isl_format_rgbx_to_rgba(format);
+ }
+
+ return format;
+}
+
/**
* The pscreen->is_format_supported() driver hook.
*