diff options
| author | Yong He <yongh@outlook.com> | 2018-01-03 17:12:46 -0800 |
|---|---|---|
| committer | Yong He <yongh@outlook.com> | 2018-01-03 17:12:46 -0800 |
| commit | 61b206db5fc5a4c9d42fa3fbb4f50624b6c6c6c5 (patch) | |
| tree | aca01d76f4dd30ed09f9b652a16ed06109a5789b /tests | |
| parent | 771da268461e9ad3addf94a452a4c13ee291918e (diff) | |
| parent | 5da16a6360e40b9fd4d2275a5ef5b1af740c4abb (diff) | |
Merge https://github.com/shader-slang/slang
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bindings/array-of-struct-of-resource.hlsl | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/bindings/array-of-struct-of-resource.hlsl b/tests/bindings/array-of-struct-of-resource.hlsl new file mode 100644 index 000000000..ecf3672c9 --- /dev/null +++ b/tests/bindings/array-of-struct-of-resource.hlsl @@ -0,0 +1,42 @@ +//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_5_1 -entry main + +// Let's first confirm that Spire can reproduce what the +// HLSL compiler would already do in the simple case (when +// all shader parameters are actually used). + +float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); } + +#ifdef __SLANG__ + +struct Test +{ + Texture2D a; + Texture2D b; +}; + +Test test[2]; +SamplerState s; + +float4 main() : SV_Target +{ + return use(test[0].a,s) + + use(test[0].b,s) + + use(test[1].a,s) + + use(test[1].b,s); +} + +#else + +Texture2D test_a[2]; +Texture2D test_b[2]; +SamplerState s; + +float4 main() : SV_Target +{ + return use(test_a[0],s) + + use(test_b[0],s) + + use(test_a[1],s) + + use(test_b[1],s); +} + +#endif |
