Commit 457bd9b1 by Alexis Hetu Committed by Alexis Hétu

Support for VK_FORMAT_A1R5G5B5_UNORM_PACK16 in Blitter

Added support for VK_FORMAT_A1R5G5B5_UNORM_PACK16 in the Blitter. Passes all tests in: [dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.color] .b4g4r4a4_unorm_pack16.a1r5g5b5_unorm_pack16.* .r8g8_snorm.a1r5g5b5_unorm_pack16.* .a8b8g8r8_unorm_pack32.a1r5g5b5_unorm_pack16.* .a8b8g8r8_snorm_pack32.a1r5g5b5_unorm_pack16.* Bug b/119620767 Change-Id: I366cb5697b60b4f0fb51931a6be7b8732cf789ec Reviewed-on: https://swiftshader-review.googlesource.com/c/23328Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent a28671d1
......@@ -324,6 +324,12 @@ namespace sw
c.y = Float(Int((*Pointer<UShort>(element) & UShort(0x07E0)) >> UShort(5)));
c.z = Float(Int(*Pointer<UShort>(element) & UShort(0x001F)));
break;
case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
c.w = Float(Int((*Pointer<UShort>(element) & UShort(0x8000)) >> UShort(15)));
c.x = Float(Int((*Pointer<UShort>(element) & UShort(0x7C00)) >> UShort(10)));
c.y = Float(Int((*Pointer<UShort>(element) & UShort(0x03E0)) >> UShort(5)));
c.z = Float(Int(*Pointer<UShort>(element) & UShort(0x001F)));
break;
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
case VK_FORMAT_A2B10G10R10_UINT_PACK32:
c.x = Float(Int((*Pointer<UInt>(element) & UInt(0x000003FF))));
......@@ -576,6 +582,28 @@ namespace sw
(RoundInt(Float(c.x)) << Int(11))) & UShort(mask));
}
break;
case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
if(writeRGBA)
{
*Pointer<UShort>(element) = UShort(RoundInt(Float(c.z)) |
(RoundInt(Float(c.y)) << Int(5)) |
(RoundInt(Float(c.x)) << Int(10)) |
(RoundInt(Float(c.w)) << Int(15)));
}
else
{
unsigned short mask = (writeA ? 0x8000 : 0x0000) |
(writeR ? 0x7C00 : 0x0000) |
(writeG ? 0x03E0 : 0x0000) |
(writeB ? 0x001F : 0x0000);
unsigned short unmask = ~mask;
*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
(UShort(RoundInt(Float(c.z)) |
(RoundInt(Float(c.y)) << Int(5)) |
(RoundInt(Float(c.x)) << Int(10)) |
(RoundInt(Float(c.w)) << Int(15))) & UShort(mask));
}
break;
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
case VK_FORMAT_A2B10G10R10_UINT_PACK32:
if(writeRGBA)
......@@ -844,6 +872,9 @@ namespace sw
case VK_FORMAT_A2B10G10R10_UINT_PACK32:
scale = vector(1.0f, 1.0f, 1.0f, 1.0f);
break;
case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
scale = vector(0x1F, 0x1F, 0x1F, 0x01);
break;
case VK_FORMAT_R5G6B5_UNORM_PACK16:
scale = vector(0x1F, 0x3F, 0x1F, 1.0f);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment