From 0dd9076db2154d787f6e06b713721e877b746b83 Mon Sep 17 00:00:00 2001 From: Darren Wihandi <65404740+fairywreath@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:13:16 -0500 Subject: 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 --- source/slang/slang-emit-wgsl.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-emit-wgsl.cpp') 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"; } } -- cgit v1.2.3