Add wgpu::TextureFormat::RGB9E5Ufloat
Also update RG11B10Float to be name RG11B10Ufloat Bug: dawn:22 Change-Id: I0ea76dc25c37ebaeb4c2c2c2a119d00940acc145 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25760 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
b54c82ed39
commit
2f6e4ec6c0
55
dawn.json
55
dawn.json
|
@ -1645,37 +1645,38 @@
|
||||||
{"value": 23, "name": "BGRA8 unorm"},
|
{"value": 23, "name": "BGRA8 unorm"},
|
||||||
{"value": 24, "name": "BGRA8 unorm srgb"},
|
{"value": 24, "name": "BGRA8 unorm srgb"},
|
||||||
{"value": 25, "name": "RGB10 A2 unorm"},
|
{"value": 25, "name": "RGB10 A2 unorm"},
|
||||||
{"value": 26, "name": "RG11 B10 float"},
|
{"value": 26, "name": "RG11 B10 ufloat"},
|
||||||
|
{"value": 27, "name": "RGB9 E5 ufloat"},
|
||||||
|
|
||||||
{"value": 27, "name": "RG32 float"},
|
{"value": 28, "name": "RG32 float"},
|
||||||
{"value": 28, "name": "RG32 uint"},
|
{"value": 29, "name": "RG32 uint"},
|
||||||
{"value": 29, "name": "RG32 sint"},
|
{"value": 30, "name": "RG32 sint"},
|
||||||
{"value": 30, "name": "RGBA16 uint"},
|
{"value": 31, "name": "RGBA16 uint"},
|
||||||
{"value": 31, "name": "RGBA16 sint"},
|
{"value": 32, "name": "RGBA16 sint"},
|
||||||
{"value": 32, "name": "RGBA16 float"},
|
{"value": 33, "name": "RGBA16 float"},
|
||||||
|
|
||||||
{"value": 33, "name": "RGBA32 float"},
|
{"value": 34, "name": "RGBA32 float"},
|
||||||
{"value": 34, "name": "RGBA32 uint"},
|
{"value": 35, "name": "RGBA32 uint"},
|
||||||
{"value": 35, "name": "RGBA32 sint"},
|
{"value": 36, "name": "RGBA32 sint"},
|
||||||
|
|
||||||
{"value": 36, "name": "depth32 float"},
|
{"value": 37, "name": "depth32 float"},
|
||||||
{"value": 37, "name": "depth24 plus"},
|
{"value": 38, "name": "depth24 plus"},
|
||||||
{"value": 38, "name": "depth24 plus stencil8"},
|
{"value": 39, "name": "depth24 plus stencil8"},
|
||||||
|
|
||||||
{"value": 39, "name": "BC1 RGBA unorm"},
|
{"value": 40, "name": "BC1 RGBA unorm"},
|
||||||
{"value": 40, "name": "BC1 RGBA unorm srgb"},
|
{"value": 41, "name": "BC1 RGBA unorm srgb"},
|
||||||
{"value": 41, "name": "BC2 RGBA unorm"},
|
{"value": 42, "name": "BC2 RGBA unorm"},
|
||||||
{"value": 42, "name": "BC2 RGBA unorm srgb"},
|
{"value": 43, "name": "BC2 RGBA unorm srgb"},
|
||||||
{"value": 43, "name": "BC3 RGBA unorm"},
|
{"value": 44, "name": "BC3 RGBA unorm"},
|
||||||
{"value": 44, "name": "BC3 RGBA unorm srgb"},
|
{"value": 45, "name": "BC3 RGBA unorm srgb"},
|
||||||
{"value": 45, "name": "BC4 R unorm"},
|
{"value": 46, "name": "BC4 R unorm"},
|
||||||
{"value": 46, "name": "BC4 R snorm"},
|
{"value": 47, "name": "BC4 R snorm"},
|
||||||
{"value": 47, "name": "BC5 RG unorm"},
|
{"value": 48, "name": "BC5 RG unorm"},
|
||||||
{"value": 48, "name": "BC5 RG snorm"},
|
{"value": 49, "name": "BC5 RG snorm"},
|
||||||
{"value": 49, "name": "BC6H RGB ufloat"},
|
{"value": 50, "name": "BC6H RGB ufloat"},
|
||||||
{"value": 50, "name": "BC6H RGB sfloat"},
|
{"value": 51, "name": "BC6H RGB sfloat"},
|
||||||
{"value": 51, "name": "BC7 RGBA unorm"},
|
{"value": 52, "name": "BC7 RGBA unorm"},
|
||||||
{"value": 52, "name": "BC7 RGBA unorm srgb"}
|
{"value": 53, "name": "BC7 RGBA unorm srgb"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"texture usage": {
|
"texture usage": {
|
||||||
|
|
|
@ -93,6 +93,8 @@ typedef uint32_t WGPUFlags;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
//* TODO(dawn:22) remove this once the PSA is sent and the deadline passed.
|
||||||
|
#define WGPUTextureFormat_RG11B10Float WGPUTextureFormat_RG11B10Ufloat
|
||||||
|
|
||||||
typedef struct WGPUChainedStruct {
|
typedef struct WGPUChainedStruct {
|
||||||
struct WGPUChainedStruct const * next;
|
struct WGPUChainedStruct const * next;
|
||||||
|
|
|
@ -26,6 +26,10 @@ namespace wgpu {
|
||||||
{% for value in type.values %}
|
{% for value in type.values %}
|
||||||
{{as_cppEnum(value.name)}} = 0x{{format(value.value, "08X")}},
|
{{as_cppEnum(value.name)}} = 0x{{format(value.value, "08X")}},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
//* TODO(dawn:22) remove this once the PSA is sent and the deadline passed.
|
||||||
|
{% if type.name.canonical_case() == "texture format" %}
|
||||||
|
RG11B10Float = RG11B10Ufloat,
|
||||||
|
{% endif %}
|
||||||
};
|
};
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -282,7 +282,8 @@ namespace dawn_native {
|
||||||
AddColorFormat(wgpu::TextureFormat::BGRA8UnormSrgb, true, false, 4, Type::Float);
|
AddColorFormat(wgpu::TextureFormat::BGRA8UnormSrgb, true, false, 4, Type::Float);
|
||||||
AddColorFormat(wgpu::TextureFormat::RGB10A2Unorm, true, false, 4, Type::Float);
|
AddColorFormat(wgpu::TextureFormat::RGB10A2Unorm, true, false, 4, Type::Float);
|
||||||
|
|
||||||
AddColorFormat(wgpu::TextureFormat::RG11B10Float, false, false, 4, Type::Float);
|
AddColorFormat(wgpu::TextureFormat::RG11B10Ufloat, false, false, 4, Type::Float);
|
||||||
|
AddColorFormat(wgpu::TextureFormat::RGB9E5Ufloat, false, false, 4, Type::Float);
|
||||||
|
|
||||||
// 8 bytes color formats
|
// 8 bytes color formats
|
||||||
AddColorFormat(wgpu::TextureFormat::RG32Uint, true, true, 8, Type::Uint);
|
AddColorFormat(wgpu::TextureFormat::RG32Uint, true, true, 8, Type::Uint);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
// The number of formats Dawn knows about. Asserts in BuildFormatTable ensure that this is the
|
// The number of formats Dawn knows about. Asserts in BuildFormatTable ensure that this is the
|
||||||
// exact number of known format.
|
// exact number of known format.
|
||||||
static constexpr size_t kKnownFormatCount = 52;
|
static constexpr size_t kKnownFormatCount = 53;
|
||||||
|
|
||||||
// A wgpu::TextureFormat along with all the information about it necessary for validation.
|
// A wgpu::TextureFormat along with all the information about it necessary for validation.
|
||||||
struct Format : TexelBlockInfo {
|
struct Format : TexelBlockInfo {
|
||||||
|
|
|
@ -194,7 +194,7 @@ namespace dawn_native {
|
||||||
case spv::ImageFormatRgb10A2:
|
case spv::ImageFormatRgb10A2:
|
||||||
return wgpu::TextureFormat::RGB10A2Unorm;
|
return wgpu::TextureFormat::RGB10A2Unorm;
|
||||||
case spv::ImageFormatR11fG11fB10f:
|
case spv::ImageFormatR11fG11fB10f:
|
||||||
return wgpu::TextureFormat::RG11B10Float;
|
return wgpu::TextureFormat::RG11B10Ufloat;
|
||||||
case spv::ImageFormatRg32f:
|
case spv::ImageFormatRg32f:
|
||||||
return wgpu::TextureFormat::RG32Float;
|
return wgpu::TextureFormat::RG32Float;
|
||||||
case spv::ImageFormatRg32ui:
|
case spv::ImageFormatRg32ui:
|
||||||
|
@ -265,7 +265,7 @@ namespace dawn_native {
|
||||||
case shaderc_spvc_storage_texture_format_rgb10a2unorm:
|
case shaderc_spvc_storage_texture_format_rgb10a2unorm:
|
||||||
return wgpu::TextureFormat::RGB10A2Unorm;
|
return wgpu::TextureFormat::RGB10A2Unorm;
|
||||||
case shaderc_spvc_storage_texture_format_rg11b10float:
|
case shaderc_spvc_storage_texture_format_rg11b10float:
|
||||||
return wgpu::TextureFormat::RG11B10Float;
|
return wgpu::TextureFormat::RG11B10Ufloat;
|
||||||
case shaderc_spvc_storage_texture_format_rg32float:
|
case shaderc_spvc_storage_texture_format_rg32float:
|
||||||
return wgpu::TextureFormat::RG32Float;
|
return wgpu::TextureFormat::RG32Float;
|
||||||
case shaderc_spvc_storage_texture_format_rg32uint:
|
case shaderc_spvc_storage_texture_format_rg32uint:
|
||||||
|
|
|
@ -144,8 +144,10 @@ namespace dawn_native { namespace d3d12 {
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
return DXGI_FORMAT_R10G10B10A2_TYPELESS;
|
return DXGI_FORMAT_R10G10B10A2_TYPELESS;
|
||||||
|
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
return DXGI_FORMAT_R11G11B10_FLOAT;
|
return DXGI_FORMAT_R11G11B10_FLOAT;
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
|
return DXGI_FORMAT_R9G9B9E5_SHAREDEXP;
|
||||||
|
|
||||||
case wgpu::TextureFormat::RG32Uint:
|
case wgpu::TextureFormat::RG32Uint:
|
||||||
case wgpu::TextureFormat::RG32Sint:
|
case wgpu::TextureFormat::RG32Sint:
|
||||||
|
@ -258,8 +260,10 @@ namespace dawn_native { namespace d3d12 {
|
||||||
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
return DXGI_FORMAT_R11G11B10_FLOAT;
|
return DXGI_FORMAT_R11G11B10_FLOAT;
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
|
return DXGI_FORMAT_R9G9B9E5_SHAREDEXP;
|
||||||
|
|
||||||
case wgpu::TextureFormat::RG32Uint:
|
case wgpu::TextureFormat::RG32Uint:
|
||||||
return DXGI_FORMAT_R32G32_UINT;
|
return DXGI_FORMAT_R32G32_UINT;
|
||||||
|
|
|
@ -172,8 +172,10 @@ namespace dawn_native { namespace metal {
|
||||||
return MTLPixelFormatBGRA8Unorm_sRGB;
|
return MTLPixelFormatBGRA8Unorm_sRGB;
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
return MTLPixelFormatRGB10A2Unorm;
|
return MTLPixelFormatRGB10A2Unorm;
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
return MTLPixelFormatRG11B10Float;
|
return MTLPixelFormatRG11B10Float;
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
|
return MTLPixelFormatRGB9E5Float;
|
||||||
|
|
||||||
case wgpu::TextureFormat::RG32Uint:
|
case wgpu::TextureFormat::RG32Uint:
|
||||||
return MTLPixelFormatRG32Uint;
|
return MTLPixelFormatRG32Uint;
|
||||||
|
|
|
@ -74,7 +74,8 @@ namespace dawn_native { namespace opengl {
|
||||||
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
|
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
|
||||||
AddFormat(wgpu::TextureFormat::BGRA8Unorm, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, Type::Float);
|
AddFormat(wgpu::TextureFormat::BGRA8Unorm, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, Type::Float);
|
||||||
AddFormat(wgpu::TextureFormat::RGB10A2Unorm, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, Type::Float);
|
AddFormat(wgpu::TextureFormat::RGB10A2Unorm, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, Type::Float);
|
||||||
AddFormat(wgpu::TextureFormat::RG11B10Float, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, Type::Float);
|
AddFormat(wgpu::TextureFormat::RG11B10Ufloat, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, Type::Float);
|
||||||
|
AddFormat(wgpu::TextureFormat::RGB9E5Ufloat, GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, Type::Float);
|
||||||
|
|
||||||
// 8 bytes color formats
|
// 8 bytes color formats
|
||||||
AddFormat(wgpu::TextureFormat::RG32Uint, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, Type::Uint);
|
AddFormat(wgpu::TextureFormat::RG32Uint, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, Type::Uint);
|
||||||
|
|
|
@ -295,8 +295,10 @@ namespace dawn_native { namespace vulkan {
|
||||||
return VK_FORMAT_B8G8R8A8_SRGB;
|
return VK_FORMAT_B8G8R8A8_SRGB;
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
|
return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
|
return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
|
return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32;
|
||||||
|
|
||||||
case wgpu::TextureFormat::RG32Uint:
|
case wgpu::TextureFormat::RG32Uint:
|
||||||
return VK_FORMAT_R32G32_UINT;
|
return VK_FORMAT_R32G32_UINT;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "utils/TextureFormatUtils.h"
|
#include "utils/TextureFormatUtils.h"
|
||||||
#include "utils/WGPUHelpers.h"
|
#include "utils/WGPUHelpers.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
// An expectation for float buffer content that can correctly compare different NaN values and
|
// An expectation for float buffer content that can correctly compare different NaN values and
|
||||||
|
@ -685,8 +686,8 @@ TEST_P(TextureFormatTest, RGB10A2Unorm) {
|
||||||
uncompressedData, textureData);
|
uncompressedData, textureData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the RG11B10Float format
|
// Test the RG11B10Ufloat format
|
||||||
TEST_P(TextureFormatTest, RG11B10Float) {
|
TEST_P(TextureFormatTest, RG11B10Ufloat) {
|
||||||
constexpr uint32_t kFloat11Zero = 0;
|
constexpr uint32_t kFloat11Zero = 0;
|
||||||
constexpr uint32_t kFloat11Infinity = 0x7C0;
|
constexpr uint32_t kFloat11Infinity = 0x7C0;
|
||||||
constexpr uint32_t kFloat11Nan = 0x7C1;
|
constexpr uint32_t kFloat11Nan = 0x7C1;
|
||||||
|
@ -714,7 +715,7 @@ TEST_P(TextureFormatTest, RG11B10Float) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is one of the only 3-channel formats, so we don't have specific testing for them. Alpha
|
// This is one of the only 3-channel formats, so we don't have specific testing for them. Alpha
|
||||||
// should slways be sampled as 1
|
// should always be sampled as 1
|
||||||
// clang-format off
|
// clang-format off
|
||||||
std::vector<float> uncompressedData = {
|
std::vector<float> uncompressedData = {
|
||||||
0.0f, INFINITY, NAN, 1.0f,
|
0.0f, INFINITY, NAN, 1.0f,
|
||||||
|
@ -725,7 +726,54 @@ TEST_P(TextureFormatTest, RG11B10Float) {
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
DoFloatFormatSamplingTest(
|
DoFloatFormatSamplingTest(
|
||||||
{wgpu::TextureFormat::RG11B10Float, 4, wgpu::TextureComponentType::Float, 4}, textureData,
|
{wgpu::TextureFormat::RG11B10Ufloat, 4, wgpu::TextureComponentType::Float, 4}, textureData,
|
||||||
|
uncompressedData);
|
||||||
|
// This format is not renderable.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test the RGB9E5Ufloat format
|
||||||
|
TEST_P(TextureFormatTest, RGB9E5Ufloat) {
|
||||||
|
// RGB9E5 is different from other floating point formats because the mantissa doesn't index in
|
||||||
|
// the window defined by the exponent but is instead treated as a pure multiplier. There is
|
||||||
|
// also no Infinity or NaN. The OpenGL 4.6 spec has the best explanation I've found in section
|
||||||
|
// 8.25 "Shared Exponent Texture Color Conversion":
|
||||||
|
//
|
||||||
|
// red = reduint * 2^(expuint - B - N) = reduint * 2^(expuint - 24)
|
||||||
|
//
|
||||||
|
// Where reduint and expuint are the integer values when considering the E5 as a 5bit uint, and
|
||||||
|
// the r9 as a 9bit uint. B the number of bits of the mantissa (9), and N the offset for the
|
||||||
|
// exponent (15).
|
||||||
|
|
||||||
|
float smallestExponent = std::pow(2.0f, -24.0f);
|
||||||
|
float largestExponent = std::pow(2.0f, float(31 - 24));
|
||||||
|
|
||||||
|
auto MakeRGB9E5 = [](uint32_t r, uint32_t g, uint32_t b, uint32_t e) {
|
||||||
|
ASSERT((r & 0x1FF) == r);
|
||||||
|
ASSERT((g & 0x1FF) == g);
|
||||||
|
ASSERT((b & 0x1FF) == b);
|
||||||
|
ASSERT((e & 0x1F) == e);
|
||||||
|
return r | g << 9 | b << 18 | e << 27;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Test the smallest largest, and "1" exponents
|
||||||
|
std::vector<uint32_t> textureData = {
|
||||||
|
MakeRGB9E5(0, 1, 2, 0b00000),
|
||||||
|
MakeRGB9E5(2, 1, 0, 0b11111),
|
||||||
|
MakeRGB9E5(0, 1, 2, 0b11000),
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is one of the only 3-channel formats, so we don't have specific testing for them. Alpha
|
||||||
|
// should always be sampled as 1
|
||||||
|
// clang-format off
|
||||||
|
std::vector<float> uncompressedData = {
|
||||||
|
0.0f, smallestExponent, 2.0f * smallestExponent, 1.0f,
|
||||||
|
2.0f * largestExponent, largestExponent, 0.0f, 1.0f,
|
||||||
|
0.0f, 1.0f, 2.0f, 1.0f,
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
DoFloatFormatSamplingTest(
|
||||||
|
{wgpu::TextureFormat::RGB9E5Ufloat, 4, wgpu::TextureComponentType::Float, 4}, textureData,
|
||||||
uncompressedData);
|
uncompressedData);
|
||||||
// This format is not renderable.
|
// This format is not renderable.
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,11 +152,11 @@ TEST_F(RenderPipelineValidationTest, NonRenderableFormat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Fails because RG11B10Float is non-renderable
|
// Fails because RG11B10Ufloat is non-renderable
|
||||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||||
descriptor.vertexStage.module = vsModule;
|
descriptor.vertexStage.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragmentStage.module = fsModule;
|
||||||
descriptor.cColorStates[0].format = wgpu::TextureFormat::RG11B10Float;
|
descriptor.cColorStates[0].format = wgpu::TextureFormat::RG11B10Ufloat;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,7 +344,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureFormatInShaders) {
|
||||||
wgpu::TextureFormat::RG8Snorm, wgpu::TextureFormat::RG8Uint,
|
wgpu::TextureFormat::RG8Snorm, wgpu::TextureFormat::RG8Uint,
|
||||||
wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::RG16Uint,
|
wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::RG16Uint,
|
||||||
wgpu::TextureFormat::RG16Sint, wgpu::TextureFormat::RG16Float,
|
wgpu::TextureFormat::RG16Sint, wgpu::TextureFormat::RG16Float,
|
||||||
wgpu::TextureFormat::RGB10A2Unorm, wgpu::TextureFormat::RG11B10Float};
|
wgpu::TextureFormat::RGB10A2Unorm, wgpu::TextureFormat::RG11B10Ufloat};
|
||||||
|
|
||||||
for (wgpu::BindingType storageTextureBindingType : kSupportedStorageTextureBindingTypes) {
|
for (wgpu::BindingType storageTextureBindingType : kSupportedStorageTextureBindingTypes) {
|
||||||
for (wgpu::TextureFormat format : kWGPUTextureFormatSupportedAsSPIRVImageFormats) {
|
for (wgpu::TextureFormat format : kWGPUTextureFormatSupportedAsSPIRVImageFormats) {
|
||||||
|
|
|
@ -330,7 +330,7 @@ namespace {
|
||||||
device.CreateTexture(&descriptor);
|
device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
wgpu::TextureFormat nonRenderableFormats[] = {
|
wgpu::TextureFormat nonRenderableFormats[] = {
|
||||||
wgpu::TextureFormat::RG11B10Float,
|
wgpu::TextureFormat::RG11B10Ufloat,
|
||||||
wgpu::TextureFormat::R8Snorm,
|
wgpu::TextureFormat::R8Snorm,
|
||||||
wgpu::TextureFormat::RG8Snorm,
|
wgpu::TextureFormat::RG8Snorm,
|
||||||
wgpu::TextureFormat::RGBA8Snorm,
|
wgpu::TextureFormat::RGBA8Snorm,
|
||||||
|
|
|
@ -27,7 +27,8 @@ namespace utils {
|
||||||
case wgpu::TextureFormat::RGBA8Unorm:
|
case wgpu::TextureFormat::RGBA8Unorm:
|
||||||
case wgpu::TextureFormat::RGBA8Snorm:
|
case wgpu::TextureFormat::RGBA8Snorm:
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
case wgpu::TextureFormat::RG32Float:
|
case wgpu::TextureFormat::RG32Float:
|
||||||
case wgpu::TextureFormat::RGBA16Float:
|
case wgpu::TextureFormat::RGBA16Float:
|
||||||
case wgpu::TextureFormat::RGBA32Float:
|
case wgpu::TextureFormat::RGBA32Float:
|
||||||
|
@ -118,7 +119,8 @@ namespace utils {
|
||||||
case wgpu::TextureFormat::BGRA8Unorm:
|
case wgpu::TextureFormat::BGRA8Unorm:
|
||||||
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
case wgpu::TextureFormat::Depth32Float:
|
case wgpu::TextureFormat::Depth32Float:
|
||||||
return 4u;
|
return 4u;
|
||||||
|
|
||||||
|
@ -189,7 +191,8 @@ namespace utils {
|
||||||
case wgpu::TextureFormat::BGRA8Unorm:
|
case wgpu::TextureFormat::BGRA8Unorm:
|
||||||
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
case wgpu::TextureFormat::RG32Float:
|
case wgpu::TextureFormat::RG32Float:
|
||||||
case wgpu::TextureFormat::RG32Uint:
|
case wgpu::TextureFormat::RG32Uint:
|
||||||
case wgpu::TextureFormat::RG32Sint:
|
case wgpu::TextureFormat::RG32Sint:
|
||||||
|
@ -254,7 +257,8 @@ namespace utils {
|
||||||
case wgpu::TextureFormat::BGRA8Unorm:
|
case wgpu::TextureFormat::BGRA8Unorm:
|
||||||
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
case wgpu::TextureFormat::RG32Float:
|
case wgpu::TextureFormat::RG32Float:
|
||||||
case wgpu::TextureFormat::RG32Uint:
|
case wgpu::TextureFormat::RG32Uint:
|
||||||
case wgpu::TextureFormat::RG32Sint:
|
case wgpu::TextureFormat::RG32Sint:
|
||||||
|
@ -338,7 +342,7 @@ namespace utils {
|
||||||
return "rgba8i";
|
return "rgba8i";
|
||||||
case wgpu::TextureFormat::RGB10A2Unorm:
|
case wgpu::TextureFormat::RGB10A2Unorm:
|
||||||
return "rgb10_a2";
|
return "rgb10_a2";
|
||||||
case wgpu::TextureFormat::RG11B10Float:
|
case wgpu::TextureFormat::RG11B10Ufloat:
|
||||||
return "r11f_g11f_b10f";
|
return "r11f_g11f_b10f";
|
||||||
case wgpu::TextureFormat::RG32Float:
|
case wgpu::TextureFormat::RG32Float:
|
||||||
return "rg32f";
|
return "rg32f";
|
||||||
|
@ -359,6 +363,7 @@ namespace utils {
|
||||||
case wgpu::TextureFormat::RGBA32Sint:
|
case wgpu::TextureFormat::RGBA32Sint:
|
||||||
return "rgba32i";
|
return "rgba32i";
|
||||||
|
|
||||||
|
case wgpu::TextureFormat::RGB9E5Ufloat:
|
||||||
case wgpu::TextureFormat::RGBA8UnormSrgb:
|
case wgpu::TextureFormat::RGBA8UnormSrgb:
|
||||||
case wgpu::TextureFormat::BGRA8Unorm:
|
case wgpu::TextureFormat::BGRA8Unorm:
|
||||||
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
case wgpu::TextureFormat::BGRA8UnormSrgb:
|
||||||
|
|
|
@ -22,33 +22,60 @@
|
||||||
#include "common/Assert.h"
|
#include "common/Assert.h"
|
||||||
|
|
||||||
namespace utils {
|
namespace utils {
|
||||||
static constexpr std::array<wgpu::TextureFormat, 52> kAllTextureFormats = {
|
static constexpr std::array<wgpu::TextureFormat, 53> kAllTextureFormats = {
|
||||||
wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::R8Snorm,
|
wgpu::TextureFormat::R8Unorm,
|
||||||
wgpu::TextureFormat::R8Uint, wgpu::TextureFormat::R8Sint,
|
wgpu::TextureFormat::R8Snorm,
|
||||||
wgpu::TextureFormat::R16Uint, wgpu::TextureFormat::R16Sint,
|
wgpu::TextureFormat::R8Uint,
|
||||||
wgpu::TextureFormat::R16Float, wgpu::TextureFormat::RG8Unorm,
|
wgpu::TextureFormat::R8Sint,
|
||||||
wgpu::TextureFormat::RG8Snorm, wgpu::TextureFormat::RG8Uint,
|
wgpu::TextureFormat::R16Uint,
|
||||||
wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::R32Float,
|
wgpu::TextureFormat::R16Sint,
|
||||||
wgpu::TextureFormat::R32Uint, wgpu::TextureFormat::R32Sint,
|
wgpu::TextureFormat::R16Float,
|
||||||
wgpu::TextureFormat::RG16Uint, wgpu::TextureFormat::RG16Sint,
|
wgpu::TextureFormat::RG8Unorm,
|
||||||
wgpu::TextureFormat::RG16Float, wgpu::TextureFormat::RGBA8Unorm,
|
wgpu::TextureFormat::RG8Snorm,
|
||||||
wgpu::TextureFormat::RGBA8UnormSrgb, wgpu::TextureFormat::RGBA8Snorm,
|
wgpu::TextureFormat::RG8Uint,
|
||||||
wgpu::TextureFormat::RGBA8Uint, wgpu::TextureFormat::RGBA8Sint,
|
wgpu::TextureFormat::RG8Sint,
|
||||||
wgpu::TextureFormat::BGRA8Unorm, wgpu::TextureFormat::BGRA8UnormSrgb,
|
wgpu::TextureFormat::R32Float,
|
||||||
wgpu::TextureFormat::RGB10A2Unorm, wgpu::TextureFormat::RG11B10Float,
|
wgpu::TextureFormat::R32Uint,
|
||||||
wgpu::TextureFormat::RG32Float, wgpu::TextureFormat::RG32Uint,
|
wgpu::TextureFormat::R32Sint,
|
||||||
wgpu::TextureFormat::RG32Sint, wgpu::TextureFormat::RGBA16Uint,
|
wgpu::TextureFormat::RG16Uint,
|
||||||
wgpu::TextureFormat::RGBA16Sint, wgpu::TextureFormat::RGBA16Float,
|
wgpu::TextureFormat::RG16Sint,
|
||||||
wgpu::TextureFormat::RGBA32Float, wgpu::TextureFormat::RGBA32Uint,
|
wgpu::TextureFormat::RG16Float,
|
||||||
wgpu::TextureFormat::RGBA32Sint, wgpu::TextureFormat::Depth32Float,
|
wgpu::TextureFormat::RGBA8Unorm,
|
||||||
wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8,
|
wgpu::TextureFormat::RGBA8UnormSrgb,
|
||||||
wgpu::TextureFormat::BC1RGBAUnorm, wgpu::TextureFormat::BC1RGBAUnormSrgb,
|
wgpu::TextureFormat::RGBA8Snorm,
|
||||||
wgpu::TextureFormat::BC2RGBAUnorm, wgpu::TextureFormat::BC2RGBAUnormSrgb,
|
wgpu::TextureFormat::RGBA8Uint,
|
||||||
wgpu::TextureFormat::BC3RGBAUnorm, wgpu::TextureFormat::BC3RGBAUnormSrgb,
|
wgpu::TextureFormat::RGBA8Sint,
|
||||||
wgpu::TextureFormat::BC4RUnorm, wgpu::TextureFormat::BC4RSnorm,
|
wgpu::TextureFormat::BGRA8Unorm,
|
||||||
wgpu::TextureFormat::BC5RGUnorm, wgpu::TextureFormat::BC5RGSnorm,
|
wgpu::TextureFormat::BGRA8UnormSrgb,
|
||||||
wgpu::TextureFormat::BC6HRGBUfloat, wgpu::TextureFormat::BC6HRGBSfloat,
|
wgpu::TextureFormat::RGB10A2Unorm,
|
||||||
wgpu::TextureFormat::BC7RGBAUnorm, wgpu::TextureFormat::BC7RGBAUnormSrgb,
|
wgpu::TextureFormat::RG11B10Ufloat,
|
||||||
|
wgpu::TextureFormat::RGB9E5Ufloat,
|
||||||
|
wgpu::TextureFormat::RG32Float,
|
||||||
|
wgpu::TextureFormat::RG32Uint,
|
||||||
|
wgpu::TextureFormat::RG32Sint,
|
||||||
|
wgpu::TextureFormat::RGBA16Uint,
|
||||||
|
wgpu::TextureFormat::RGBA16Sint,
|
||||||
|
wgpu::TextureFormat::RGBA16Float,
|
||||||
|
wgpu::TextureFormat::RGBA32Float,
|
||||||
|
wgpu::TextureFormat::RGBA32Uint,
|
||||||
|
wgpu::TextureFormat::RGBA32Sint,
|
||||||
|
wgpu::TextureFormat::Depth32Float,
|
||||||
|
wgpu::TextureFormat::Depth24Plus,
|
||||||
|
wgpu::TextureFormat::Depth24PlusStencil8,
|
||||||
|
wgpu::TextureFormat::BC1RGBAUnorm,
|
||||||
|
wgpu::TextureFormat::BC1RGBAUnormSrgb,
|
||||||
|
wgpu::TextureFormat::BC2RGBAUnorm,
|
||||||
|
wgpu::TextureFormat::BC2RGBAUnormSrgb,
|
||||||
|
wgpu::TextureFormat::BC3RGBAUnorm,
|
||||||
|
wgpu::TextureFormat::BC3RGBAUnormSrgb,
|
||||||
|
wgpu::TextureFormat::BC4RUnorm,
|
||||||
|
wgpu::TextureFormat::BC4RSnorm,
|
||||||
|
wgpu::TextureFormat::BC5RGUnorm,
|
||||||
|
wgpu::TextureFormat::BC5RGSnorm,
|
||||||
|
wgpu::TextureFormat::BC6HRGBUfloat,
|
||||||
|
wgpu::TextureFormat::BC6HRGBSfloat,
|
||||||
|
wgpu::TextureFormat::BC7RGBAUnorm,
|
||||||
|
wgpu::TextureFormat::BC7RGBAUnormSrgb,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* GetColorTextureComponentTypePrefix(wgpu::TextureFormat textureFormat);
|
const char* GetColorTextureComponentTypePrefix(wgpu::TextureFormat textureFormat);
|
||||||
|
|
Loading…
Reference in New Issue