[Mesa-dev] [PATCH 1/2] anv: allow blue in alpha component in swizzle for render
Juan A. Suarez Romero
jasuarez at igalia.com
Wed Feb 8 12:31:54 UTC 2017
In pre-Broadwell devices, as B4G4R4A4 is not supported natively, we
workaround it by using a format with a more complex swizzle, that uses
blue in alpha component.
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
---
src/intel/vulkan/anv_private.h | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 51e85c7..e9bf13c 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1559,13 +1559,19 @@ 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
+ * RGB as RGBA for texturing.
+ *
+ * It can have also alpha to blue. This happens to workaround support for
+ * B4G4R4A4 in gen < 8 devices, as this not supported natively.
*/
assert(swizzle.a == ISL_CHANNEL_SELECT_ONE ||
- swizzle.a == ISL_CHANNEL_SELECT_ALPHA);
+ swizzle.a == ISL_CHANNEL_SELECT_ALPHA ||
+ swizzle.a == ISL_CHANNEL_SELECT_BLUE);
- /* But it doesn't matter what we render to that channel */
- swizzle.a = ISL_CHANNEL_SELECT_ALPHA;
+ /* But it doesn't matter what we render to that channel, except for the
+ * B4G4R4A4 workaround */
+ if (swizzle.a == ISL_CHANNEL_SELECT_ONE)
+ swizzle.a = ISL_CHANNEL_SELECT_ALPHA;
return swizzle;
}
--
2.9.3
More information about the mesa-dev
mailing list