anv: Don't use bogus alpha swizzles
For RGB formats in Vulkan, we use the corresponding RGBA format with a swizzle of RGB1. While this swizzle is exactly what we want for texturing, it's not allowed for rendering according to the docs. While we haven't been getting hangs or anything, we should probably obey the docs. This commit just sanitizes all render swizzles so that the alpha channel maps to ALPHA. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
@@ -1552,6 +1552,21 @@ anv_get_isl_format(const struct gen_device_info *devinfo, VkFormat vk_format,
|
||||
return anv_get_format(devinfo, vk_format, aspect, tiling).isl_format;
|
||||
}
|
||||
|
||||
static inline struct isl_swizzle
|
||||
anv_swizzle_for_render(struct isl_swizzle swizzle)
|
||||
{
|
||||
/* Sometimes the swizzle will have alpha map to one. We do this to fake
|
||||
* RGB as RGBA for texturing
|
||||
*/
|
||||
assert(swizzle.a == ISL_CHANNEL_SELECT_ONE ||
|
||||
swizzle.a == ISL_CHANNEL_SELECT_ALPHA);
|
||||
|
||||
/* But it doesn't matter what we render to that channel */
|
||||
swizzle.a = ISL_CHANNEL_SELECT_ALPHA;
|
||||
|
||||
return swizzle;
|
||||
}
|
||||
|
||||
void
|
||||
anv_pipeline_setup_l3_config(struct anv_pipeline *pipeline, bool needs_slm);
|
||||
|
||||
|
Reference in New Issue
Block a user