From 27c6e9b01f7386263bde90e16812be46327015c2 Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Wed, 21 May 2025 21:11:01 -0700 Subject: 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 ` 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. --- include/slang.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/slang.h b/include/slang.h index d65362762..4164ce9e9 100644 --- a/include/slang.h +++ b/include/slang.h @@ -627,6 +627,17 @@ typedef uint32_t SlangSizeT; SLANG_TARGET_COUNT_OF, }; + typedef int SlangStdRevisionIntegral; + enum SlangStdRevision : SlangStdRevisionIntegral + { + SLANG_STD_REVISION_UNKNOWN, + SLANG_STD_REVISION_2025, + SLANG_STD_REVISION_2026, + SLANG_STD_REVISION_COUNT_OF, + + SLANG_STD_REVISION_DEFAULT = SLANG_STD_REVISION_2025, + }; + /* A "container format" describes the way that the outputs for multiple files, entry points, targets, etc. should be combined into a single artifact for output. */ @@ -1021,6 +1032,9 @@ typedef uint32_t SlangSizeT; SkipDownstreamLinking, // bool, experimental DumpModule, + + EnableExperimentalDynamicDispatch, // bool, experimental + StdRevision, // intValue0: SlangStdRevision CountOf, }; -- cgit v1.2.3