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/resources-in-cbuffer.hlsl | |
| parent | 52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff) | |
Initial import of code.
Diffstat (limited to 'tests/bindings/resources-in-cbuffer.hlsl')
| -rw-r--r-- | tests/bindings/resources-in-cbuffer.hlsl | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/bindings/resources-in-cbuffer.hlsl b/tests/bindings/resources-in-cbuffer.hlsl new file mode 100644 index 000000000..ec35943cc --- /dev/null +++ b/tests/bindings/resources-in-cbuffer.hlsl @@ -0,0 +1,68 @@ +//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry main + +// Confirm that resources inside constant buffers get correct locations, +// including the case where there are *multiple* constant buffers +// with reosurces. + +#ifdef __SPIRE__ +#define R(X) /**/ +#else +#define R(X) X +#endif + +float4 use(float val) { return val; }; +float4 use(float2 val) { return float4(val,0.0,0.0); }; +float4 use(float3 val) { return float4(val,0.0); }; +float4 use(float4 val) { return val; }; +float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); } + +cbuffer CA R(: register(b0)) +{ + float4 caa R(: packoffset(c0)); + float3 cab R(: packoffset(c1.x)); + float cac R(: packoffset(c1.w)); + float2 cad R(: packoffset(c2.x)); + float2 cae R(: packoffset(c2.z)); + + Texture2D ta R(: register(t0)); + SamplerState sa R(: register(s0)); +} + +cbuffer CB R(: register(b1)) +{ + float4 cba R(: packoffset(c0)); + float3 cbb R(: packoffset(c1.x)); + float cbc R(: packoffset(c1.w)); + float2 cbd R(: packoffset(c2.x)); + float2 cbe R(: packoffset(c2.z)); + + Texture2D tbx R(: register(t1)); + Texture2D tby R(: register(t2)); + SamplerState sb R(: register(s1)); +} + +cbuffer CC R(: register(b2)) +{ + float4 cca R(: packoffset(c0)); + float3 ccb R(: packoffset(c1.x)); + float ccc R(: packoffset(c1.w)); + float2 ccd R(: packoffset(c2.x)); + float2 cce R(: packoffset(c2.z)); + + Texture2D tc R(: register(t3)); + SamplerState scx R(: register(s2)); + SamplerState scy R(: register(s3)); +} + +float4 main() : SV_Target +{ + // Go ahead and use everything in this case: + return use(ta, sa) + + use(tbx, sb) + + use(tby, scx) + + use(tc, scy) + + use(cae) + + use(cbe) + + use(cce) + ; +}
\ No newline at end of file |
