microsoft / microsoft/DirectX-Graphics-Samples
TAA blend shader redundant barrier
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6.8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
I have found in the implementation of TAA that during the blending process, after completing the Prefetch from the Color buffer, there are two calls to the GroupMemoryBarrierWithGroupSync(). However, there is no write to the groupshared memory after the first call, so the second barrier should be redundant, is that correct?
for (uint i = GI; i < 45; i += 64)
{
uint X = (i % ldsHalfPitch) * 2;
uint Y = (i / ldsHalfPitch) * 2;
uint TopLeftIdx = X + Y * kLdsPitch;
int2 TopLeftST = Gid.xy * uint2(8, 8) - 1 + uint2(X / 2, Y);
float2 UV = RcpBufferDim * (TopLeftST * float2(2, 1) + float2(2, 1));
float4 Depths = CurDepth.Gather(LinearSampler, UV);
ldsDepth[TopLeftIdx + 0] = Depths.w;
ldsDepth[TopLeftIdx + 1] = Depths.z;
ldsDepth[TopLeftIdx + kLdsPitch] = Depths.x;
ldsDepth[TopLeftIdx + 1 + kLdsPitch] = Depths.y;
float4 R4 = InColor.GatherRed(LinearSampler, UV);
float4 G4 = InColor.GatherGreen(LinearSampler, UV);
float4 B4 = InColor.GatherBlue(LinearSampler, UV);
StoreRGB(TopLeftIdx, float3(R4.w, G4.w, B4.w));
StoreRGB(TopLeftIdx + 1, float3(R4.z, G4.z, B4.z));
StoreRGB(TopLeftIdx + kLdsPitch, float3(R4.x, G4.x, B4.x));
StoreRGB(TopLeftIdx + 1 + kLdsPitch, float3(R4.y, G4.y, B4.y));
}
GroupMemoryBarrierWithGroupSync();
uint Idx0 = GTid.x * 2 + GTid.y * kLdsPitch + kLdsPitch + 1;
uint Idx1 = Idx0 + 1;
GroupMemoryBarrierWithGroupSync(); // <- redundant?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the TAA blend shader containing the shown prefetch loop and inspect how the groupshared data is read after the first barrier. Verify the synchronization requirements for GroupMemoryBarrierWithGroupSync and determine whether the second call can be removed without changing behavior; done means the shader remains correct and the redundant barrier question is resolved.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100