Fix a parser error of GL_KHR_memory_scope_semantics
When 2DMS or 2DMSArray is used, IMAGE_PARAMS will take an additional paramter to represent sample number. The semantics check should get the correct semantics values, taking this case into account.
This commit is contained in:
parent
b82ed734e7
commit
b4bab3ce01
@ -1,11 +1,12 @@
|
|||||||
spv.memoryScopeSemantics.comp
|
spv.memoryScopeSemantics.comp
|
||||||
// Module Version 10300
|
// Module Version 10300
|
||||||
// Generated by (magic number): 80008
|
// Generated by (magic number): 80008
|
||||||
// Id's are bound by 163
|
// Id's are bound by 167
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability Int64
|
Capability Int64
|
||||||
Capability Int64Atomics
|
Capability Int64Atomics
|
||||||
|
Capability StorageImageMultisample
|
||||||
Capability VulkanMemoryModelKHR
|
Capability VulkanMemoryModelKHR
|
||||||
Capability VulkanMemoryModelDeviceScopeKHR
|
Capability VulkanMemoryModelDeviceScopeKHR
|
||||||
Extension "SPV_KHR_vulkan_memory_model"
|
Extension "SPV_KHR_vulkan_memory_model"
|
||||||
@ -49,6 +50,7 @@ spv.memoryScopeSemantics.comp
|
|||||||
Name 151 "BufferM"
|
Name 151 "BufferM"
|
||||||
MemberName 151(BufferM) 0 "x"
|
MemberName 151(BufferM) 0 "x"
|
||||||
Name 153 "bufferm"
|
Name 153 "bufferm"
|
||||||
|
Name 165 "imageMS"
|
||||||
Decorate 36(imagei) DescriptorSet 0
|
Decorate 36(imagei) DescriptorSet 0
|
||||||
Decorate 36(imagei) Binding 1
|
Decorate 36(imagei) Binding 1
|
||||||
Decorate 46(imageu) DescriptorSet 0
|
Decorate 46(imageu) DescriptorSet 0
|
||||||
@ -83,6 +85,8 @@ spv.memoryScopeSemantics.comp
|
|||||||
Decorate 151(BufferM) Block
|
Decorate 151(BufferM) Block
|
||||||
Decorate 153(bufferm) DescriptorSet 0
|
Decorate 153(bufferm) DescriptorSet 0
|
||||||
Decorate 153(bufferm) Binding 9
|
Decorate 153(bufferm) Binding 9
|
||||||
|
Decorate 165(imageMS) DescriptorSet 0
|
||||||
|
Decorate 165(imageMS) Binding 10
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeInt 32 1
|
6: TypeInt 32 1
|
||||||
@ -174,6 +178,9 @@ spv.memoryScopeSemantics.comp
|
|||||||
152: TypePointer StorageBuffer 151(BufferM)
|
152: TypePointer StorageBuffer 151(BufferM)
|
||||||
153(bufferm): 152(ptr) Variable StorageBuffer
|
153(bufferm): 152(ptr) Variable StorageBuffer
|
||||||
161: 6(int) Constant 32768
|
161: 6(int) Constant 32768
|
||||||
|
163: TypeImage 6(int) 2D multi-sampled nonsampled format:R32i
|
||||||
|
164: TypePointer UniformConstant 163
|
||||||
|
165(imageMS): 164(ptr) Variable UniformConstant
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
8(origi): 7(ptr) Variable Function
|
8(origi): 7(ptr) Variable Function
|
||||||
@ -271,5 +278,7 @@ spv.memoryScopeSemantics.comp
|
|||||||
159: 15(int) AtomicIAdd 158 12 17 51
|
159: 15(int) AtomicIAdd 158 12 17 51
|
||||||
160: 69(ptr) AccessChain 68(bufferu) 38
|
160: 69(ptr) AccessChain 68(bufferu) 38
|
||||||
162: 15(int) AtomicIAdd 160 12 42 16
|
162: 15(int) AtomicIAdd 160 12 42 16
|
||||||
|
166: 40(ptr) ImageTexelPointer 165(imageMS) 39 12
|
||||||
|
AtomicStore 166 12 33 14
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -20,6 +20,7 @@ shared uint64_t atomu64;
|
|||||||
shared int64_t atomi64;
|
shared int64_t atomi64;
|
||||||
layout (binding = 8) volatile buffer BufferL { uint x; } bufferl;
|
layout (binding = 8) volatile buffer BufferL { uint x; } bufferl;
|
||||||
layout (binding = 9) buffer BufferM { volatile uint x; } bufferm;
|
layout (binding = 9) buffer BufferM { volatile uint x; } bufferm;
|
||||||
|
layout(binding = 10, r32i) volatile coherent uniform iimage2DMS imageMS;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@ -66,5 +67,7 @@ void main()
|
|||||||
imageAtomicAdd(imagei, ivec2(0,0), 3);
|
imageAtomicAdd(imagei, ivec2(0,0), 3);
|
||||||
atomicAdd(bufferu.x, 4u, gl_ScopeDevice, 0, 0);
|
atomicAdd(bufferu.x, 4u, gl_ScopeDevice, 0, 0);
|
||||||
atomicAdd(bufferu.x, 5u, gl_ScopeDevice, 0, gl_SemanticsVolatile);
|
atomicAdd(bufferu.x, 5u, gl_ScopeDevice, 0, gl_SemanticsVolatile);
|
||||||
|
|
||||||
|
imageAtomicStore(imageMS, ivec2(0,0), 1, 4, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1672,6 +1672,9 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction&
|
|||||||
unsigned int semantics = 0, storageClassSemantics = 0;
|
unsigned int semantics = 0, storageClassSemantics = 0;
|
||||||
unsigned int semantics2 = 0, storageClassSemantics2 = 0;
|
unsigned int semantics2 = 0, storageClassSemantics2 = 0;
|
||||||
|
|
||||||
|
const TIntermTyped* arg0 = (*argp)[0]->getAsTyped();
|
||||||
|
const bool isMS = arg0->getBasicType() == EbtSampler && arg0->getType().getSampler().isMultiSample();
|
||||||
|
|
||||||
// Grab the semantics and storage class semantics from the operands, based on opcode
|
// Grab the semantics and storage class semantics from the operands, based on opcode
|
||||||
switch (callNode.getOp()) {
|
switch (callNode.getOp()) {
|
||||||
case EOpAtomicAdd:
|
case EOpAtomicAdd:
|
||||||
@ -1704,18 +1707,18 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction&
|
|||||||
case EOpImageAtomicXor:
|
case EOpImageAtomicXor:
|
||||||
case EOpImageAtomicExchange:
|
case EOpImageAtomicExchange:
|
||||||
case EOpImageAtomicStore:
|
case EOpImageAtomicStore:
|
||||||
storageClassSemantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
storageClassSemantics = (*argp)[isMS ? 5 : 4]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
semantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
semantics = (*argp)[isMS ? 6 : 5]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
break;
|
break;
|
||||||
case EOpImageAtomicLoad:
|
case EOpImageAtomicLoad:
|
||||||
storageClassSemantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
storageClassSemantics = (*argp)[isMS ? 4 : 3]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
semantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
semantics = (*argp)[isMS ? 5 : 4]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
break;
|
break;
|
||||||
case EOpImageAtomicCompSwap:
|
case EOpImageAtomicCompSwap:
|
||||||
storageClassSemantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
storageClassSemantics = (*argp)[isMS ? 6 : 5]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
semantics = (*argp)[6]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
semantics = (*argp)[isMS ? 7 : 6]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
storageClassSemantics2 = (*argp)[7]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
storageClassSemantics2 = (*argp)[isMS ? 8 : 7]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
semantics2 = (*argp)[8]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
semantics2 = (*argp)[isMS ? 9 : 8]->getAsConstantUnion()->getConstArray()[0].getIConst();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EOpBarrier:
|
case EOpBarrier:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user