diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 4 | ||||
| -rw-r--r-- | source/slang/slang-ir-util.cpp | 13 | ||||
| -rw-r--r-- | source/slang/slang-ir-util.h | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 62c667de1..7f6202a7f 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -2060,7 +2060,9 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex inst->getOp() == kIROp_ArrayType ? emitOpTypeArray(inst, elementType, irArrayType->getElementCount()) : emitOpTypeRuntimeArray(inst, elementType); - if (shouldEmitArrayStride(irArrayType->getElementType())) + // Arrays of opaque types should not emit a stride + if (!isIROpaqueType(elementType) && + shouldEmitArrayStride(irArrayType->getElementType())) { auto stride = 0; // If the array type has no stride, it indicates that this array type is only diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index 687841d5e..69bd2c6c2 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -2408,4 +2408,17 @@ bool isSignedType(IRType* type) } } +bool isIROpaqueType(IRType* type) +{ + switch (type->getOp()) + { + case kIROp_TextureType: + case kIROp_SamplerStateType: + case kIROp_SamplerComparisonStateType: + return true; + default: + return false; + } +} + } // namespace Slang diff --git a/source/slang/slang-ir-util.h b/source/slang/slang-ir-util.h index edb8fdf09..e325fbdc2 100644 --- a/source/slang/slang-ir-util.h +++ b/source/slang/slang-ir-util.h @@ -421,6 +421,8 @@ constexpr bool anyOf(Range&& range, Predicate&& pred) IRType* getUnsignedTypeFromSignedType(IRBuilder* builder, IRType* type); bool isSignedType(IRType* type); + +bool isIROpaqueType(IRType* type); } // namespace Slang #endif |
