summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-04-10 11:19:28 -0700
committerGitHub <noreply@github.com>2024-04-10 11:19:28 -0700
commit9fe2db1e4950f63aaaa575506486eab153ad448e (patch)
treec407b8a1f9586ff84281f574e957ad48c5054bca /source
parent33b4fa725f6410eee5013de465c14a4cb523b057 (diff)
Fix checking logic of entry point specialization arguments. (#3916)
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-check-shader.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/slang/slang-check-shader.cpp b/source/slang/slang-check-shader.cpp
index b8b83c094..591118385 100644
--- a/source/slang/slang-check-shader.cpp
+++ b/source/slang/slang-check-shader.cpp
@@ -1229,9 +1229,22 @@ namespace Slang
DeclRef<GenericTypeConstraintDecl> constraintDeclRef = astBuilder->getDirectDeclRef(constraintDecl.getDecl());
int argIndex = -1;
int ii = 0;
+
+ // Find the generic parameter type (T) that this constraint (T:IFoo) is applying to.
+ auto genericParamType = getSub(astBuilder, constraintDeclRef);
+ auto genParamDeclRefType = as<DeclRefType>(genericParamType);
+ if (!genParamDeclRefType)
+ {
+ continue;
+ }
+ auto genParamDeclRef = genParamDeclRefType->getDeclRef();
+
+ // Find the generic argument index of the corresponding generic parameter type in the
+ // generic parameter set.
+ //
for (auto member : genericDeclRef.getDecl()->members)
{
- if (member == constraintDeclRef.getDecl())
+ if (member == genParamDeclRef.getDecl())
{
argIndex = ii;
break;
@@ -1243,7 +1256,6 @@ namespace Slang
SLANG_ASSERT(!"generic parameter not found in generic decl");
continue;
}
-
auto sub = as<Type>(args[argIndex].val);
if (!sub)
{