diff options
| author | Yong He <yonghe@outlook.com> | 2025-07-11 16:54:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-11 23:54:43 +0000 |
| commit | 1e1a49ccf595dcc99bd9792a47199ec89d5b4370 (patch) | |
| tree | 199dca9cc2c5f27466ebd8b6e9e6fcd8328db9fa /tests | |
| parent | d8d0b8969f731990820f25812f3d90ee4dd1ee75 (diff) | |
Fixup address spaces after inlining. (#7731)
* Fixup address spaces after inlining.
* add -O0
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/spirv/pointer-access.slang | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/spirv/pointer-access.slang b/tests/spirv/pointer-access.slang new file mode 100644 index 000000000..281613640 --- /dev/null +++ b/tests/spirv/pointer-access.slang @@ -0,0 +1,48 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -O0 + +//CHECK: OpEntryPoint + +struct Result +{ + float3 value; +}; + +struct Indirect +{ + float scale; +}; + +struct PushConstant +{ + Indirect *ptr; +}; + +struct Payload +{ + uint seed; +}; + +ConstantBuffer<PushConstant> pushConstants; + +Result f3(Indirect ss, float2 randomSample) +{ + Result result; + result.value = randomSample.x; + return result; +} + +float3 f2(inout uint seed) +{ + return f3(*pushConstants.ptr, float2(seed)).value; +} + +float3 f1(inout Payload payload) +{ + return f2(payload.seed); +} + +[shader("closesthit")] +void main(inout Payload payload, in BuiltInTriangleIntersectionAttributes attr) +{ + f1(payload); +}
\ No newline at end of file |
