diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-01-24 16:13:16 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-24 13:13:16 -0800 |
| commit | 0dd9076db2154d787f6e06b713721e877b746b83 (patch) | |
| tree | 24f75b2c612fc0ee5a3ba8157c4d0dde7ff9a3a0 /source/slang/slang-emit-wgsl.cpp | |
| parent | 92c9fffb95c92b0bc07eb1c656375928b5cd5c33 (diff) | |
Add bgra8 format (#6163)
* add brga8 format
* add tests
* minor fixes
* cleanup
* maybe fix broken quad control test
* add missing xslang flag on test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-emit-wgsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-wgsl.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/slang/slang-emit-wgsl.cpp b/source/slang/slang-emit-wgsl.cpp index 30a7af938..ce60cc2a0 100644 --- a/source/slang/slang-emit-wgsl.cpp +++ b/source/slang/slang-emit-wgsl.cpp @@ -326,7 +326,7 @@ void WGSLSourceEmitter::emit(const AddressSpace addressSpace) } } -static const char* getWgslImageFormat(IRTextureTypeBase* type) +const char* WGSLSourceEmitter::getWgslImageFormat(IRTextureTypeBase* type) { // You can find the supported WGSL texel format from the URL: // https://www.w3.org/TR/WGSL/#storage-texel-formats @@ -405,11 +405,19 @@ static const char* getWgslImageFormat(IRTextureTypeBase* type) return "rgba32sint"; case ImageFormat::rgba32f: return "rgba32float"; + case ImageFormat::bgra8: + return "bgra8unorm"; case ImageFormat::unknown: // Unlike SPIR-V, WGSL doesn't have a texel format for "unknown". return "rgba32float"; default: - // We may need to print a warning for types WGSL doesn't support + const auto imageFormatInfo = getImageFormatInfo(imageFormat); + getSink()->diagnose( + SourceLoc(), + Diagnostics::imageFormatUnsupportedByBackend, + imageFormatInfo.name, + "WGSL", + "rgba32float"); return "rgba32float"; } } |
