summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-06-08 07:44:05 -0700
committerGitHub <noreply@github.com>2021-06-08 10:44:05 -0400
commit6cee1eeda28c1ce1e5d326a0c43427b4776a1d09 (patch)
tree6e4559e48fecf5f71aece8b128184925b2d0f790 /source/slang/slang-emit-c-like.cpp
parentfb50fab76a723f46026474ea5bb0226c297d1fd5 (diff)
Various fixes to CUDA backend. (#1877)
- Fix emitting `StructuredBuffer<ISomething>::Load`, which triggers emitting for `IROp_WrapExistential` that is previously unhandled. - Fix cuda layout around vectors, they should be aligned to 1,2,4,8,16 bytes instead of just using element type's alignment. That means `float4` has alignment of 16 instead of 4. - Fix `SLANG_CUDA_HANDLE_ERROR` macro definition. - Fix navis sometimes fail to find `Slang::kIROp_*` enum values when debugging external projects. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 1b0fe7c44..47c584251 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -1794,6 +1794,17 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO
}
break;
+ case kIROp_WrapExistential:
+ {
+ // Normally `WrapExistential` shouldn't exist in user code at this point.
+ // The only exception is when the user is calling a stdlib generic
+ // function that has an existential type argument, for example
+ // `StructuredBuffer<ISomething>.Load()`.
+ // We can safely ignore the `wrapExistential` operation in this case.
+ emitOperand(inst->getOperand(0), outerPrec);
+ }
+ break;
+
case kIROp_Select:
{