SPV: Update to spec. decisions (and issue #205) for barrier().

A barrier (ESSL/GLSL) or OpControlBarrier when in a tessellation control
shader also means doing memory synchronization for output variables.
This commit is contained in:
John Kessenich 2016-06-14 19:46:20 -06:00
parent 01de90bb1c
commit c51287d744
3 changed files with 151 additions and 158 deletions

View File

@ -3924,8 +3924,6 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op)
builder.createNoResultOp(spv::OpEndPrimitive); builder.createNoResultOp(spv::OpEndPrimitive);
return 0; return 0;
case glslang::EOpBarrier: case glslang::EOpBarrier:
if (glslangIntermediate->getProfile() != EEsProfile)
builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsAllMemory);
builder.createControlBarrier(spv::ScopeDevice, spv::ScopeDevice, spv::MemorySemanticsMaskNone); builder.createControlBarrier(spv::ScopeDevice, spv::ScopeDevice, spv::MemorySemanticsMaskNone);
return 0; return 0;
case glslang::EOpMemoryBarrier: case glslang::EOpMemoryBarrier:

View File

@ -67,10 +67,7 @@ const Id NoType = 0;
const unsigned int BadValue = 0xFFFFFFFF; const unsigned int BadValue = 0xFFFFFFFF;
const Decoration NoPrecision = (Decoration)BadValue; const Decoration NoPrecision = (Decoration)BadValue;
const MemorySemanticsMask MemorySemanticsAllMemory = const MemorySemanticsMask MemorySemanticsAllMemory =
(MemorySemanticsMask)(MemorySemanticsAcquireMask | (MemorySemanticsMask)(MemorySemanticsSequentiallyConsistentMask |
MemorySemanticsReleaseMask |
MemorySemanticsAcquireReleaseMask |
MemorySemanticsSequentiallyConsistentMask |
MemorySemanticsUniformMemoryMask | MemorySemanticsUniformMemoryMask |
MemorySemanticsSubgroupMemoryMask | MemorySemanticsSubgroupMemoryMask |
MemorySemanticsWorkgroupMemoryMask | MemorySemanticsWorkgroupMemoryMask |

View File

@ -7,173 +7,171 @@ Linked tessellation control stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 94 // Id's are bound by 93
Capability Tessellation Capability Tessellation
Capability TessellationPointSize Capability TessellationPointSize
Capability ClipDistance Capability ClipDistance
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 24 41 44 47 55 69 74 80 84 85 88 89 92 93 EntryPoint TessellationControl 4 "main" 23 40 43 46 54 68 73 79 83 84 87 88 91 92
ExecutionMode 4 OutputVertices 4 ExecutionMode 4 OutputVertices 4
Source GLSL 400 Source GLSL 400
SourceExtension "GL_ARB_separate_shader_objects" SourceExtension "GL_ARB_separate_shader_objects"
Name 4 "main" Name 4 "main"
Name 12 "a" Name 11 "a"
Name 17 "p" Name 16 "p"
Name 20 "gl_PerVertex" Name 19 "gl_PerVertex"
MemberName 20(gl_PerVertex) 0 "gl_Position" MemberName 19(gl_PerVertex) 0 "gl_Position"
MemberName 20(gl_PerVertex) 1 "gl_PointSize" MemberName 19(gl_PerVertex) 1 "gl_PointSize"
MemberName 20(gl_PerVertex) 2 "gl_ClipDistance" MemberName 19(gl_PerVertex) 2 "gl_ClipDistance"
Name 24 "gl_in" Name 23 "gl_in"
Name 31 "ps" Name 30 "ps"
Name 35 "cd" Name 34 "cd"
Name 39 "pvi" Name 38 "pvi"
Name 41 "gl_PatchVerticesIn" Name 40 "gl_PatchVerticesIn"
Name 43 "pid" Name 42 "pid"
Name 44 "gl_PrimitiveID" Name 43 "gl_PrimitiveID"
Name 46 "iid" Name 45 "iid"
Name 47 "gl_InvocationID" Name 46 "gl_InvocationID"
Name 51 "gl_PerVertex" Name 50 "gl_PerVertex"
MemberName 51(gl_PerVertex) 0 "gl_Position" MemberName 50(gl_PerVertex) 0 "gl_Position"
MemberName 51(gl_PerVertex) 1 "gl_PointSize" MemberName 50(gl_PerVertex) 1 "gl_PointSize"
MemberName 51(gl_PerVertex) 2 "gl_ClipDistance" MemberName 50(gl_PerVertex) 2 "gl_ClipDistance"
Name 55 "gl_out" Name 54 "gl_out"
Name 69 "gl_TessLevelOuter" Name 68 "gl_TessLevelOuter"
Name 74 "gl_TessLevelInner" Name 73 "gl_TessLevelInner"
Name 79 "outa" Name 78 "outa"
Name 80 "patchOut" Name 79 "patchOut"
Name 84 "inb" Name 83 "inb"
Name 85 "ind" Name 84 "ind"
Name 88 "ivla" Name 87 "ivla"
Name 89 "ivlb" Name 88 "ivlb"
Name 92 "ovla" Name 91 "ovla"
Name 93 "ovlb" Name 92 "ovlb"
MemberDecorate 20(gl_PerVertex) 0 BuiltIn Position MemberDecorate 19(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 20(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 19(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 20(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 19(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 20(gl_PerVertex) Block Decorate 19(gl_PerVertex) Block
Decorate 41(gl_PatchVerticesIn) BuiltIn PatchVertices Decorate 40(gl_PatchVerticesIn) BuiltIn PatchVertices
Decorate 44(gl_PrimitiveID) BuiltIn PrimitiveId Decorate 43(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 47(gl_InvocationID) BuiltIn InvocationId Decorate 46(gl_InvocationID) BuiltIn InvocationId
MemberDecorate 51(gl_PerVertex) 0 BuiltIn Position MemberDecorate 50(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 51(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 50(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 51(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 50(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 51(gl_PerVertex) Block Decorate 50(gl_PerVertex) Block
Decorate 69(gl_TessLevelOuter) Patch Decorate 68(gl_TessLevelOuter) Patch
Decorate 69(gl_TessLevelOuter) BuiltIn TessLevelOuter Decorate 68(gl_TessLevelOuter) BuiltIn TessLevelOuter
Decorate 74(gl_TessLevelInner) Patch Decorate 73(gl_TessLevelInner) Patch
Decorate 74(gl_TessLevelInner) BuiltIn TessLevelInner Decorate 73(gl_TessLevelInner) BuiltIn TessLevelInner
Decorate 80(patchOut) Patch Decorate 79(patchOut) Patch
Decorate 88(ivla) Location 3 Decorate 87(ivla) Location 3
Decorate 89(ivlb) Location 4 Decorate 88(ivlb) Location 4
Decorate 92(ovla) Location 3 Decorate 91(ovla) Location 3
Decorate 93(ovlb) Location 4 Decorate 92(ovlb) Location 4
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 0 6: TypeInt 32 0
7: 6(int) Constant 1 7: 6(int) Constant 1
8: 6(int) Constant 4062 8: 6(int) Constant 0
9: 6(int) Constant 0 9: TypeInt 32 1
10: TypeInt 32 1 10: TypePointer Function 9(int)
11: TypePointer Function 10(int) 12: 9(int) Constant 5392
13: 10(int) Constant 5392 13: TypeFloat 32
14: TypeFloat 32 14: TypeVector 13(float) 4
15: TypeVector 14(float) 4 15: TypePointer Function 14(fvec4)
16: TypePointer Function 15(fvec4) 17: 6(int) Constant 3
18: 6(int) Constant 3 18: TypeArray 13(float) 17
19: TypeArray 14(float) 18 19(gl_PerVertex): TypeStruct 14(fvec4) 13(float) 18
20(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 19 20: 6(int) Constant 32
21: 6(int) Constant 32 21: TypeArray 19(gl_PerVertex) 20
22: TypeArray 20(gl_PerVertex) 21 22: TypePointer Input 21
23: TypePointer Input 22 23(gl_in): 22(ptr) Variable Input
24(gl_in): 23(ptr) Variable Input 24: 9(int) Constant 1
25: 10(int) Constant 1 25: 9(int) Constant 0
26: 10(int) Constant 0 26: TypePointer Input 14(fvec4)
27: TypePointer Input 15(fvec4) 29: TypePointer Function 13(float)
30: TypePointer Function 14(float) 31: TypePointer Input 13(float)
32: TypePointer Input 14(float) 35: 9(int) Constant 2
36: 10(int) Constant 2 39: TypePointer Input 9(int)
40: TypePointer Input 10(int) 40(gl_PatchVerticesIn): 39(ptr) Variable Input
41(gl_PatchVerticesIn): 40(ptr) Variable Input 43(gl_PrimitiveID): 39(ptr) Variable Input
44(gl_PrimitiveID): 40(ptr) Variable Input 46(gl_InvocationID): 39(ptr) Variable Input
47(gl_InvocationID): 40(ptr) Variable Input 48: 6(int) Constant 2
49: 6(int) Constant 2 49: TypeArray 13(float) 48
50: TypeArray 14(float) 49 50(gl_PerVertex): TypeStruct 14(fvec4) 13(float) 49
51(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 50 51: 6(int) Constant 4
52: 6(int) Constant 4 52: TypeArray 50(gl_PerVertex) 51
53: TypeArray 51(gl_PerVertex) 52 53: TypePointer Output 52
54: TypePointer Output 53 54(gl_out): 53(ptr) Variable Output
55(gl_out): 54(ptr) Variable Output 57: TypePointer Output 14(fvec4)
58: TypePointer Output 15(fvec4) 61: TypePointer Output 13(float)
62: TypePointer Output 14(float) 66: TypeArray 13(float) 51
67: TypeArray 14(float) 52 67: TypePointer Output 66
68: TypePointer Output 67 68(gl_TessLevelOuter): 67(ptr) Variable Output
69(gl_TessLevelOuter): 68(ptr) Variable Output 69: 9(int) Constant 3
70: 10(int) Constant 3 70: 13(float) Constant 1078774989
71: 14(float) Constant 1078774989 72: TypePointer Output 49
73: TypePointer Output 50 73(gl_TessLevelInner): 72(ptr) Variable Output
74(gl_TessLevelInner): 73(ptr) Variable Output 74: 13(float) Constant 1067869798
75: 14(float) Constant 1067869798 76: TypeArray 9(int) 51
77: TypeArray 10(int) 52 77: TypePointer Private 76
78: TypePointer Private 77 78(outa): 77(ptr) Variable Private
79(outa): 78(ptr) Variable Private 79(patchOut): 57(ptr) Variable Output
80(patchOut): 58(ptr) Variable Output 80: TypeVector 13(float) 2
81: TypeVector 14(float) 2 81: TypeArray 80(fvec2) 20
82: TypeArray 81(fvec2) 21 82: TypePointer Input 81
83: TypePointer Input 82 83(inb): 82(ptr) Variable Input
84(inb): 83(ptr) Variable Input 84(ind): 82(ptr) Variable Input
85(ind): 83(ptr) Variable Input 85: TypeArray 14(fvec4) 20
86: TypeArray 15(fvec4) 21 86: TypePointer Input 85
87: TypePointer Input 86 87(ivla): 86(ptr) Variable Input
88(ivla): 87(ptr) Variable Input 88(ivlb): 86(ptr) Variable Input
89(ivlb): 87(ptr) Variable Input 89: TypeArray 14(fvec4) 51
90: TypeArray 15(fvec4) 52 90: TypePointer Output 89
91: TypePointer Output 90 91(ovla): 90(ptr) Variable Output
92(ovla): 91(ptr) Variable Output 92(ovlb): 90(ptr) Variable Output
93(ovlb): 91(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
12(a): 11(ptr) Variable Function 11(a): 10(ptr) Variable Function
17(p): 16(ptr) Variable Function 16(p): 15(ptr) Variable Function
31(ps): 30(ptr) Variable Function 30(ps): 29(ptr) Variable Function
35(cd): 30(ptr) Variable Function 34(cd): 29(ptr) Variable Function
39(pvi): 11(ptr) Variable Function 38(pvi): 10(ptr) Variable Function
43(pid): 11(ptr) Variable Function 42(pid): 10(ptr) Variable Function
46(iid): 11(ptr) Variable Function 45(iid): 10(ptr) Variable Function
MemoryBarrier 7 8 ControlBarrier 7 7 8
ControlBarrier 7 7 9 Store 11(a) 12
Store 12(a) 13 27: 26(ptr) AccessChain 23(gl_in) 24 25
28: 27(ptr) AccessChain 24(gl_in) 25 26 28: 14(fvec4) Load 27
29: 15(fvec4) Load 28 Store 16(p) 28
Store 17(p) 29 32: 31(ptr) AccessChain 23(gl_in) 24 24
33: 32(ptr) AccessChain 24(gl_in) 25 25 33: 13(float) Load 32
34: 14(float) Load 33 Store 30(ps) 33
Store 31(ps) 34 36: 31(ptr) AccessChain 23(gl_in) 24 35 35
37: 32(ptr) AccessChain 24(gl_in) 25 36 36 37: 13(float) Load 36
38: 14(float) Load 37 Store 34(cd) 37
Store 35(cd) 38 41: 9(int) Load 40(gl_PatchVerticesIn)
42: 10(int) Load 41(gl_PatchVerticesIn) Store 38(pvi) 41
Store 39(pvi) 42 44: 9(int) Load 43(gl_PrimitiveID)
45: 10(int) Load 44(gl_PrimitiveID) Store 42(pid) 44
Store 43(pid) 45 47: 9(int) Load 46(gl_InvocationID)
48: 10(int) Load 47(gl_InvocationID) Store 45(iid) 47
Store 46(iid) 48 55: 9(int) Load 46(gl_InvocationID)
56: 10(int) Load 47(gl_InvocationID) 56: 14(fvec4) Load 16(p)
57: 15(fvec4) Load 17(p) 58: 57(ptr) AccessChain 54(gl_out) 55 25
59: 58(ptr) AccessChain 55(gl_out) 56 26 Store 58 56
Store 59 57 59: 9(int) Load 46(gl_InvocationID)
60: 10(int) Load 47(gl_InvocationID) 60: 13(float) Load 30(ps)
61: 14(float) Load 31(ps) 62: 61(ptr) AccessChain 54(gl_out) 59 24
63: 62(ptr) AccessChain 55(gl_out) 60 25 Store 62 60
Store 63 61 63: 9(int) Load 46(gl_InvocationID)
64: 10(int) Load 47(gl_InvocationID) 64: 13(float) Load 34(cd)
65: 14(float) Load 35(cd) 65: 61(ptr) AccessChain 54(gl_out) 63 35 24
66: 62(ptr) AccessChain 55(gl_out) 64 36 25 Store 65 64
Store 66 65 71: 61(ptr) AccessChain 68(gl_TessLevelOuter) 69
72: 62(ptr) AccessChain 69(gl_TessLevelOuter) 70 Store 71 70
Store 72 71 75: 61(ptr) AccessChain 73(gl_TessLevelInner) 24
76: 62(ptr) AccessChain 74(gl_TessLevelInner) 25 Store 75 74
Store 76 75
Return Return
FunctionEnd FunctionEnd