From a3a5e7ea4e2ec15dd385c169578f5770f49b6e1c Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 18 Apr 2024 23:01:45 -0700 Subject: Metal: rewrite global variables as explicit context. (#3981) * Metal: rewrite global variables as explicit context. * Small tweaks. --- tests/metal/simple-compute.slang | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/metal/simple-compute.slang b/tests/metal/simple-compute.slang index e099704be..fe797dc2c 100644 --- a/tests/metal/simple-compute.slang +++ b/tests/metal/simple-compute.slang @@ -1,10 +1,17 @@ //TEST:SIMPLE(filecheck=CHECK): -target metal -RWStructuredBuffer outputBuffer; +uniform RWStructuredBuffer outputBuffer; + +// CHECK: {{.*}}kernel{{.*}} void main_kernel(float device* {{.*}}) + +void func(float v) +{ + outputBuffer[0] = v; + outputBuffer[1] = outputBuffer.Load(0); +} -// CHECK: {{.*}}kernel{{.*}} void main() [numthreads(1,1,1)] -void main() +void main_kernel() { - outputBuffer[0] = 1.0f; + func(3.0f); } \ No newline at end of file -- cgit v1.2.3