mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
tint: Add bgra8unorm storage texture support
Polyfill this for the SPIR-V, HLSL and GLSL backends by replacing bgra8unorm with rgba8unorm, and swizzling. Bug: tint:1804 Change-Id: I36638202840d7313001dff6c5b60dcb948988c34 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117204 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
e2be18a7fd
commit
d03dceebf3
@@ -2378,6 +2378,7 @@ class F32TexelFormat : public NumberMatcher {
|
||||
|
||||
Number F32TexelFormat::Match(MatchState&, Number number) const {
|
||||
switch (static_cast<TexelFormat>(number.Value())) {
|
||||
case TexelFormat::kBgra8Unorm:
|
||||
case TexelFormat::kRgba8Unorm:
|
||||
case TexelFormat::kRgba8Snorm:
|
||||
case TexelFormat::kRgba16Float:
|
||||
@@ -2391,7 +2392,7 @@ Number F32TexelFormat::Match(MatchState&, Number number) const {
|
||||
}
|
||||
|
||||
std::string F32TexelFormat::String(MatchState*) const {
|
||||
return "rgba8unorm, rgba8snorm, rgba16float, r32float, rg32float or rgba32float";
|
||||
return "bgra8unorm, rgba8unorm, rgba8snorm, rgba16float, r32float, rg32float or rgba32float";
|
||||
}
|
||||
|
||||
/// EnumMatcher for 'match i32_texel_format'
|
||||
|
||||
@@ -1126,7 +1126,8 @@ struct FormatParams {
|
||||
bool is_valid;
|
||||
};
|
||||
|
||||
static constexpr FormatParams format_cases[] = {FormatParams{ast::TexelFormat::kR32Float, true},
|
||||
static constexpr FormatParams format_cases[] = {FormatParams{ast::TexelFormat::kBgra8Unorm, true},
|
||||
FormatParams{ast::TexelFormat::kR32Float, true},
|
||||
FormatParams{ast::TexelFormat::kR32Sint, true},
|
||||
FormatParams{ast::TexelFormat::kR32Uint, true},
|
||||
FormatParams{ast::TexelFormat::kRg32Float, true},
|
||||
|
||||
@@ -98,6 +98,7 @@ bool IsValidStorageTextureDimension(ast::TextureDimension dim) {
|
||||
|
||||
bool IsValidStorageTextureTexelFormat(ast::TexelFormat format) {
|
||||
switch (format) {
|
||||
case ast::TexelFormat::kBgra8Unorm:
|
||||
case ast::TexelFormat::kR32Uint:
|
||||
case ast::TexelFormat::kR32Sint:
|
||||
case ast::TexelFormat::kR32Float:
|
||||
|
||||
Reference in New Issue
Block a user