SPV: Don't emit memory barrier for ESSL barrier(), but still do for GLSL barrier().

Addresses issue #205.
Current open Khronos bug for finalizing this.
This commit is contained in:
John Kessenich
2016-05-19 18:26:42 -06:00
parent eb6d950789
commit 823fc65644
2 changed files with 105 additions and 106 deletions

View File

@@ -3881,6 +3881,7 @@ 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.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;

View File

@@ -7,123 +7,121 @@ Linked compute stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 67 // Id's are bound by 66
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 53 EntryPoint GLCompute 4 "main" 52
ExecutionMode 4 LocalSize 16 32 4 ExecutionMode 4 LocalSize 16 32 4
Source ESSL 310 Source ESSL 310
Name 4 "main" Name 4 "main"
Name 13 "outb" Name 12 "outb"
MemberName 13(outb) 0 "f" MemberName 12(outb) 0 "f"
MemberName 13(outb) 1 "g" MemberName 12(outb) 1 "g"
MemberName 13(outb) 2 "h" MemberName 12(outb) 2 "h"
MemberName 13(outb) 3 "uns" MemberName 12(outb) 3 "uns"
Name 15 "outbname" Name 14 "outbname"
Name 19 "s" Name 18 "s"
Name 24 "outbna" Name 23 "outbna"
MemberName 24(outbna) 0 "k" MemberName 23(outbna) 0 "k"
MemberName 24(outbna) 1 "na" MemberName 23(outbna) 1 "na"
Name 26 "outbnamena" Name 25 "outbnamena"
Name 42 "i" Name 41 "i"
Name 48 "outs" Name 47 "outs"
MemberName 48(outs) 0 "s" MemberName 47(outs) 0 "s"
MemberName 48(outs) 1 "va" MemberName 47(outs) 1 "va"
Name 50 "outnames" Name 49 "outnames"
Name 53 "gl_LocalInvocationID" Name 52 "gl_LocalInvocationID"
Decorate 12 ArrayStride 16 Decorate 11 ArrayStride 16
MemberDecorate 13(outb) 0 Offset 0 MemberDecorate 12(outb) 0 Offset 0
MemberDecorate 13(outb) 1 Offset 4 MemberDecorate 12(outb) 1 Offset 4
MemberDecorate 13(outb) 2 Offset 8 MemberDecorate 12(outb) 2 Offset 8
MemberDecorate 13(outb) 3 Offset 16 MemberDecorate 12(outb) 3 Offset 16
Decorate 13(outb) BufferBlock Decorate 12(outb) BufferBlock
Decorate 15(outbname) DescriptorSet 0 Decorate 14(outbname) DescriptorSet 0
MemberDecorate 24(outbna) 0 Offset 0 MemberDecorate 23(outbna) 0 Offset 0
MemberDecorate 24(outbna) 1 Offset 16 MemberDecorate 23(outbna) 1 Offset 16
Decorate 24(outbna) BufferBlock Decorate 23(outbna) BufferBlock
Decorate 26(outbnamena) DescriptorSet 0 Decorate 25(outbnamena) DescriptorSet 0
Decorate 47 ArrayStride 16 Decorate 46 ArrayStride 16
MemberDecorate 48(outs) 0 Offset 0 MemberDecorate 47(outs) 0 Offset 0
MemberDecorate 48(outs) 1 Offset 16 MemberDecorate 47(outs) 1 Offset 16
Decorate 48(outs) BufferBlock Decorate 47(outs) BufferBlock
Decorate 50(outnames) DescriptorSet 0 Decorate 49(outnames) DescriptorSet 0
Decorate 53(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 52(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 66 BuiltIn WorkgroupSize Decorate 65 BuiltIn WorkgroupSize
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: TypeFloat 32
10: TypeFloat 32 10: TypeVector 9(float) 3
11: TypeVector 10(float) 3 11: TypeRuntimeArray 10(fvec3)
12: TypeRuntimeArray 11(fvec3) 12(outb): TypeStruct 9(float) 9(float) 9(float) 11
13(outb): TypeStruct 10(float) 10(float) 10(float) 12 13: TypePointer Uniform 12(outb)
14: TypePointer Uniform 13(outb) 14(outbname): 13(ptr) Variable Uniform
15(outbname): 14(ptr) Variable Uniform 15: TypeInt 32 1
16: TypeInt 32 1 16: 15(int) Constant 0
17: 16(int) Constant 0 17: TypePointer Workgroup 9(float)
18: TypePointer Workgroup 10(float) 18(s): 17(ptr) Variable Workgroup
19(s): 18(ptr) Variable Workgroup 20: TypePointer Uniform 9(float)
21: TypePointer Uniform 10(float) 22: TypeVector 9(float) 4
23: TypeVector 10(float) 4 23(outbna): TypeStruct 15(int) 22(fvec4)
24(outbna): TypeStruct 16(int) 23(fvec4) 24: TypePointer Uniform 23(outbna)
25: TypePointer Uniform 24(outbna) 25(outbnamena): 24(ptr) Variable Uniform
26(outbnamena): 25(ptr) Variable Uniform 26: 15(int) Constant 1
27: 16(int) Constant 1 29: TypePointer Uniform 22(fvec4)
30: TypePointer Uniform 23(fvec4) 31: 15(int) Constant 3
32: 16(int) Constant 3 32: 15(int) Constant 18
33: 16(int) Constant 18 35: 15(int) Constant 17
36: 16(int) Constant 17 36: 9(float) Constant 1077936128
37: 10(float) Constant 1077936128 37: 10(fvec3) ConstantComposite 36 36 36
38: 11(fvec3) ConstantComposite 37 37 37 38: TypePointer Uniform 10(fvec3)
39: TypePointer Uniform 11(fvec3) 40: TypePointer Workgroup 15(int)
41: TypePointer Workgroup 16(int) 41(i): 40(ptr) Variable Workgroup
42(i): 41(ptr) Variable Workgroup 46: TypeRuntimeArray 22(fvec4)
47: TypeRuntimeArray 23(fvec4) 47(outs): TypeStruct 15(int) 46
48(outs): TypeStruct 16(int) 47 48: TypePointer Uniform 47(outs)
49: TypePointer Uniform 48(outs) 49(outnames): 48(ptr) Variable Uniform
50(outnames): 49(ptr) Variable Uniform 50: TypeVector 6(int) 3
51: TypeVector 6(int) 3 51: TypePointer Input 50(ivec3)
52: TypePointer Input 51(ivec3) 52(gl_LocalInvocationID): 51(ptr) Variable Input
53(gl_LocalInvocationID): 52(ptr) Variable Input 53: TypePointer Input 6(int)
54: TypePointer Input 6(int) 60: TypePointer Uniform 15(int)
61: TypePointer Uniform 16(int) 62: 6(int) Constant 16
63: 6(int) Constant 16 63: 6(int) Constant 32
64: 6(int) Constant 32 64: 6(int) Constant 4
65: 6(int) Constant 4 65: 50(ivec3) ConstantComposite 62 63 64
66: 51(ivec3) ConstantComposite 63 64 65
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
MemoryBarrier 7 8 ControlBarrier 7 7 8
ControlBarrier 7 7 9 19: 9(float) Load 18(s)
20: 10(float) Load 19(s) 21: 20(ptr) AccessChain 14(outbname) 16
22: 21(ptr) AccessChain 15(outbname) 17 Store 21 19
Store 22 20 27: 9(float) Load 18(s)
28: 10(float) Load 19(s) 28: 22(fvec4) CompositeConstruct 27 27 27 27
29: 23(fvec4) CompositeConstruct 28 28 28 28 30: 29(ptr) AccessChain 25(outbnamena) 26
31: 30(ptr) AccessChain 26(outbnamena) 27 Store 30 28
Store 31 29 33: 20(ptr) AccessChain 14(outbname) 31 32 8
34: 21(ptr) AccessChain 15(outbname) 32 33 9 34: 9(float) Load 33
35: 10(float) Load 34 Store 18(s) 34
Store 19(s) 35 39: 38(ptr) AccessChain 14(outbname) 31 35
40: 39(ptr) AccessChain 15(outbname) 32 36 Store 39 37
Store 40 38 42: 15(int) Load 41(i)
43: 16(int) Load 42(i) 43: 9(float) Load 18(s)
44: 10(float) Load 19(s) 44: 10(fvec3) CompositeConstruct 43 43 43
45: 11(fvec3) CompositeConstruct 44 44 44 45: 38(ptr) AccessChain 14(outbname) 31 42
46: 39(ptr) AccessChain 15(outbname) 32 43 Store 45 44
Store 46 45 54: 53(ptr) AccessChain 52(gl_LocalInvocationID) 8
55: 54(ptr) AccessChain 53(gl_LocalInvocationID) 9 55: 6(int) Load 54
56: 6(int) Load 55 56: 9(float) Load 18(s)
57: 10(float) Load 19(s) 57: 22(fvec4) CompositeConstruct 56 56 56 56
58: 23(fvec4) CompositeConstruct 57 57 57 57 58: 29(ptr) AccessChain 49(outnames) 26 55
59: 30(ptr) AccessChain 50(outnames) 27 56 Store 58 57
Store 59 58 59: 15(int) ArrayLength 14(outbname) 3
60: 16(int) ArrayLength 15(outbname) 3 61: 60(ptr) AccessChain 49(outnames) 16
62: 61(ptr) AccessChain 50(outnames) 17 Store 61 59
Store 62 60
Return Return
FunctionEnd FunctionEnd