diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-06-09 11:34:21 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-06-09 13:44:59 -0700 |
| commit | fcf83dbf9effab3bd98bad2b83b2468b7eb05cfd (patch) | |
| tree | 41047c94883b86ec085a81597391ce3ef557cd43 /tests/bindings/binding1.hlsl | |
| parent | 52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff) | |
Initial import of code.
Diffstat (limited to 'tests/bindings/binding1.hlsl')
| -rw-r--r-- | tests/bindings/binding1.hlsl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/bindings/binding1.hlsl b/tests/bindings/binding1.hlsl new file mode 100644 index 000000000..d9e74e918 --- /dev/null +++ b/tests/bindings/binding1.hlsl @@ -0,0 +1,41 @@ +//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry main + +// We want to make sure that the registers that Spire generates +// are used, even if there are "dead" parameter earlier in the program. +// +// In this case, we declare two each of textures, samplers, and constant +// buffers, and then only use the second one. +// Left to its own devices, the HLSL compiler would usually shift the +// object that was used up to binding slot zero, and eliminate the one +// that wasn't used. +// We expect Spire to generate explicit annotations that stop this from +// happening. + +#ifdef __SPIRE__ +#define R(X) /**/ +#else +#define R(X) X +#endif + +float4 use(float4 val) { return val; }; +float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); } + +Texture2D t0 R(: register(t0)); +Texture2D t1 R(: register(t1)); +SamplerState s0 R(: register(s0)); +SamplerState s1 R(: register(s1)); + +cbuffer C0 R(: register(b0)) +{ + float c0; +} + +cbuffer C1 R(: register(b1)) +{ + float c1; +} + +float4 main() : SV_Target +{ + return use(t1,s1) + use(c1); +}
\ No newline at end of file |
