Skip to content

Commit caf4642

Browse files
authored
Bug fix for createDynamicObject (shader-slang#1927)
Co-authored-by: Yong He <yhe@nvidia.com>
1 parent 09e32c1 commit caf4642

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

source/slang/slang-ir-lower-existential.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ namespace Slang
6565
auto anyValueType = cast<IRAnyValueType>(tupleType->getOperand(2));
6666

6767
// Create a null value for `rttiObject` for now since it will not be used.
68-
IRInst* rttiObject = builder->getIntValue(builder->getIntType(), 0);
68+
auto uint2Type = builder->getVectorType(
69+
builder->getUIntType(), builder->getIntValue(builder->getIntType(), 2));
70+
IRInst* zero = builder->getIntValue(builder->getUIntType(), 0);
71+
IRInst* zeroVectorArgs[] = { zero, zero };
72+
IRInst* rttiObject = builder->emitMakeVector(uint2Type, 2, zeroVectorArgs);
6973

7074
// Pack the user provided value into `AnyValue`.
7175
IRInst* packedValue = inst->getValue();
@@ -78,8 +82,7 @@ namespace Slang
7882
// a `uint2` value from `typeID` to stay consistent with the convention.
7983
IRInst* vectorArgs[2] = {
8084
inst->getTypeID(), builder->getIntValue(builder->getUIntType(), 0)};
81-
auto uint2Type = builder->getVectorType(
82-
builder->getUIntType(), builder->getIntValue(builder->getIntType(), 2));
85+
8386
IRInst* typeIdValue = builder->emitMakeVector(uint2Type, 2, vectorArgs);
8487
typeIdValue = builder->emitBitCast(witnessTableIdType, typeIdValue);
8588
IRInst* tupleArgs[] = {rttiObject, typeIdValue, packedValue};

0 commit comments

Comments
 (0)