diff options
| author | Yong He <yonghe@outlook.com> | 2023-05-02 20:29:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-02 20:29:38 -0700 |
| commit | d52376a65f37fcbbb67428b917fd3819436b6dfb (patch) | |
| tree | da25b3c9a00bd003b1970b4a6c4eb38eccf62aa1 /tests/hlsl | |
| parent | 55291b0bf6d729fcbaf75a01926da7da8975b8e9 (diff) | |
Various dxc/fxc compatibility fixes. (#2863)
* Various dxc/fxc compatibility fixes.
* Cleanup.
* Fix test cases.
* Fix comments.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/hlsl')
| -rw-r--r-- | tests/hlsl/packoffset.slang | 33 | ||||
| -rw-r--r-- | tests/hlsl/packoffset.slang.expected.txt | 5 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/hlsl/packoffset.slang b/tests/hlsl/packoffset.slang new file mode 100644 index 000000000..94273d8d7 --- /dev/null +++ b/tests/hlsl/packoffset.slang @@ -0,0 +1,33 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -profile cs_5_0 -entry computeMain -line-directive-mode none +//TEST:SIMPLE(filecheck=GLSL): -target glsl -profile glsl_450 -stage compute -entry computeMain -line-directive-mode none + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +//TEST_INPUT:set Constants.v0={1.0,2.0,3.0,4.0} +//TEST_INPUT:set Constants.v1={5.0,6.0,7.0} +//TEST_INPUT:set Constants.v2=8.0 + +cbuffer Constants +{ + float4 v0 : packoffset(c0); + float3 v1 : packoffset(c1); + float v2 : packoffset(c1.w); +}; +// HLSL: cbuffer +// HLSL: { +// HLSL: {{.*}} : packoffset(c0); +// HLSL: {{.*}} : packoffset(c1); +// HLSL: {{.*}} : packoffset(c1.w); +// HLSL: } +// GLSL: layout(offset = 0) +// GLSL: layout(offset = 16) +// GLSL: layout(offset = 28) + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + outputBuffer[dispatchThreadID.x] = v2; +} diff --git a/tests/hlsl/packoffset.slang.expected.txt b/tests/hlsl/packoffset.slang.expected.txt new file mode 100644 index 000000000..56eb1d1d6 --- /dev/null +++ b/tests/hlsl/packoffset.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +8.000000 +0.000000 +0.000000 +0.000000 |
