mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
Convert StorageTextureTests to WGSL
Bug: tint:140 Fixed: tint:368 Change-Id: I339ff9546d21ea236a14dce9815d08fd13bbbbdb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37080 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
d2fb128052
commit
331b78a739
@@ -15,7 +15,7 @@
|
||||
#include "TextureFormatUtils.h"
|
||||
|
||||
namespace utils {
|
||||
const char* GetColorTextureComponentTypePrefix(wgpu::TextureFormat textureFormat) {
|
||||
const char* GetColorTextureComponentGLSLTypePrefix(wgpu::TextureFormat textureFormat) {
|
||||
switch (textureFormat) {
|
||||
case wgpu::TextureFormat::R8Unorm:
|
||||
case wgpu::TextureFormat::R8Snorm:
|
||||
@@ -64,6 +64,55 @@ namespace utils {
|
||||
}
|
||||
}
|
||||
|
||||
const char* GetColorTextureComponentWGSLTypePrefix(wgpu::TextureFormat textureFormat) {
|
||||
switch (textureFormat) {
|
||||
case wgpu::TextureFormat::R8Unorm:
|
||||
case wgpu::TextureFormat::R8Snorm:
|
||||
case wgpu::TextureFormat::R16Float:
|
||||
case wgpu::TextureFormat::RG8Unorm:
|
||||
case wgpu::TextureFormat::RG8Snorm:
|
||||
case wgpu::TextureFormat::R32Float:
|
||||
case wgpu::TextureFormat::RG16Float:
|
||||
case wgpu::TextureFormat::RGBA8Unorm:
|
||||
case wgpu::TextureFormat::RGBA8Snorm:
|
||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||
case wgpu::TextureFormat::RG32Float:
|
||||
case wgpu::TextureFormat::RGBA16Float:
|
||||
case wgpu::TextureFormat::RGBA32Float:
|
||||
case wgpu::TextureFormat::BGRA8Unorm:
|
||||
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
||||
case wgpu::TextureFormat::RGBA8UnormSrgb:
|
||||
return "f";
|
||||
|
||||
case wgpu::TextureFormat::R8Uint:
|
||||
case wgpu::TextureFormat::R16Uint:
|
||||
case wgpu::TextureFormat::RG8Uint:
|
||||
case wgpu::TextureFormat::R32Uint:
|
||||
case wgpu::TextureFormat::RG16Uint:
|
||||
case wgpu::TextureFormat::RGBA8Uint:
|
||||
case wgpu::TextureFormat::RG32Uint:
|
||||
case wgpu::TextureFormat::RGBA16Uint:
|
||||
case wgpu::TextureFormat::RGBA32Uint:
|
||||
return "u";
|
||||
|
||||
case wgpu::TextureFormat::R8Sint:
|
||||
case wgpu::TextureFormat::R16Sint:
|
||||
case wgpu::TextureFormat::RG8Sint:
|
||||
case wgpu::TextureFormat::R32Sint:
|
||||
case wgpu::TextureFormat::RG16Sint:
|
||||
case wgpu::TextureFormat::RGBA8Sint:
|
||||
case wgpu::TextureFormat::RG32Sint:
|
||||
case wgpu::TextureFormat::RGBA16Sint:
|
||||
case wgpu::TextureFormat::RGBA32Sint:
|
||||
return "i";
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
const char* GetColorTextureComponentWGSLType(wgpu::TextureFormat textureFormat) {
|
||||
switch (textureFormat) {
|
||||
case wgpu::TextureFormat::R8Unorm:
|
||||
@@ -432,4 +481,44 @@ namespace utils {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
const char* GetWGSLImageFormatQualifier(wgpu::TextureFormat textureFormat) {
|
||||
switch (textureFormat) {
|
||||
case wgpu::TextureFormat::RGBA8Unorm:
|
||||
return "rgba8unorm";
|
||||
case wgpu::TextureFormat::RGBA8Snorm:
|
||||
return "rgba8snorm";
|
||||
case wgpu::TextureFormat::RGBA8Uint:
|
||||
return "rgba8uint";
|
||||
case wgpu::TextureFormat::RGBA8Sint:
|
||||
return "rgba8sint";
|
||||
case wgpu::TextureFormat::RGBA16Uint:
|
||||
return "rgba16uint";
|
||||
case wgpu::TextureFormat::RGBA16Sint:
|
||||
return "rgba16sint";
|
||||
case wgpu::TextureFormat::RGBA16Float:
|
||||
return "rgba16float";
|
||||
case wgpu::TextureFormat::R32Uint:
|
||||
return "r32uint";
|
||||
case wgpu::TextureFormat::R32Sint:
|
||||
return "r32sint";
|
||||
case wgpu::TextureFormat::R32Float:
|
||||
return "r32float";
|
||||
case wgpu::TextureFormat::RG32Uint:
|
||||
return "rg32uint";
|
||||
case wgpu::TextureFormat::RG32Sint:
|
||||
return "rg32sint";
|
||||
case wgpu::TextureFormat::RG32Float:
|
||||
return "rg32float";
|
||||
case wgpu::TextureFormat::RGBA32Uint:
|
||||
return "rgba32uint";
|
||||
case wgpu::TextureFormat::RGBA32Sint:
|
||||
return "rgba32sint";
|
||||
case wgpu::TextureFormat::RGBA32Float:
|
||||
return "rgba32float";
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
||||
@@ -87,7 +87,8 @@ namespace utils {
|
||||
wgpu::TextureFormat::BC6HRGBUfloat, wgpu::TextureFormat::BC6HRGBFloat,
|
||||
wgpu::TextureFormat::BC7RGBAUnorm, wgpu::TextureFormat::BC7RGBAUnormSrgb};
|
||||
|
||||
const char* GetColorTextureComponentTypePrefix(wgpu::TextureFormat textureFormat);
|
||||
const char* GetColorTextureComponentGLSLTypePrefix(wgpu::TextureFormat textureFormat);
|
||||
const char* GetColorTextureComponentWGSLTypePrefix(wgpu::TextureFormat textureFormat);
|
||||
const char* GetColorTextureComponentWGSLType(wgpu::TextureFormat textureFormat);
|
||||
bool TextureFormatSupportsStorageTexture(wgpu::TextureFormat format);
|
||||
|
||||
@@ -95,6 +96,7 @@ namespace utils {
|
||||
uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat);
|
||||
uint32_t GetTextureFormatBlockHeight(wgpu::TextureFormat textureFormat);
|
||||
const char* GetGLSLImageFormatQualifier(wgpu::TextureFormat textureFormat);
|
||||
const char* GetWGSLImageFormatQualifier(wgpu::TextureFormat textureFormat);
|
||||
} // namespace utils
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user