diff options
| author | Yong He <yonghe@outlook.com> | 2017-11-21 19:55:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-21 19:55:23 -0500 |
| commit | cd2d64657e3e07fba0a2021d5e47b7a55bd293e6 (patch) | |
| tree | c2ed83c02ddb8587f7f5f6ee26e004baafec315c /tests | |
| parent | 43434bf993870ac19722d3a00df704df130619c1 (diff) | |
| parent | 37315c96ea48045fae60f0e1cb1a3293f3ddd962 (diff) | |
Merge branch 'master' into generic-param-fix
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/global-init.slang | 23 | ||||
| -rw-r--r-- | tests/compute/global-init.slang.expected.txt | 4 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/compute/global-init.slang b/tests/compute/global-init.slang new file mode 100644 index 000000000..909cdf7e6 --- /dev/null +++ b/tests/compute/global-init.slang @@ -0,0 +1,23 @@ +//TEST(compute):COMPARE_COMPUTE:-xslang -use-ir +//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(0),glbinding(0),out + +// Test that a global variable (not a shader parameter) +// with an initializer works. + +static int gVar = 16; + +int test(int inVal) +{ + return inVal + gVar; +} + +RWStructuredBuffer<int> outputBuffer : register(u0); + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int inVal = outputBuffer[tid]; + int outVal = test(inVal); + outputBuffer[tid] = outVal; +}
\ No newline at end of file diff --git a/tests/compute/global-init.slang.expected.txt b/tests/compute/global-init.slang.expected.txt new file mode 100644 index 000000000..a0d427709 --- /dev/null +++ b/tests/compute/global-init.slang.expected.txt @@ -0,0 +1,4 @@ +10 +11 +12 +13 |
