summaryrefslogtreecommitdiffstats
path: root/tests/render/imported-parameters.slang
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-27 09:13:19 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-27 09:13:19 -0700
commit996d4dc537272e36dde1d9c1110064d597fa212f (patch)
tree8958b8c8848d2b7760a5b71ecef69574e4d9d6ab /tests/render/imported-parameters.slang
parent8824b102a5dd5ac1f08daedd897b5994b1bf8b6d (diff)
Emit global-scope parameters from imported files.
This fixes up a bug in the earlier change that provided reflection for imported parameters; I'd failed to confirm that the code generation logic can handle imported parameters correctly. The main fix was to have an `import` declaration automatically use the global-scope layout already determined, sine imported parameters will in general appear there.
Diffstat (limited to 'tests/render/imported-parameters.slang')
-rw-r--r--tests/render/imported-parameters.slang23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/render/imported-parameters.slang b/tests/render/imported-parameters.slang
new file mode 100644
index 000000000..7c444a67b
--- /dev/null
+++ b/tests/render/imported-parameters.slang
@@ -0,0 +1,23 @@
+//TEST_IGNORE_FILE:
+
+// We are declaring the uniform shader parameters
+// in this imported file, to ensure that they are
+// emitted correctly.
+
+cbuffer Uniforms
+{
+ float4x4 modelViewProjection;
+};
+
+float3 transformColor(float3 color)
+{
+ float3 result;
+
+ result.x = sin(20.0 * (color.x + color.y));
+ result.y = saturate(cos(color.z * 30.0));
+ result.z = sin(color.x * color.y * color.z * 100.0);
+
+ result = 0.5 * (result + 1);
+
+ return result;
+} \ No newline at end of file