Invert component names in RG11B10 and RGB10A2

The CL that introduced this formats reordered their components based on
the name of the Vulkan formats, but it turns out that WebGPU lists
components from low bits to high-bits while Vulkan PACK32 formats are
listed from high to low. So the format component orders match, except
for RGB10A2 which is actually BGR10A2 in Vulkan. Instead the Vulkan
backend is updated to correctly use the RGB10A2 format.

BUG=dawn:128

Change-Id: If7f045f020429c44c84b9aed34a4a80107208d5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8601
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Corentin Wallez
2019-07-08 10:12:16 +00:00
committed by Commit Bot service account
parent ec05355c72
commit 6be313225e
5 changed files with 25 additions and 35 deletions

View File

@@ -160,8 +160,8 @@ namespace dawn_native {
case dawn::TextureFormat::RGBA8Sint:
case dawn::TextureFormat::BGRA8Unorm:
case dawn::TextureFormat::BGRA8UnormSrgb:
case dawn::TextureFormat::A2RGB10Unorm:
case dawn::TextureFormat::B10GR11Float:
case dawn::TextureFormat::RGB10A2Unorm:
case dawn::TextureFormat::RG11B10Float:
return MakeColorFormat(format, true, 4);
case dawn::TextureFormat::RG32Uint:

View File

@@ -179,12 +179,9 @@ namespace dawn_native { namespace metal {
return MTLPixelFormatBGRA8Unorm;
case dawn::TextureFormat::BGRA8UnormSrgb:
return MTLPixelFormatBGRA8Unorm_sRGB;
case dawn::TextureFormat::A2RGB10Unorm:
// TODO(cwallez@chromium.org): The format expectations are inverted compared to the
// implementation of the format in Metal.
UNREACHABLE();
case dawn::TextureFormat::RGB10A2Unorm:
return MTLPixelFormatRGB10A2Unorm;
case dawn::TextureFormat::B10GR11Float:
case dawn::TextureFormat::RG11B10Float:
return MTLPixelFormatRG11B10Float;
case dawn::TextureFormat::RG32Uint:

View File

@@ -269,9 +269,9 @@ namespace dawn_native { namespace vulkan {
return VK_FORMAT_B8G8R8A8_UNORM;
case dawn::TextureFormat::BGRA8UnormSrgb:
return VK_FORMAT_B8G8R8A8_SRGB;
case dawn::TextureFormat::A2RGB10Unorm:
return VK_FORMAT_A2R10G10B10_UNORM_PACK32;
case dawn::TextureFormat::B10GR11Float:
case dawn::TextureFormat::RGB10A2Unorm:
return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
case dawn::TextureFormat::RG11B10Float:
return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
case dawn::TextureFormat::RG32Uint: