LukasBanana / XShaderCompiler

Shader cross compiler to translate HLSL (Shader Model 4 and 5) to GLSL
BSD 3-Clause "New" or "Revised" License
352 stars 48 forks source link

Translation of "GroupMemoryBarrierWithGroupSync" Intrinsic #70

Open LukasBanana opened 7 years ago

LukasBanana commented 7 years ago

@BearishSun Glslang seems to translate the GroupMemoryBarrierWithGroupSync intrinsic into this:

memoryBarrierShared();
barrier();

But your proposal for the wrapper function translate it into this:

groupMemoryBarrier();
barrier();

Do you know which of the two approaches are wrong?

Greetings, Lukas

BearishSun commented 7 years ago

I went by with what the spec says:

GroupMemoryBarrierWithGroupSync:

groupMemoryBarrier:

memoryBarrierShared:

In GroupMemoryBarrierWithGroupSync there is no mention of shared variables, and instead they refer to all accesses (including shared variables, as well as any other), which to me seems like is equivalent to what groupMemoryBarrier is doing.

Whether I'm interpreting it correctly, I don't know.

LukasBanana commented 7 years ago

Thanks for the quick reply. I'm preparing a couple of compilation results for my thesis. It looks like XShaderCompiler, glslang/SPIRV-CRoss, and fxc/HLSLCrossCompiler produce different variants for this intrinsic:

Maybe all are valid. But I'm uncertain about this :-/