SPV: Further refine OpenGL vs. Vulkan differences for SPIR-V.

Includes adding test cases to verify the differences.
This commit is contained in:
John Kessenich
2016-07-07 17:46:42 -06:00
parent 2d0cc786f3
commit 91e4aa5900
23 changed files with 305 additions and 27 deletions

View File

@@ -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

13
Test/baseResults/glspv.frag.out Executable file
View File

@@ -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

View File

@@ -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

View File

@@ -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

18
Test/baseResults/glspv.vert.out Executable file
View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,5 @@
#version 310 es
void main()
{
}

14
Test/glspv.frag Normal file
View File

@@ -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

5
Test/glspv.version.frag Normal file
View File

@@ -0,0 +1,5 @@
#version 330 compatibility
void main()
{
}

5
Test/glspv.version.vert Normal file
View File

@@ -0,0 +1,5 @@
#version 150
void main()
{
}

20
Test/glspv.vert Normal file
View File

@@ -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

View File

@@ -0,0 +1,6 @@
#version 330
void main()
{
gl_FragColor = vec4(1.0);
}

8
Test/spv.specConst.vert Normal file
View File

@@ -0,0 +1,8 @@
#version 450
layout(constant_id = 11) const int a = 8;
void main()
{
gl_Position = vec4(1.0) / a;
}