summaryrefslogtreecommitdiffstats
path: root/tests/library/precompiled-spirv-pointer-param.slang
blob: 10cd7124b6729513f0295942ea39fdae374b53cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// precompiled-spirv-pointer-param.slang

// A test that uses slang-modules with embedded precompiled SPIRV and a library containing 
// a function with a pointer parameter.
// The test compiles a library slang (module-library-pointer-param.slang) with -embed-downstream-ir then links the
// library to entrypoint slang (this file).
// The test passes if there is no errror thrown.
// TODO: Check if final linkage used only the precompiled spirv.

//TEST:COMPILE: tests/library/module-library-pointer-param.slang -o tests/library/module-library-pointer-param.slang-module -target spirv -embed-downstream-ir -incomplete-library
//TEST:COMPILE: tests/library/precompiled-spirv-pointer-param.slang -target spirv -stage anyhit -entry anyhit -o tests/library/linked.spirv

import "module-library-pointer-param";

struct Payload
{
    int val;
}

struct Attributes
{
    float2 bary;
}

[vk::push_constant] int* g_int;

[shader("anyhit")]
void anyhit(inout Payload payload, Attributes attrib)
{
    payload.val = ptrFunc(g_int);
}