diff options
| author | Yong He <yonghe@outlook.com> | 2017-11-13 21:31:40 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-13 21:31:40 -0500 |
| commit | 7c4ad877dcd353b9431011f0fc98aad315366c6c (patch) | |
| tree | 19facdec485143f480ec0a2085cda23d25e0fa8c /tests | |
| parent | c9d94248dc73fe41c344b0a23230e597f7b94a2c (diff) | |
| parent | 38f0113d6ecf7e6a18b89ca4912839a382d0f855 (diff) | |
Merge pull request #277 from csyonghe/ir-legalization
IR Legalization of function parameters
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/func-param-legalize.slang | 35 | ||||
| -rw-r--r-- | tests/compute/func-param-legalize.slang.expected.txt | 4 |
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/compute/func-param-legalize.slang b/tests/compute/func-param-legalize.slang new file mode 100644 index 000000000..285fcfbb7 --- /dev/null +++ b/tests/compute/func-param-legalize.slang @@ -0,0 +1,35 @@ +//TEST(compute):COMPARE_COMPUTE:-xslang -use-ir +//TEST_INPUT:Texture2D(size=4, content = one) : dxbinding(0),glbinding(0) +//TEST_INPUT: Sampler : dxbinding(0),glbinding(0,1,2,3,4,5,6) +//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out + +struct Param +{ + Texture2D tex; + SamplerState samplerState; + float base; +}; + +Texture2D diffuseMap; +SamplerState samplerState; +RWStructuredBuffer<float> outputBuffer; + +float4 run(Param p) +{ + return p.tex.SampleLevel(p.samplerState, float2(0.0), 0) + p.base; +} + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + Param p; + p.tex = diffuseMap; + p.samplerState = samplerState; + p.base = -0.5; + float4 outVal = run(p); + + outputBuffer[0] = outVal.x; + outputBuffer[1] = outVal.y; + outputBuffer[2] = outVal.z; + outputBuffer[3] = outVal.w; +}
\ No newline at end of file diff --git a/tests/compute/func-param-legalize.slang.expected.txt b/tests/compute/func-param-legalize.slang.expected.txt new file mode 100644 index 000000000..e4e4c642a --- /dev/null +++ b/tests/compute/func-param-legalize.slang.expected.txt @@ -0,0 +1,4 @@ +3F000000 +3F000000 +3F000000 +3F000000 |
