diff options
| author | Yong He <yonghe@outlook.com> | 2024-08-01 10:55:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-01 10:55:48 -0700 |
| commit | 32b843215b2e80c23c1fbcf02150c52a6304a447 (patch) | |
| tree | 5892ef28f2e603781af4c6dde5b2a1dc1112c125 /tests/language-feature | |
| parent | 4c6b0a2831a7edd1419bd0b2e6edd089080e07be (diff) | |
Allow implicit 'uniform' entrypoint parameters. (#4765)
* Allow impliocit 'uniform' entrypoint parameters.
* Fix.
* Fix.
* Fix.
* Fix.
Diffstat (limited to 'tests/language-feature')
| -rw-r--r-- | tests/language-feature/shader-params/entry-point-uniform-params-implicit.slang | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/language-feature/shader-params/entry-point-uniform-params-implicit.slang b/tests/language-feature/shader-params/entry-point-uniform-params-implicit.slang new file mode 100644 index 000000000..5f8ac7edd --- /dev/null +++ b/tests/language-feature/shader-params/entry-point-uniform-params-implicit.slang @@ -0,0 +1,42 @@ +// entry-point-uniform-params-implicit.slang + +// Test that slang can treat a compute shader parameter as `uniform` without explicit `uniform` keyword. + +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -xslang -Wno-38040 +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -xslang -Wno-38040 +//TEST:SIMPLE(filecheck=WARNING): -target spirv + +struct Data +{ + int a; + int b; +} + +int test(int val, int a, int b) +{ + return a*(val+1) + b*(val+2); +} + +[numthreads(4, 1, 1)] +[shader("compute")] +void computeMain( + +//TEST_INPUT:uniform(data=[256 1]):name=d +// WARNING: ([[# @LINE+1]]): warning 38040 + Data d, + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer + uniform RWStructuredBuffer<int> outputBuffer, + + int3 dispatchThreadID : SV_DispatchThreadID) +{ + int tid = dispatchThreadID.x; + int inVal = tid; + int outVal = test(inVal, d.a, d.b); + outputBuffer[tid] = outVal; + + // CHECK: 102 + // CHECK: 203 + // CHECK: 304 + // CHECK: 405 +} |
