From 25bc5a3ada5a2404f25ecf2de7d035ba60cd9fdf Mon Sep 17 00:00:00 2001 From: venkataram-nv Date: Fri, 16 Aug 2024 23:08:00 -0700 Subject: Avoiding the use of the global AST builder in DeclRefType::create (#4866) --- tests/modules/environment.slang | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/modules/environment.slang (limited to 'tests/modules/environment.slang') diff --git a/tests/modules/environment.slang b/tests/modules/environment.slang new file mode 100644 index 000000000..915e04c54 --- /dev/null +++ b/tests/modules/environment.slang @@ -0,0 +1,29 @@ +module environment; + +uint lcg(inout uint prev) +{ + const uint LCG_A = 1664525u; + const uint LCG_C = 1013904223u; + prev = (LCG_A * prev + LCG_C); + return prev & 0x00FFFFFF; +} + +public float rnd(inout uint prev) +{ + return ((float) lcg(prev) / (float) 0x01000000); +} + +public struct Environment_sample_data +{ + uint alias; + float q; +}; + +public float3 environment_sample(StructuredBuffer sample_buffer, inout int seed) +{ + float3 xi; + xi.x = rnd(seed); + xi.y = rnd(seed); + xi.z = rnd(seed); + return xi.z; +} -- cgit v1.2.3