Fully support all 16-bit packed texture formats
Vulkan lists the following formats as 16-bit packed formats:
* VK_FORMAT_R4G4B4A4_UNORM_PACK16
* VK_FORMAT_B4G4R4A4_UNORM_PACK16
* VK_FORMAT_R5G6B5_UNORM_PACK16
* VK_FORMAT_B5G6R5_UNORM_PACK16
* VK_FORMAT_R5G5B5A1_UNORM_PACK16
* VK_FORMAT_B5G5R5A1_UNORM_PACK16
* VK_FORMAT_A1R5G5B5_UNORM_PACK16
We already support VK_FORMAT_A1R5G5B5_UNORM_PACK16, so we can use that
as a crossreference to see which tests we expect to pass.
Bug: b/139351376
Tests: dEQP-VK.*pack16*
Change-Id: Ia7b0b9efe92c7f67c803579fee7c8e0d62ef081f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/57048
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Sean Risser <srisser@google.com>
Commit-Queue: Sean Risser <srisser@google.com>
diff --git a/src/Pipeline/Constants.cpp b/src/Pipeline/Constants.cpp
index ce921e6..5855fce 100644
--- a/src/Pipeline/Constants.cpp
+++ b/src/Pipeline/Constants.cpp
@@ -252,6 +252,10 @@
for(int i = 0; i < 16; i++)
{
mask5551Q[i] = word4((i & 0x1 ? 0x001F : 0) | (i & 0x2 ? 0x03E0 : 0) | (i & 0x4 ? 0x7C00 : 0) | (i & 8 ? 0x8000 : 0));
+ maskr5g5b5a1Q[i] = word4((i & 0x1 ? 0x003E : 0) | (i & 0x2 ? 0x07C0 : 0) | (i & 0x4 ? 0xF800 : 0) | (i & 8 ? 0x0001 : 0));
+ maskb5g5r5a1Q[i] = word4((i & 0x1 ? 0xF800 : 0) | (i & 0x2 ? 0x07C0 : 0) | (i & 0x4 ? 0x003E : 0) | (i & 8 ? 0x0001 : 0));
+ mask4rgbaQ[i] = word4((i & 0x1 ? 0x00F0 : 0) | (i & 0x2 ? 0x0F00 : 0) | (i & 0x4 ? 0xF000 : 0) | (i & 8 ? 0x000F : 0));
+ mask4bgraQ[i] = word4((i & 0x1 ? 0xF000 : 0) | (i & 0x2 ? 0x0F00 : 0) | (i & 0x4 ? 0x00F0 : 0) | (i & 8 ? 0x000F : 0));
}
for(int i = 0; i < 4; i++)