From 94d3f2bd9c5557658751f73bc5fc443b41230d2c Mon Sep 17 00:00:00 2001 From: Yong He Date: Sat, 26 Sep 2020 20:09:50 -0700 Subject: Add API for whole program compilation. (#1562) * Add API for whole program compilation. This change exposes a new target flag: `SLANG_TARGET_FLAG_GENERATE_WHOLE_PROGRAM` that can be set on a target with `spSetTargetFlags`. When this flag is set, `spCompile` function generates target code for the entire input module instead of just the specified entrypoints. The resulting code will include all the entrypoints defined in the input source. The resulting whole program code can be retrieved with two new functions: `spGetTargetCodeBlob` and `spGetTargetHostCallable`. This change also cleans up the unnecessary `entryPointIndices` parameter of `TargetProgram::getOrCreateWholeProgramResult`, and modifies the `cpu-hello-world` example to make use of the new whole-program compilation API to simplify its logic. * Update comments. --- examples/cpu-hello-world/shader.slang | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/cpu-hello-world/shader.slang') diff --git a/examples/cpu-hello-world/shader.slang b/examples/cpu-hello-world/shader.slang index 6611962d7..f650c3481 100644 --- a/examples/cpu-hello-world/shader.slang +++ b/examples/cpu-hello-world/shader.slang @@ -3,6 +3,7 @@ //TEST_INPUT:ubuffer(random(float, 4096, -1.0, 1.0), stride=4):name=ioBuffer RWStructuredBuffer ioBuffer; +[shader("compute")] [numthreads(4, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { -- cgit v1.2.3