summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-05-15 21:50:47 -0700
committerJason Ekstrand <[email protected]>2016-05-17 12:17:22 -0700
commit100db3d31c1fd9284fc96132dccde1fa289a88c3 (patch)
tree38179ab1a32162d541a2184fc5750f81c69cb4bc /src
parentce375fba413a803f264335c7dd6e72b0003021f9 (diff)
anv/formats: Set the swizzle to RGB1 when using an RGBA format to fake RGB
This way we get correct sampling from RGB formats that are faked as RGBA. This should also cause it to disable rendering and blending on those formats. We should be able to render to them and, on Broadwell and above, we can blend on them with work-arounds. However, we'll add support for that more properly later when it's deemed useful. For now, disabling rendering and blending should be safe.
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_formats.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 228f4672073..233abc1882e 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -34,6 +34,7 @@
#define RGBA ISL_SWIZZLE(RED, GREEN, BLUE, ALPHA)
#define BGRA ISL_SWIZZLE(BLUE, GREEN, RED, ALPHA)
+#define RGB1 ISL_SWIZZLE(RED, GREEN, BLUE, ONE)
#define swiz_fmt(__vk_fmt, __hw_fmt, __swizzle) \
[__vk_fmt] = { \
@@ -278,10 +279,12 @@ anv_get_format(VkFormat vk_format, VkImageAspectFlags aspect,
* hood.
*/
enum isl_format rgbx = isl_format_rgb_to_rgbx(format.isl_format);
- if (rgbx != ISL_FORMAT_UNSUPPORTED)
+ if (rgbx != ISL_FORMAT_UNSUPPORTED) {
format.isl_format = rgbx;
- else
+ } else {
format.isl_format = isl_format_rgb_to_rgba(format.isl_format);
+ format.swizzle = (struct anv_format_swizzle) RGB1;
+ }
}
return format;