summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorNils Hasenbanck <hasenbanck@users.noreply.github.com>2025-10-04 14:50:56 +0200
committerGitHub <noreply@github.com>2025-10-04 12:50:56 +0000
commit3375cde1add65894b8f2e2780cc91ab4ccf6d8fb (patch)
tree0b7bb910f096c7ec5b83b08b6b656729cadc754e /source
parent2491ac5f42d78d082d4afa6416906fad9b32ea80 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-emit-spirv.cpp6
1 files changed, 5 insertions, 1 deletions
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;