microsoft / DirectX-Specs

Engineering specs for DirectX features.

Home Page:https://devblogs.microsoft.com/directx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhanced Barriers: Conflicting Access-Sync compatibility/limitations?

GertyP opened this issue · comments

The enhanced barrier specs says -

D3D12_BARRIER_SYNC_PIXEL_SHADING

Synchronize scope for pixel shader execution.

Access types in this scope are limited to:

    D3D12_BARRIER_ACCESS_CONSTANT_BUFFER
    D3D12_BARRIER_ACCESS_UNORDERED_ACCESS
    D3D12_BARRIER_ACCESS_SHADER_RESOURCE

but elsewhere in the same doc, we also have -

Access Bits Barrier Sync Compatibility

Some Access types require matching Sync. For the following access bits, at least one of the listed sync bits must also be provided in a barrier.

...

D3D12_BARRIER_ACCESS_SHADING_RATE_SOURCE

  D3D12_BARRIER_SYNC_ALL
  D3D12_BARRIER_SYNC_PIXEL_SHADING
  D3D12_BARRIER_SYNC_ALL_SHADING

I may have misread this but this these two sections seem to conflict: _SYNC_PIXEL_SHADING sync scopes can only use access types _CONSTANT_BUFFER, _UNORDERED_ACCESS, and _SHADER_RESOURCE but later, access type _SHADING_RATE_SOURCE can be used with _SYNC_PIXEL_SHADING scope.

Also, in the section that lists Access types in this scope are limited to: for variousD3D12_BARRIER_SYNC_..., D3D12_BARRIER_ACCESS_COMMON is not listed as a valid access type against any of the syncs except D3D12_BARRIER_SYNC_CLEAR_UNORDERED_ACCESS_VIEW.
However, elsewhere we have the following seemingly contradictory statement -

Access Bits Barrier Sync Compatibility

Some Access types require matching Sync. For the following access bits, at least one of the listed sync bits must also be provided in a barrier.

D3D12_BARRIER_ACCESS_COMMON
  Any valid sync bits

Have I missed or misunderstood some key bit of information (if so, what?) or could these seemingly conflicting statements be avoided/clarified by adding D3D12_BARRIER_ACCESS_COMMON under every D3D12_BARRIER_SYNC_... Access types in this scope are limited to: ... section and also by adding D3D12_BARRIER_ACCESS_SHADING_RATE_SOURCE to -

D3D12_BARRIER_SYNC_PIXEL_SHADING

Synchronize scope for pixel shader execution.

Access types in this scope are limited to:

    D3D12_BARRIER_ACCESS_CONSTANT_BUFFER
    D3D12_BARRIER_ACCESS_UNORDERED_ACCESS
    D3D12_BARRIER_ACCESS_SHADER_RESOURCE

?

@GertyP, you are correct that D3D12_BARRIER_ACCESS_SHADING_RATE_SOURCE needs to be included in the list of access bits compatible with D3D12_BARRIER_SYNC_PIXEL_SHADING. Fortunately, this appears to be handled correctly in our API validation. I will update the spec to include ACCESS_SHADING_RATE_SOURCE bit.

Regarding the section that discusses "Access Bits Barrier Sync Compatibility", that section is discussing actual non-zero access bits. D3D12_BARRIER_ACCESS_COMMON is defined as 0x0. The point of ACCESS_COMMON is that it is always compatible with any layout or sync. Apologies if that isn't clear in the spec. I will revisit this section to see if there is a way to help clear up that distinction.

Thanks for both clarifications.