summaryrefslogtreecommitdiffstats
path: root/tests/reflection/multi-file.hlsl
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-09 11:34:21 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-09 13:44:59 -0700
commitfcf83dbf9effab3bd98bad2b83b2468b7eb05cfd (patch)
tree41047c94883b86ec085a81597391ce3ef557cd43 /tests/reflection/multi-file.hlsl
parent52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff)
Initial import of code.
Diffstat (limited to 'tests/reflection/multi-file.hlsl')
-rw-r--r--tests/reflection/multi-file.hlsl56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/reflection/multi-file.hlsl b/tests/reflection/multi-file.hlsl
new file mode 100644
index 000000000..b263a6b71
--- /dev/null
+++ b/tests/reflection/multi-file.hlsl
@@ -0,0 +1,56 @@
+//TEST:SIMPLE:-profile ps_4_0 -target reflection-json Tests/bindings/multi-file-extra.hlsl
+
+// Here we are testing the case where multiple translation units are provided
+// at once, so that we want combined reflection information for the resulting
+// program. The other part of this program is in `multi-file-extra.hlsl`.
+
+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)
+{
+ // This is the vertex shader, so we can't do implicit-gradient sampling
+ return t.SampleGrad(s, 0.0, 0.0, 0.0);
+}
+
+// Start with some parameters that will appear in both shaders
+Texture2D sharedT;
+SamplerState sharedS;
+cbuffer sharedC
+{
+ float3 sharedCA;
+ float sharedCB;
+ float3 sharedCC;
+ float2 sharedCD;
+}
+
+// Then some parameters specific to this shader
+// (these will get placed before the ones in the `extra` file,
+// based on how they get named on the command-line)
+
+Texture2D vertexT;
+SamplerState vertexS;
+cbuffer vertexC
+{
+ float3 vertexCA;
+ float vertexCB;
+ float3 vertexCC;
+ float2 vertexCD;
+}
+
+// And end with some shared parameters again
+Texture2D sharedTV;
+Texture2D sharedTF;
+
+
+float4 main() : SV_Position
+{
+ // Go ahead and use everything here, just to make sure things got placed correctly
+ return use(sharedT, sharedS)
+ + use(sharedCD)
+ + use(vertexT, vertexS)
+ + use(vertexCD)
+ + use(sharedTV, vertexS)
+ ;
+} \ No newline at end of file