Handle Tint inspector reflection of bgra8unorm storage texture

The fuzzer produced a shader with this format and hit an UNREACHABLE
in Dawn.

Bug: dawn:1641, chromium:1410048
Change-Id: Ia5ba66a18fc718f7e6dd803f4229ecb12b02753e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117531
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Austin Eng 2023-01-25 19:52:32 +00:00 committed by Dawn LUCI CQ
parent a3e90618dc
commit e8870efb1b
1 changed files with 5 additions and 0 deletions

View File

@ -84,6 +84,8 @@ wgpu::TextureFormat TintImageFormatToTextureFormat(
return wgpu::TextureFormat::R32Sint;
case tint::inspector::ResourceBinding::TexelFormat::kR32Float:
return wgpu::TextureFormat::R32Float;
case tint::inspector::ResourceBinding::TexelFormat::kBgra8Unorm:
return wgpu::TextureFormat::BGRA8Unorm;
case tint::inspector::ResourceBinding::TexelFormat::kRgba8Unorm:
return wgpu::TextureFormat::RGBA8Unorm;
case tint::inspector::ResourceBinding::TexelFormat::kRgba8Snorm:
@ -723,6 +725,9 @@ ResultOrError<std::unique_ptr<EntryPointMetadata>> ReflectEntryPointUsingTint(
info.storageTexture.viewDimension =
TintTextureDimensionToTextureViewDimension(resource.dim);
DAWN_INVALID_IF(info.storageTexture.format == wgpu::TextureFormat::BGRA8Unorm,
"BGRA8Unorm storage textures are not yet supported.");
break;
case BindingInfoType::ExternalTexture:
break;