Emit Int64Atomics for imageAtomicStore
This covers a corner case wherein imageAtomicStore is used exclusively. The proxy type for imageAtomicStore is inferred from the image type. Fix #2975.
This commit is contained in:
parent
68c1880c09
commit
8bdc3d4d31
@ -5581,10 +5581,12 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
|||||||
operands.push_back(sample);
|
operands.push_back(sample);
|
||||||
|
|
||||||
spv::Id resultTypeId;
|
spv::Id resultTypeId;
|
||||||
|
glslang::TBasicType typeProxy = node->getBasicType();
|
||||||
// imageAtomicStore has a void return type so base the pointer type on
|
// imageAtomicStore has a void return type so base the pointer type on
|
||||||
// the type of the value operand.
|
// the type of the value operand.
|
||||||
if (node->getOp() == glslang::EOpImageAtomicStore) {
|
if (node->getOp() == glslang::EOpImageAtomicStore) {
|
||||||
resultTypeId = builder.makePointer(spv::StorageClassImage, builder.getTypeId(*opIt));
|
resultTypeId = builder.makePointer(spv::StorageClassImage, builder.getTypeId(*opIt));
|
||||||
|
typeProxy = node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType().getSampler().type;
|
||||||
} else {
|
} else {
|
||||||
resultTypeId = builder.makePointer(spv::StorageClassImage, resultType());
|
resultTypeId = builder.makePointer(spv::StorageClassImage, resultType());
|
||||||
}
|
}
|
||||||
@ -5598,7 +5600,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
|||||||
for (; opIt != arguments.end(); ++opIt)
|
for (; opIt != arguments.end(); ++opIt)
|
||||||
operands.push_back(*opIt);
|
operands.push_back(*opIt);
|
||||||
|
|
||||||
return createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType(),
|
return createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy,
|
||||||
lvalueCoherentFlags);
|
lvalueCoherentFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
58
Test/baseResults/spv.imageAtomic64.comp.out
Normal file
58
Test/baseResults/spv.imageAtomic64.comp.out
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
spv.imageAtomic64.comp
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 8000a
|
||||||
|
// Id's are bound by 28
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
Capability Int64
|
||||||
|
Capability Int64Atomics
|
||||||
|
Capability Int64ImageEXT
|
||||||
|
Extension "SPV_EXT_shader_image_int64"
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint GLCompute 4 "main"
|
||||||
|
ExecutionMode 4 LocalSize 1 1 1
|
||||||
|
Source GLSL 450
|
||||||
|
SourceExtension "GL_EXT_shader_explicit_arithmetic_types_int64"
|
||||||
|
SourceExtension "GL_EXT_shader_image_int64"
|
||||||
|
SourceExtension "GL_KHR_memory_scope_semantics"
|
||||||
|
Name 4 "main"
|
||||||
|
Name 9 "z"
|
||||||
|
Name 14 "ssbo"
|
||||||
|
MemberName 14(ssbo) 0 "y"
|
||||||
|
Name 16 ""
|
||||||
|
Decorate 9(z) DescriptorSet 0
|
||||||
|
Decorate 9(z) Binding 1
|
||||||
|
MemberDecorate 14(ssbo) 0 Offset 0
|
||||||
|
Decorate 14(ssbo) BufferBlock
|
||||||
|
Decorate 16 DescriptorSet 0
|
||||||
|
Decorate 16 Binding 0
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
6: TypeInt 64 0
|
||||||
|
7: TypeImage 6(int64_t) 2D nonsampled format:R64ui
|
||||||
|
8: TypePointer UniformConstant 7
|
||||||
|
9(z): 8(ptr) Variable UniformConstant
|
||||||
|
10: TypeInt 32 1
|
||||||
|
11: TypeVector 10(int) 2
|
||||||
|
12: 10(int) Constant 1
|
||||||
|
13: 11(ivec2) ConstantComposite 12 12
|
||||||
|
14(ssbo): TypeStruct 6(int64_t)
|
||||||
|
15: TypePointer Uniform 14(ssbo)
|
||||||
|
16: 15(ptr) Variable Uniform
|
||||||
|
17: 10(int) Constant 0
|
||||||
|
18: TypePointer Uniform 6(int64_t)
|
||||||
|
21: 10(int) Constant 2048
|
||||||
|
22: TypeInt 32 0
|
||||||
|
23: 22(int) Constant 0
|
||||||
|
24: TypePointer Image 6(int64_t)
|
||||||
|
26: 22(int) Constant 1
|
||||||
|
27: 22(int) Constant 2048
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
19: 18(ptr) AccessChain 16 17
|
||||||
|
20: 6(int64_t) Load 19
|
||||||
|
25: 24(ptr) ImageTexelPointer 9(z) 13 23
|
||||||
|
AtomicStore 25 12 27 20
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
12
Test/spv.imageAtomic64.comp
Normal file
12
Test/spv.imageAtomic64.comp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#version 450
|
||||||
|
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable
|
||||||
|
#extension GL_EXT_shader_image_int64 : enable
|
||||||
|
#extension GL_KHR_memory_scope_semantics : enable
|
||||||
|
|
||||||
|
layout(set = 0, binding = 0) buffer ssbo { uint64_t y; };
|
||||||
|
layout(set = 0, binding = 1, r64ui) uniform u64image2D z;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// Test imageAtomicStore exclusively. Do NOT add other atomic operations to this test.
|
||||||
|
imageAtomicStore(z, ivec2(1, 1), y, gl_ScopeDevice, gl_StorageSemanticsImage, gl_SemanticsRelaxed);
|
||||||
|
}
|
@ -444,6 +444,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
"spv.textureBuffer.vert",
|
"spv.textureBuffer.vert",
|
||||||
"spv.image.frag",
|
"spv.image.frag",
|
||||||
"spv.imageAtomic64.frag",
|
"spv.imageAtomic64.frag",
|
||||||
|
"spv.imageAtomic64.comp",
|
||||||
"spv.types.frag",
|
"spv.types.frag",
|
||||||
"spv.uint.frag",
|
"spv.uint.frag",
|
||||||
"spv.uniformArray.frag",
|
"spv.uniformArray.frag",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user