[Mesa-dev] [PATCH 1/2] intel/blorp: Handle clearing of A4B4G4R4 on all platforms
Kenneth Graunke
kenneth at whitecape.org
Tue Jan 31 23:24:17 UTC 2017
On Friday, January 27, 2017 2:18:34 PM PST Jason Ekstrand wrote:
> Cc: "13.0 17.0" <mesa-stable at lists.freedesktop.org>
> ---
> src/intel/blorp/blorp_clear.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
> index afc505d..f8ac6dc 100644
> --- a/src/intel/blorp/blorp_clear.c
> +++ b/src/intel/blorp/blorp_clear.c
> @@ -349,6 +349,25 @@ 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;
> + 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;
Are ISL_CHANNEL_SELECT_{ZERO,ONE} disallowed by a higher level? If not,
this will break rather spectacularly (old.u32[-4] = ...). Maybe add
asserts?
Assuming that isn't a problem,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> +
> + /* 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(¶ms.wm_inputs.clear_color, clear_color.f32, sizeof(float) * 4);
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170131/4065bac7/attachment.sig>
More information about the mesa-dev
mailing list