From 3375cde1add65894b8f2e2780cc91ab4ccf6d8fb Mon Sep 17 00:00:00 2001 From: Nils Hasenbanck Date: Sat, 4 Oct 2025 14:50:56 +0200 Subject: Respect isShadow() flag when setting depth type in SPIR-V backend (#8604) This is important for SPIR-V targets that need to know if a texture is designated as a depth texture or not (for example WebGPU). I didn't change the default behavior for when isShadow() is not set, since I didn't want to make the change too invasive. --- source/slang/slang-emit-spirv.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/slang') diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index b3232de93..36368c3ee 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -2681,7 +2681,11 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex // Vulkan spec 16.1: "The “Depth” operand of OpTypeImage is ignored." SpvWord depth = - ImageOpConstants::unknownDepthImage; // No knowledge of if this is a depth image + inst->isShadow() + ? ImageOpConstants::isDepthImage // But we respect the `isShadow` flag of the + // texture + : ImageOpConstants::unknownDepthImage; // No knowledge of if this is a depth image + SpvWord ms = inst->isMultisample() ? ImageOpConstants::isMultisampled : ImageOpConstants::notMultisampled; -- cgit v1.2.3