From cfb41bb61d63d45aa47ccf9580414545630f0d97 Mon Sep 17 00:00:00 2001 From: Dietrich Geisler Date: Tue, 7 Jul 2020 17:46:02 -0400 Subject: 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 --- examples/heterogeneous-hello-world/shader.slang | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'examples') 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; +} -- cgit v1.2.3