diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-09-05 23:26:59 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-05 23:26:59 +0800 |
| commit | 2c2294d3310b24fd73cd41ec51338a736f3a2886 (patch) | |
| tree | 0e02393fa772e7741eb38079a79f5cacaa1ba7b0 /source/slang/slang-check-expr.cpp | |
| parent | 641f7bdc4ea4f75385c30d833cce4619a411ec67 (diff) | |
SPIR-V image operations (#3163)
* Add __truncate and __sampledType for spirv_asm
Allows some texture tests to start passing
* add __isVector
Currently unused
* Add 1-vector legalization pass (WIP)
* Add capabilities for image types
* neaten instruction dumping
* add 1-vector test
* Add a couple of cases to vec1 legalization
* Remove texture tests from expected failures
* comment
* regenerate vs projects
* Remove redundant define form synchapi emulation
* refactoring image methods
* All sample functions refactored
* Remove incorrect glsl intrinsics
Partially addresses https://github.com/shader-slang/slang/issues/3174
* __subscript image ops via writing funcs
* Extract texture struct writing from core.meta.slang
* Abstract out cuda intrinsic
* Remvoe erroneous call to opDecorateIndex
* spirv asm IR utils
* Correct position of loads for SPIR-V asm inst operands
* Raise constructors to global scope during spir-v legalization
* Correct snippet output
* Implement most texture sampling ops for SPIR-V
* Legalize 1-vectors for glsl too
* Make SPIR-V inst operands non-hoistable
* Better 1-vector legalization
* Put textures in ptrs for spirv
* insert missing break
* Add vec1 legalization test
* Add some missing pieces to slang-ir-insts
* Greatly neaten vec1 legalization
* a
* Neaten vec1 legalization
* Add image read and write intrinsics for spir-v
* Squash warnings
* regenerate vs projects
* Drop redundant guards
* Drop 5 tests from expected failure list
* Inst numbering changes to cross compile tests
* vec1 legalization tests only on vk
* Correct location of asm op emit
* Inline constant in spirv-asm
* Correct signedness for lane in wave intrinsics
* Extract element from float1 for cuda
* squash warnings
* Neaten spirv-emit
* dedupe more capabilities
* warnings
* neaten assert
* comments
* comments
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 055364d5e..88d95f04e 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -3942,7 +3942,7 @@ namespace Slang // be able to deduce types for operands const auto opInfo = spirvInfo->opInfos.lookup(SpvOp(inst.opcode.knownValue)); - if(opInfo->numOperandTypes == 0 && inst.operands.getCount()) + if(opInfo && opInfo->numOperandTypes == 0 && inst.operands.getCount()) { failed = true; getSink()->diagnose(inst.opcode.token, Diagnostics::spirvInstructionWithTooManyOperands, inst.opcode.token, 0); @@ -3953,16 +3953,21 @@ namespace Slang for(Index operandIndex = 0; operandIndex < inst.operands.getCount(); ++operandIndex) { // Clamp to the end of the type info array, because the last one will be any variable operands + const auto invalidOperandKind = SPIRVCoreGrammarInfo::OperandKind{0xff}; const auto operandType - = opInfo->operandTypes[std::min(operandIndex, Index(opInfo->numOperandTypes)-1)]; + = opInfo.has_value() + ? opInfo->operandTypes[std::min(operandIndex, Index(opInfo->numOperandTypes)-1)] + : invalidOperandKind; const auto baseOperandType = spirvInfo->operandKindUnderneathIds.lookup(operandType).value_or(operandType); const auto needsIdWrapper = baseOperandType != operandType; const auto check = [&](const auto& go, auto& operand) -> void { - if(operand.flavor == SPIRVAsmOperand::SlangType) + if(operand.flavor == SPIRVAsmOperand::SlangType + || operand.flavor == SPIRVAsmOperand::SampledType) { - // This is a $$type operand, fill in the TypeExp member of the operand + // This is a $$type operand or __sampledType(T) + // operand, fill in its TypeExp member. TypeExp& typeExpr = operand.type; typeExpr.exp = operand.expr; typeExpr = CheckProperType(typeExpr); |
