summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-26 09:07:07 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-26 10:31:43 -0700
commitc16fc84a0071892ea0f4e3c5c70aa101e6400aec (patch)
tree6c5e2363cbf5c460006ea19ae4e0ac2243df291e /tests
parentd506737b8b00bcc89adf937994ceb6df4509c98a (diff)
Include imported code when generating reflection data
- The basic idea is simple: be sure to enumerate code in `__import`ed modules when generating reflection info - Note that we don't currently allow an entry point to appear in an imported module, so we only consider globlal-scope parameters - Although there isn't currently a real implementation of namespacing, I went ahead and ensured that parameters in imported modules are treated as distinct from parameters in the user's code, even if they have the same name.
Diffstat (limited to 'tests')
-rw-r--r--tests/reflection/reflect-imported-code.hlsl21
-rw-r--r--tests/reflection/reflect-imported-code.slang14
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/reflection/reflect-imported-code.hlsl b/tests/reflection/reflect-imported-code.hlsl
new file mode 100644
index 000000000..b95493f7e
--- /dev/null
+++ b/tests/reflection/reflect-imported-code.hlsl
@@ -0,0 +1,21 @@
+//TEST:SIMPLE:-profile ps_4_0 -target reflection-json
+
+// Confirm that shader parameters in imported modules get reflected properly.
+
+__import reflect_imported_code;
+
+Texture2D t;
+SamplerState s;
+
+cbuffer C
+{
+ float c;
+}
+
+float4 main() : SV_Target
+{
+ return use(t,s_i)
+ + use(c)
+ + use(t_i, s)
+ + use(c_i);
+} \ No newline at end of file
diff --git a/tests/reflection/reflect-imported-code.slang b/tests/reflection/reflect-imported-code.slang
new file mode 100644
index 000000000..20beb94b8
--- /dev/null
+++ b/tests/reflection/reflect-imported-code.slang
@@ -0,0 +1,14 @@
+//TEST_IGNORE_FILE:
+
+// Imported code used by `reflect-imported-code.hlsl`
+
+float4 use(float4 val) { return val; };
+float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); }
+
+Texture2D t_i;
+SamplerState s_i;
+
+cbuffer C_i
+{
+ float c_i;
+}