D3D12XBOX_GDS_OPERATION Enumeration

Specifies operations for ReadGDSX and WriteGDSX.

Syntax

typedef enum D3D12XBOX_GDS_OPERATION
{
    D3D12XBOX_GDS_OPERATION_DEFAULT = 0,
    D3D12XBOX_GDS_OPERATION_READ_AT_EOS = 1,
    D3D12XBOX_GDS_OPERATION_READ_AT_TOP = 2,
    D3D12XBOX_GDS_OPERATION_WRITE_COPY_DATA_TO_CB = 3,
    D3D12XBOX_GDS_OPERATION_WRITE_USE_DATA_BY_POINTER = 4,
    D3D12XBOX_GDS_OPERATION_COMPUTE = 8
} D3D12XBOX_GDS_OPERATION;  

Constants

Constant Description
D3D12XBOX_GDS_OPERATION_DEFAULT Reads are D3D12XBOX_GDS_OPERATION_READ_PIPELINED_AT_EOS. Writes are always at top of pipe with a copy; insert synchronization as needed. Indicates to use the default, which is D3D12XBOX_GDS_OPERATION_READ_AT_EOS for ID3D12GraphicsCommandList::ReadGDSX, and D3D12XBOX_GDS_OPERATION_WRITE_COPY_DATA_TO_CB for ID3D12GraphicsCommandList::WriteGDSX. These settings most closely represent the default DirectX 12 behavior of SetUAV and (for D3D11) ID3D11DeviceContext::CopyStructureCount.
D3D12XBOX_GDS_OPERATION_READ_AT_EOS Read Global Data Share (GDS) contents at end of shader, pipelined with rendering. Fences or WaitUntilIdle might be needed, to ensure that the read reached memory. A read of GDS will be pipelined and will occur at the end of shader (EOS). If any read access to the written GDS data is needed by the GPU shortly, InsertFence and InsertWaitOnFence (or [for D3D11] ID3D11DeviceContextX::InsertWaitUntilIdle for async compute contexts) need to be called to block the Command Processor (CP) until the EOS write is completed. If the counters are to be read via the L2 cache (TCC), then a cache flush is going to be required. If the counters are to be via the CP, then no cache flush is required. If the written GDS data is used on the GPU far enough from where it’s written, then no synchronization is needed except a potential cache flush.
D3D12XBOX_GDS_OPERATION_READ_AT_TOP Read GDS at the top of pipe. Indicates that a non-pipelined read of GDS will be performed by the CP at the top of the pipe (TOP). This means that if there are any shaders in flight that modify GDS (for example, through UAV counters), the results of the read may be unexpected, because they will be a snapshot of a current state of GDS during shader execution. If there are no shaders in flight that use GDS, the results will be the same as in the EOS case. The same GPU write-read considerations apply as in the D3D12XBOX_GDS_OPERATION_READ_AT_EOS.
D3D12XBOX_GDS_OPERATION_WRITE_COPY_DATA_TO_CB Write GDS at the top of pipe, but first copy the counter data to CB. Indicates that a GDS write can only be performed from a shader or from the CP, so ID3D12GraphicsCommandList::WriteGDSX performs writes at TOP. When a copy is asked for, the provided counter data is copied into the command buffer, and the source pointer can be discarded. The pointer doesn’t have to point to GPU mapped memory. This essentially performs a CPU->GDS copy.
D3D12XBOX_GDS_OPERATION_WRITE_USE_DATA_BY_POINTER Write GDS at the top of pipe, but the pointer is used, so its lifetime and hazards must be tracked by the title. Indicates that a GDS write can only be performed from a shader or from the CP, so ID3D12GraphicsCommandList::WriteGDSX performs writes at TOP. When a copy-by-pointer is asked for, the provided counter data is used by the GPU when the packet gets to execute, which means the title needs to track hazards and the lifetime of the pCounterValues pointer, and the pCounterValue must be in the GPU mapped memory, otherwise a GPU crash is likely. This type of copy is more suitable for GPU->GPU GDS.
D3D12XBOX_GDS_OPERATION_COMPUTE For end-of-shader (EOS) operations, specifies whether it is EOS compute or EOS graphics. Indicates that the packet is related to compute (rather than graphics), such as to distinguish between the end-of-shaders (EOSes).

Remarks

This enumeration is passed into the following methods:

Requirements

Header: Declared in d3d12_x.h.

See also

D3D11X_GDS_OPERATION_FLAGS