summaryrefslogtreecommitdiff
path: root/lib/mesa/src/intel/blorp
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-02-26 12:20:31 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-02-26 12:20:31 +0000
commit9b2e362559110085d2ff9b90fea11fa81e704a78 (patch)
treeb114259e6fecf369e1e7b90f3bb8116fa08b1cf1 /lib/mesa/src/intel/blorp
parentb5fce4e6eb297a6f7fabd0d6c6b4ffdfefa6ad8b (diff)
Import Mesa 13.0.5
Diffstat (limited to 'lib/mesa/src/intel/blorp')
-rw-r--r--lib/mesa/src/intel/blorp/blorp_clear.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/mesa/src/intel/blorp/blorp_clear.c b/lib/mesa/src/intel/blorp/blorp_clear.c
index 7e5015a20..f53d46116 100644
--- a/lib/mesa/src/intel/blorp/blorp_clear.c
+++ b/lib/mesa/src/intel/blorp/blorp_clear.c
@@ -260,6 +260,29 @@ blorp_clear(struct blorp_batch *batch,
if (format == ISL_FORMAT_R9G9B9E5_SHAREDEXP) {
clear_color.u32[0] = float3_to_rgb9e5(clear_color.f32);
format = ISL_FORMAT_R32_UINT;
+ } else if (format == ISL_FORMAT_A4B4G4R4_UNORM) {
+ /* Broadwell and earlier cannot render to this format so we need to work
+ * around it by swapping the colors around and using B4G4R4A4 instead.
+ */
+
+ /* First, we apply the swizzle. */
+ union isl_color_value old;
+ assert((unsigned)(swizzle.r - ISL_CHANNEL_SELECT_RED) < 4);
+ assert((unsigned)(swizzle.g - ISL_CHANNEL_SELECT_RED) < 4);
+ assert((unsigned)(swizzle.b - ISL_CHANNEL_SELECT_RED) < 4);
+ assert((unsigned)(swizzle.a - ISL_CHANNEL_SELECT_RED) < 4);
+ old.u32[swizzle.r - ISL_CHANNEL_SELECT_RED] = clear_color.u32[0];
+ old.u32[swizzle.g - ISL_CHANNEL_SELECT_RED] = clear_color.u32[1];
+ old.u32[swizzle.b - ISL_CHANNEL_SELECT_RED] = clear_color.u32[2];
+ old.u32[swizzle.a - ISL_CHANNEL_SELECT_RED] = clear_color.u32[3];
+ swizzle = ISL_SWIZZLE_IDENTITY;
+
+ /* Now we re-order for the new format */
+ clear_color.u32[0] = old.u32[1];
+ clear_color.u32[1] = old.u32[2];
+ clear_color.u32[2] = old.u32[3];
+ clear_color.u32[3] = old.u32[0];
+ format = ISL_FORMAT_B4G4R4A4_UNORM;
}
memcpy(&params.wm_inputs, clear_color.f32, sizeof(float) * 4);