diff options
| author | Yong He <yonghe@outlook.com> | 2020-09-04 10:18:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-04 10:18:44 -0700 |
| commit | 8f962894fd38edb47d782d303ac9ff87b3a3bb6a (patch) | |
| tree | 449d0d58ca7d90a11759372c9dc82650a565f96a /source/slang/slang-lower-to-ir.cpp | |
| parent | 5e10f1b4f0654515af1fcb29e8d1f35e691c8aa3 (diff) | |
Allow mixing unspecialized and specialized existential parameters. (#1533)
* Allow mixing unspecialized and specialized existential parameters.
* Fixes.
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index ee5338236..424358d3c 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -1420,10 +1420,14 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower // getBuilder()->createWitnessTableEntry(irWitnessTable, irReqKey, irSatisfyingVal); } - return LoweredValInfo::simple(irWitnessTable); } + LoweredValInfo visitDynamicSubtypeWitness(DynamicSubtypeWitness * /*val*/) + { + return LoweredValInfo::simple(nullptr); + } + LoweredValInfo visitThisTypeSubtypeWitness(ThisTypeSubtypeWitness* val) { SLANG_UNUSED(val); @@ -7859,6 +7863,8 @@ struct SpecializedComponentTypeIRGenContext : ComponentTypeVisitor IRInst* irParam = getSimpleVal(context, ensureDecl(context, shaderParam.paramDeclRef)); List<IRInst*> irSlotArgs; + // Tracks if there are any type args that is not an IRDynamicType. + bool hasConcreteTypeArg = false; for( Index jj = 0; jj < specializationArgCount; ++jj ) { auto& specializationArg = specializationInfo->existentialArgs[existentialArgOffset++]; @@ -7866,14 +7872,21 @@ struct SpecializedComponentTypeIRGenContext : ComponentTypeVisitor auto irType = lowerSimpleVal(context, specializationArg.val); auto irWitness = lowerSimpleVal(context, specializationArg.witness); + if (irType->op != kIROp_DynamicType) + hasConcreteTypeArg = true; + irSlotArgs.add(irType); irSlotArgs.add(irWitness); } - - builder->addBindExistentialSlotsDecoration( - irParam, - irSlotArgs.getCount(), - irSlotArgs.getBuffer()); + // Only insert a `BindExistentialSlots` decoration when there are at least + // one non-dynamic type argument. + if (hasConcreteTypeArg) + { + builder->addBindExistentialSlotsDecoration( + irParam, + irSlotArgs.getCount(), + irSlotArgs.getBuffer()); + } } } } |
