Don't emit memoryBarrierShared() in workgroup control barriers.
This is implied in both GL and GLES. Emitting memoryBarrierShared() was based on earlier confusion in the spec which has since been fixed and clarified.
This commit is contained in:
parent
faa34631cb
commit
67b2991451
@ -8,21 +8,15 @@ void main()
|
|||||||
memoryBarrierImage();
|
memoryBarrierImage();
|
||||||
memoryBarrierBuffer();
|
memoryBarrierBuffer();
|
||||||
groupMemoryBarrier();
|
groupMemoryBarrier();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
memoryBarrier();
|
memoryBarrier();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
memoryBarrierImage();
|
memoryBarrierImage();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
memoryBarrierBuffer();
|
memoryBarrierBuffer();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
groupMemoryBarrier();
|
groupMemoryBarrier();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ shared float sShared[4];
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x];
|
sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x];
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
_44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex];
|
_44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex];
|
||||||
}
|
}
|
||||||
|
@ -28,41 +28,35 @@ void group_barrier()
|
|||||||
|
|
||||||
void barrier_shared_exec()
|
void barrier_shared_exec()
|
||||||
{
|
{
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
void full_barrier_exec()
|
void full_barrier_exec()
|
||||||
{
|
{
|
||||||
memoryBarrier();
|
memoryBarrier();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
void image_barrier_exec()
|
void image_barrier_exec()
|
||||||
{
|
{
|
||||||
memoryBarrierImage();
|
memoryBarrierImage();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_barrier_exec()
|
void buffer_barrier_exec()
|
||||||
{
|
{
|
||||||
memoryBarrierBuffer();
|
memoryBarrierBuffer();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
void group_barrier_exec()
|
void group_barrier_exec()
|
||||||
{
|
{
|
||||||
groupMemoryBarrier();
|
groupMemoryBarrier();
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
void exec_barrier()
|
void exec_barrier()
|
||||||
{
|
{
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ void main()
|
|||||||
uint ident = gl_GlobalInvocationID.x;
|
uint ident = gl_GlobalInvocationID.x;
|
||||||
float idata = _22.in_data[ident];
|
float idata = _22.in_data[ident];
|
||||||
sShared[gl_LocalInvocationIndex] = idata;
|
sShared[gl_LocalInvocationIndex] = idata;
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
barrier();
|
||||||
_44.out_data[ident] = sShared[(4u - gl_LocalInvocationIndex) - 1u];
|
_44.out_data[ident] = sShared[(4u - gl_LocalInvocationIndex) - 1u];
|
||||||
}
|
}
|
||||||
|
@ -9892,7 +9892,12 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
|
|||||||
if (memory == ScopeWorkgroup) // Only need to consider memory within a group
|
if (memory == ScopeWorkgroup) // Only need to consider memory within a group
|
||||||
{
|
{
|
||||||
if (semantics == MemorySemanticsWorkgroupMemoryMask)
|
if (semantics == MemorySemanticsWorkgroupMemoryMask)
|
||||||
|
{
|
||||||
|
// OpControlBarrier implies a memory barrier for shared memory as well.
|
||||||
|
bool implies_shared_barrier = opcode == OpControlBarrier && execution_scope == ScopeWorkgroup;
|
||||||
|
if (!implies_shared_barrier)
|
||||||
statement("memoryBarrierShared();");
|
statement("memoryBarrierShared();");
|
||||||
|
}
|
||||||
else if (semantics != 0)
|
else if (semantics != 0)
|
||||||
statement("groupMemoryBarrier();");
|
statement("groupMemoryBarrier();");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user