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();
|
||||
memoryBarrierBuffer();
|
||||
groupMemoryBarrier();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
memoryBarrier();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
memoryBarrierImage();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
memoryBarrierBuffer();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
groupMemoryBarrier();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ shared float sShared[4];
|
||||
void main()
|
||||
{
|
||||
sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x];
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
_44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex];
|
||||
}
|
||||
|
@ -28,41 +28,35 @@ void group_barrier()
|
||||
|
||||
void barrier_shared_exec()
|
||||
{
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
}
|
||||
|
||||
void full_barrier_exec()
|
||||
{
|
||||
memoryBarrier();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
}
|
||||
|
||||
void image_barrier_exec()
|
||||
{
|
||||
memoryBarrierImage();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
}
|
||||
|
||||
void buffer_barrier_exec()
|
||||
{
|
||||
memoryBarrierBuffer();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
}
|
||||
|
||||
void group_barrier_exec()
|
||||
{
|
||||
groupMemoryBarrier();
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
}
|
||||
|
||||
void exec_barrier()
|
||||
{
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ void main()
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
float idata = _22.in_data[ident];
|
||||
sShared[gl_LocalInvocationIndex] = idata;
|
||||
memoryBarrierShared();
|
||||
barrier();
|
||||
_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 (semantics == MemorySemanticsWorkgroupMemoryMask)
|
||||
statement("memoryBarrierShared();");
|
||||
{
|
||||
// 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();");
|
||||
}
|
||||
else if (semantics != 0)
|
||||
statement("groupMemoryBarrier();");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user