diff options
| author | Dietrich Geisler <dgeisler50@gmail.com> | 2020-07-07 17:46:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-07 14:46:02 -0700 |
| commit | cfb41bb61d63d45aa47ccf9580414545630f0d97 (patch) | |
| tree | 33d1ec1d94e5a88075f0735662f5bbcc29e82c4b /examples | |
| parent | f8cc28c958e0d1d9701381448c05b6e79dfe4e99 (diff) | |
Public Keyword for Functions (#1432)
This PR introduces support for the public modifier for functions. This
keyword allows labelled functions to be written to the compiled without
having a link to an entry point. The goal of this change is to help
support heterogeneous design of Slang by permitting C++ code to interact
with CPU slang functions.
Internally, this PR adds the public decoration to the IR and defines a
lowering from the public modifier in the AST to this decoration.
Additionally, the Keep Alive decoration is added to any public modifier
being lowered, which prevents DCE from eliminating functions labelled
with the public keyword.
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/heterogeneous-hello-world/shader.slang | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/heterogeneous-hello-world/shader.slang b/examples/heterogeneous-hello-world/shader.slang index f650c3481..b36a2d2c7 100644 --- a/examples/heterogeneous-hello-world/shader.slang +++ b/examples/heterogeneous-hello-world/shader.slang @@ -14,3 +14,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) ioBuffer[tid] = o; } + +public int prepMain() { + return 5; +} |
