summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@google.com>2019-01-25 11:28:46 -0800
committerYong He <yonghe@google.com>2019-01-25 17:49:51 -0800
commita38490d7716ef6cbf9cbb992b880b9bbc9c1ac93 (patch)
tree789b0b0fbdb72aa37649c33023f6740cd64b1f8e /tests
parent41fde4b836dbab627f8643a5002b2b6dd0417211 (diff)
Move glsl entry point legalization to later stage of compilation.
This allows generic types to be used in entry point parameters.
Diffstat (limited to 'tests')
-rw-r--r--tests/cross-compile/glsl-generic-in.slang28
-rw-r--r--tests/cross-compile/glsl-generic-in.slang.glsl61
2 files changed, 89 insertions, 0 deletions
diff --git a/tests/cross-compile/glsl-generic-in.slang b/tests/cross-compile/glsl-generic-in.slang
new file mode 100644
index 000000000..e9b9a5a91
--- /dev/null
+++ b/tests/cross-compile/glsl-generic-in.slang
@@ -0,0 +1,28 @@
+//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -profile vs_5_0
+interface IField
+{
+ float get();
+};
+struct GIn<TField>
+{
+ float3 p0;
+ TField field;
+};
+struct F : IField
+{
+ float4 v0;
+ float2 v1;
+ float get() { return v0.x + v1.x; }
+};
+
+struct VOut
+{
+ float4 projPos : SV_POSITION;
+};
+
+VOut main(GIn<F> vIn)
+{
+ VOut vout;
+ vout.projPos = float4(vIn.p0, vIn.field.get());
+ return vout;
+} \ No newline at end of file
diff --git a/tests/cross-compile/glsl-generic-in.slang.glsl b/tests/cross-compile/glsl-generic-in.slang.glsl
new file mode 100644
index 000000000..66d7546ff
--- /dev/null
+++ b/tests/cross-compile/glsl-generic-in.slang.glsl
@@ -0,0 +1,61 @@
+//TEST_IGNORE_FILE
+#version 450
+layout(row_major) uniform;
+layout(row_major) buffer;
+
+#line 11 0
+struct F_0
+{
+ vec4 v0_0;
+ vec2 v1_0;
+};
+
+
+#line 15
+float F_get_0(F_0 this_0)
+{
+
+#line 15
+ return this_0.v0_0.x + this_0.v1_0.x;
+}
+
+
+#line 6
+layout(location = 0)
+in vec3 _S1;
+
+layout(location = 1)
+in vec4 _S2;
+
+layout(location = 2)
+in vec2 _S3;
+
+struct GIn_0
+{
+ vec3 p0_0;
+ F_0 field_0;
+};
+
+struct VOut_0
+{
+ vec4 projPos_0;
+};
+
+
+#line 23
+void main()
+{
+ GIn_0 _S4 = GIn_0(_S1, F_0(_S2, _S3));
+
+#line 25
+ VOut_0 vout_0;
+ vec3 _S5 = _S4.p0_0;
+
+#line 26
+ float _S6 = F_get_0(_S4.field_0);
+
+#line 26
+ vout_0.projPos_0 = vec4(_S5, _S6);
+ gl_Position = vout_0.projPos_0;
+ return;
+} \ No newline at end of file