diff options
author | John Kessenich <cepheus@frii.com> | 2016-07-07 17:46:42 -0600 |
---|---|---|
committer | John Kessenich <cepheus@frii.com> | 2016-07-07 19:27:15 -0600 |
commit | 91e4aa5900346241fceb7d7230d0dd47b1496e84 (patch) | |
tree | fe20d76cfa335ff527a31f71f655d6a9ace864f7 /Test | |
parent | 2d0cc786f3f830e898df863ce5092945f31e62f8 (diff) | |
download | glslang-91e4aa5900346241fceb7d7230d0dd47b1496e84.tar.gz |
SPV: Further refine OpenGL vs. Vulkan differences for SPIR-V.
Includes adding test cases to verify the differences.
Diffstat (limited to 'Test')
-rwxr-xr-x | Test/baseResults/glspv.esversion.vert.out | 11 | ||||
-rwxr-xr-x | Test/baseResults/glspv.frag.out | 13 | ||||
-rwxr-xr-x | Test/baseResults/glspv.version.frag.out | 24 | ||||
-rwxr-xr-x | Test/baseResults/glspv.version.vert.out | 10 | ||||
-rwxr-xr-x | Test/baseResults/glspv.vert.out | 18 | ||||
-rwxr-xr-x | Test/baseResults/spv.atomic.comp.out | 2 | ||||
-rwxr-xr-x | Test/baseResults/spv.glFragColor.frag.out | 30 | ||||
-rwxr-xr-x | Test/baseResults/spv.specConst.vert.out | 61 | ||||
-rw-r--r-- | Test/glspv.esversion.vert | 5 | ||||
-rw-r--r-- | Test/glspv.frag | 14 | ||||
-rw-r--r-- | Test/glspv.version.frag | 5 | ||||
-rw-r--r-- | Test/glspv.version.vert | 5 | ||||
-rw-r--r-- | Test/glspv.vert | 20 | ||||
-rw-r--r-- | Test/spv.glFragColor.frag | 6 | ||||
-rw-r--r-- | Test/spv.specConst.vert | 8 |
15 files changed, 232 insertions, 0 deletions
diff --git a/Test/baseResults/glspv.esversion.vert.out b/Test/baseResults/glspv.esversion.vert.out new file mode 100755 index 00000000..ef406a18 --- /dev/null +++ b/Test/baseResults/glspv.esversion.vert.out @@ -0,0 +1,11 @@ +glspv.esversion.vert +ERROR: #version: ES shaders for OpenGL SPIR-V are not supported +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. +ERROR: 1 compilation errors. No code generated. + + + +Linked vertex stage: + + +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/glspv.frag.out b/Test/baseResults/glspv.frag.out new file mode 100755 index 00000000..5df46c5b --- /dev/null +++ b/Test/baseResults/glspv.frag.out @@ -0,0 +1,13 @@ +glspv.frag +ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error ) +ERROR: 0:6: '#error' : GL_SPIR is 100 +ERROR: 0:14: 'input_attachment_index' : only allowed when using GLSL for Vulkan +ERROR: 0:14: '' : syntax error +ERROR: 4 compilation errors. No code generated. + + + +Linked fragment stage: + + +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/glspv.version.frag.out b/Test/baseResults/glspv.version.frag.out new file mode 100755 index 00000000..7f44889f --- /dev/null +++ b/Test/baseResults/glspv.version.frag.out @@ -0,0 +1,24 @@ +glspv.version.frag +ERROR: #version: compilation for SPIR-V does not support the compatibility profile + + +Linked fragment stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 6 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginLowerLeft + Source GLSL 330 + Name 4 "main" + 2: TypeVoid + 3: TypeFunction 2 + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/Test/baseResults/glspv.version.vert.out b/Test/baseResults/glspv.version.vert.out new file mode 100755 index 00000000..eb003dff --- /dev/null +++ b/Test/baseResults/glspv.version.vert.out @@ -0,0 +1,10 @@ +glspv.version.vert +ERROR: #version: Desktop shaders for OpenGL SPIR-V require version 330 or higher +ERROR: 1 compilation errors. No code generated. + + + +Linked vertex stage: + + +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/glspv.vert.out b/Test/baseResults/glspv.vert.out new file mode 100755 index 00000000..b91ab507 --- /dev/null +++ b/Test/baseResults/glspv.vert.out @@ -0,0 +1,18 @@ +glspv.vert +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. +ERROR: 0:3: 'push_constant' : only allowed when using GLSL for Vulkan +ERROR: 0:6: 'descriptor set' : only allowed when using GLSL for Vulkan +ERROR: 0:8: 'shared' : not allowed when generating SPIR-V +ERROR: 0:9: 'packed' : not allowed when generating SPIR-V +ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier +ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier +ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier +ERROR: 0:20: '' : syntax error +ERROR: 8 compilation errors. No code generated. + + + +Linked vertex stage: + + +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/spv.atomic.comp.out b/Test/baseResults/spv.atomic.comp.out index e4cf2320..01e09323 100755 --- a/Test/baseResults/spv.atomic.comp.out +++ b/Test/baseResults/spv.atomic.comp.out @@ -35,7 +35,9 @@ Linked compute stage: Name 70 "arrX" Name 71 "arrY" Name 72 "arrZ" + Decorate 20(counter) Offset 0 Decorate 20(counter) Binding 0 + Decorate 27(countArr) Offset 4 Decorate 27(countArr) Binding 0 MemberDecorate 60(dataSSB) 0 Restrict MemberDecorate 60(dataSSB) 0 Offset 0 diff --git a/Test/baseResults/spv.glFragColor.frag.out b/Test/baseResults/spv.glFragColor.frag.out new file mode 100755 index 00000000..df825a09 --- /dev/null +++ b/Test/baseResults/spv.glFragColor.frag.out @@ -0,0 +1,30 @@ +spv.glFragColor.frag + +Linked fragment stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 12 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 + ExecutionMode 4 OriginLowerLeft + Source GLSL 330 + Name 4 "main" + Name 9 "gl_FragColor" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(gl_FragColor): 8(ptr) Variable Output + 10: 6(float) Constant 1065353216 + 11: 7(fvec4) ConstantComposite 10 10 10 10 + 4(main): 2 Function None 3 + 5: Label + Store 9(gl_FragColor) 11 + Return + FunctionEnd diff --git a/Test/baseResults/spv.specConst.vert.out b/Test/baseResults/spv.specConst.vert.out new file mode 100755 index 00000000..db5a417c --- /dev/null +++ b/Test/baseResults/spv.specConst.vert.out @@ -0,0 +1,61 @@ +spv.specConst.vert +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + + +Linked vertex stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 27 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 13 25 26 + Source GLSL 450 + Name 4 "main" + Name 11 "gl_PerVertex" + MemberName 11(gl_PerVertex) 0 "gl_Position" + MemberName 11(gl_PerVertex) 1 "gl_PointSize" + MemberName 11(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 11(gl_PerVertex) 3 "gl_CullDistance" + Name 13 "" + Name 25 "gl_VertexID" + Name 26 "gl_InstanceID" + MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 11(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 11(gl_PerVertex) Block + Decorate 18 SpecId 11 + Decorate 25(gl_VertexID) BuiltIn VertexId + Decorate 26(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeInt 32 0 + 9: 8(int) Constant 1 + 10: TypeArray 6(float) 9 +11(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 10 10 + 12: TypePointer Output 11(gl_PerVertex) + 13: 12(ptr) Variable Output + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16: 6(float) Constant 1065353216 + 17: 7(fvec4) ConstantComposite 16 16 16 16 + 18: 14(int) SpecConstant 8 + 22: TypePointer Output 7(fvec4) + 24: TypePointer Input 14(int) + 25(gl_VertexID): 24(ptr) Variable Input +26(gl_InstanceID): 24(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 19: 6(float) ConvertSToF 18 + 20: 7(fvec4) CompositeConstruct 19 19 19 19 + 21: 7(fvec4) FDiv 17 20 + 23: 22(ptr) AccessChain 13 15 + Store 23 21 + Return + FunctionEnd diff --git a/Test/glspv.esversion.vert b/Test/glspv.esversion.vert new file mode 100644 index 00000000..23501bf6 --- /dev/null +++ b/Test/glspv.esversion.vert @@ -0,0 +1,5 @@ +#version 310 es
+
+void main()
+{
+}
diff --git a/Test/glspv.frag b/Test/glspv.frag new file mode 100644 index 00000000..cea8e135 --- /dev/null +++ b/Test/glspv.frag @@ -0,0 +1,14 @@ +#version 330
+
+#ifdef GL_SPIRV
+#error GL_SPIRV is set ( correct, not an error )
+#if GL_SPIRV == 100
+#error GL_SPIR is 100
+#endif
+#endif
+
+void main()
+{
+}
+
+layout(input_attachment_index = 1) uniform subpassInput sub; // ERROR, no inputs
diff --git a/Test/glspv.version.frag b/Test/glspv.version.frag new file mode 100644 index 00000000..c9c6779e --- /dev/null +++ b/Test/glspv.version.frag @@ -0,0 +1,5 @@ +#version 330 compatibility
+
+void main()
+{
+}
diff --git a/Test/glspv.version.vert b/Test/glspv.version.vert new file mode 100644 index 00000000..c8573b7b --- /dev/null +++ b/Test/glspv.version.vert @@ -0,0 +1,5 @@ +#version 150
+
+void main()
+{
+}
diff --git a/Test/glspv.vert b/Test/glspv.vert new file mode 100644 index 00000000..d2724ca2 --- /dev/null +++ b/Test/glspv.vert @@ -0,0 +1,20 @@ +#version 450
+
+layout(push_constant) uniform Material { int a; } mat; // ERROR, can't use push_constant
+
+layout(set = 0, binding = 0, std140) uniform Bt1 { int a; } bt1;
+layout(set = 1, binding = 0, std140) uniform Bt2 { int a; } bt2; // ERROR, set has to be 0
+
+layout(shared) uniform Bt3 { int a; } bt3; // ERROR, no shared
+layout(packed) uniform Bt4 { int a; } bt4; // ERROR, no shared
+
+void main()
+{
+ gl_VertexIndex; // ERROR, not preset
+ gl_InstanceIndex; // ERROR, not present
+ gl_VertexID;
+ gl_InstanceID;
+ gl_DepthRangeParameters; // ERROR, not present
+}
+
+uniform sampler s; // ERROR, no sampler
diff --git a/Test/spv.glFragColor.frag b/Test/spv.glFragColor.frag new file mode 100644 index 00000000..12dbcb22 --- /dev/null +++ b/Test/spv.glFragColor.frag @@ -0,0 +1,6 @@ +#version 330
+
+void main()
+{
+ gl_FragColor = vec4(1.0);
+}
diff --git a/Test/spv.specConst.vert b/Test/spv.specConst.vert new file mode 100644 index 00000000..3ea24980 --- /dev/null +++ b/Test/spv.specConst.vert @@ -0,0 +1,8 @@ +#version 450
+
+layout(constant_id = 11) const int a = 8;
+
+void main()
+{
+ gl_Position = vec4(1.0) / a;
+}
|