summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-modifier.cpp
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2025-05-21 21:11:01 -0700
committerGitHub <noreply@github.com>2025-05-22 04:11:01 +0000
commit27c6e9b01f7386263bde90e16812be46327015c2 (patch)
treea640d6882da0c9ee90ef64872b1b94c721039cdf /source/slang/slang-check-modifier.cpp
parent21346ded32be9091389ca53815c1ba56feff8a01 (diff)
Initial `dyn` keyword support & `-lang 2026` compiler option (#7172)
fixes: [#7143](https://github.com/shader-slang/slang/issues/7143) fixes: [#7146](https://github.com/shader-slang/slang/issues/7146) Goal of PR: * This PR is part of the larger #7115 refactor to how dynamic dispatch works. * The first step is to add the `-std <std-revision>` flag. * The second step is to provide basic `dyn` keyword support in AST. This does not include `varDecl` support since most of these interactions require `some` keyword support. Future PR(s) goal: * Support `some` keyword in AST. With this we will also implement all varDecl interactions between `dyn` and `some`. * Add IR support for `some` and `dyn`. Breakdown of PR: * most of the logic is in `validateDyn.*`. This was done so that in the future when we implement more features we will have an easy time removing/adding restrictions to `dyn` interfaces. Breaking changes: * As per spec (https://github.com/shader-slang/spec/pull/14/files), any type conforming to a `dyn` interface errors if member list contains one of the following: opaque type, non copyable type, or unsized type. * Due to the breaking change, the test `tests\compute\dynamic-dispatch-bindless-texture.slang` is incorrect. This has been fixed.
Diffstat (limited to 'source/slang/slang-check-modifier.cpp')
-rw-r--r--source/slang/slang-check-modifier.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/slang/slang-check-modifier.cpp b/source/slang/slang-check-modifier.cpp
index f9ad3a02f..900f503db 100644
--- a/source/slang/slang-check-modifier.cpp
+++ b/source/slang/slang-check-modifier.cpp
@@ -1532,6 +1532,8 @@ bool isModifierAllowedOnDecl(bool isGLSLInput, ASTNodeType modifierType, Decl* d
if (!as<VarDeclBase>(decl))
return false;
return isGlobalDecl(decl) || isEffectivelyStatic(decl);
+ case ASTNodeType::DynModifier:
+ return as<InterfaceDecl>(decl) || as<VarDecl>(decl) || as<ParamDecl>(decl);
default:
return true;
}
@@ -1671,6 +1673,7 @@ Modifier* SemanticsVisitor::checkModifier(
{
auto moduleDecl = getModuleDecl(decl);
bool isGLSLInput = getOptionSet().getBoolOption(CompilerOptionName::AllowGLSL);
+
if (!isGLSLInput && moduleDecl && moduleDecl->findModifier<GLSLModuleModifier>())
isGLSLInput = true;
if (!isModifierAllowedOnDecl(isGLSLInput, m->astNodeType, decl))