summaryrefslogtreecommitdiffstats
path: root/tests/reflection
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-06-26 12:04:54 -0700
committerGitHub <noreply@github.com>2017-06-26 12:04:54 -0700
commit3f316dcbd9274efc74f817cf36f17a511ff2e21e (patch)
tree185210d30a7887df823bb0c6d817d3feb2ebe675 /tests/reflection
parentd506737b8b00bcc89adf937994ceb6df4509c98a (diff)
parent07f9b9ec7c9be6a0eff65ef327d2a0fee262aed7 (diff)
Merge pull request #42 from tfoleyNV/reflect-imported
Reflect imported code
Diffstat (limited to 'tests/reflection')
-rw-r--r--tests/reflection/reflect-imported-code.hlsl21
-rw-r--r--tests/reflection/reflect-imported-code.hlsl.expected79
-rw-r--r--tests/reflection/reflect-imported-code.slang14
3 files changed, 114 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.hlsl.expected b/tests/reflection/reflect-imported-code.hlsl.expected
new file mode 100644
index 000000000..1190ab550
--- /dev/null
+++ b/tests/reflection/reflect-imported-code.hlsl.expected
@@ -0,0 +1,79 @@
+result code = 0
+standard error = {
+}
+standard output = {
+{
+ "parameters": [
+ {
+ "name": "t",
+ "binding": {"kind": "shaderResource", "index": 0},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ },
+ {
+ "name": "s",
+ "binding": {"kind": "samplerState", "index": 0},
+ "type": {
+ "kind": "samplerState"
+ }
+ },
+ {
+ "name": "C",
+ "binding": {"kind": "constantBuffer", "index": 0},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "c",
+ "type": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 4}
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "t_i",
+ "binding": {"kind": "shaderResource", "index": 1},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ },
+ {
+ "name": "s_i",
+ "binding": {"kind": "samplerState", "index": 1},
+ "type": {
+ "kind": "samplerState"
+ }
+ },
+ {
+ "name": "C_i",
+ "binding": {"kind": "constantBuffer", "index": 1},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "c_i",
+ "type": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 4}
+ }
+ ]
+ }
+ }
+ }
+ ]
+}
+}
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;
+}