|
HydraHook
Direct3D and Core Audio hooking library for Windows
|
Nonblocking D3D12 swap-chain frame readback. More...
Go to the source code of this file.
Classes | |
| struct | HYDRAHOOK_D3D12_READBACK_FRAME |
| CPU-owned frame. Initialize to zero before polling. More... | |
Functions | |
| HRESULT | HydraHookD3D12ReadbackCreate (_In_ ID3D12CommandQueue *Queue, _In_ const D3D12_RESOURCE_DESC *SourceDesc, _Outptr_result_maybenull_ PHYDRAHOOK_D3D12_READBACK *Readback) |
| Allocates readback buffers on a single-node D3D12 device. | |
| HRESULT | HydraHookD3D12ReadbackCreateRegion (_In_ ID3D12CommandQueue *Queue, _In_ const D3D12_RESOURCE_DESC *SourceDesc, _In_ const RECT *SourceRect, _Outptr_result_maybenull_ PHYDRAHOOK_D3D12_READBACK *Readback) |
| Allocates readback buffers for a rectangle of the source buffer. | |
| HRESULT | HydraHookD3D12ReadbackTrySubmit (_In_ PHYDRAHOOK_D3D12_READBACK Readback, _In_ ID3D12Resource *Source, _In_ ID3D12CommandQueue *CurrentQueue) |
| Submits a copy of the current back buffer without waiting for the GPU. | |
| HRESULT | HydraHookD3D12ReadbackTryReadLatest (_In_ PHYDRAHOOK_D3D12_READBACK Readback, _Inout_ HYDRAHOOK_D3D12_READBACK_FRAME *Frame) |
| Copies the newest completed frame to CPU-owned memory on a consumer thread. | |
| void | HydraHookD3D12ReadbackReleaseFrame (_Inout_ HYDRAHOOK_D3D12_READBACK_FRAME *Frame) |
| Releases a frame returned by HydraHookD3D12ReadbackTryReadLatest and zeros it. | |
| HRESULT | HydraHookD3D12ReadbackDestroy (_Inout_ PHYDRAHOOK_D3D12_READBACK *Readback, _In_ DWORD TimeoutMs) |
| Drains outstanding copies and destroys the session before resize or unload. | |
Nonblocking D3D12 swap-chain frame readback.
Definition in file HydraHookD3D12Readback.h.
| HRESULT HydraHookD3D12ReadbackCreate | ( | _In_ ID3D12CommandQueue * | Queue, |
| _In_ const D3D12_RESOURCE_DESC * | SourceDesc, | ||
| _Outptr_result_maybenull_ PHYDRAHOOK_D3D12_READBACK * | Readback ) |
Allocates readback buffers on a single-node D3D12 device.
Call outside the Present hot path. Supported formats are RGBA8, BGRA8, RGB10A2, and RGBA16 float.
| Queue | Direct queue to which this session is bound. |
| SourceDesc | Description of the source buffer, copied during creation. |
| Readback | Receives the new session or NULL on failure. |
References HYDRAHOOK_API, and HydraHookD3D12ReadbackCreate().
Referenced by HydraHookD3D12ReadbackCreate(), and HydraHookD3D12ReadbackCreate().
| HRESULT HydraHookD3D12ReadbackCreateRegion | ( | _In_ ID3D12CommandQueue * | Queue, |
| _In_ const D3D12_RESOURCE_DESC * | SourceDesc, | ||
| _In_ const RECT * | SourceRect, | ||
| _Outptr_result_maybenull_ PHYDRAHOOK_D3D12_READBACK * | Readback ) |
Allocates readback buffers for a rectangle of the source buffer.
SourceRect uses source pixel coordinates, with an exclusive right and bottom. It must be nonempty and fit inside SourceDesc. TrySubmit still receives the entire source buffer and the actual queue. TryReadLatest returns tightly packed rows for just the rectangle. The caller supplies the origin when interpreting pixels.
| Queue | Direct queue to which this session is bound. |
| SourceDesc | Description of the full source buffer. |
| SourceRect | Nonempty source rectangle, copied during creation. |
| Readback | Receives the new session or NULL on failure. |
References HYDRAHOOK_API, and HydraHookD3D12ReadbackCreateRegion().
Referenced by HydraHookD3D12ReadbackCreateRegion(), and HydraHookD3D12ReadbackCreateRegion().
| HRESULT HydraHookD3D12ReadbackDestroy | ( | _Inout_ PHYDRAHOOK_D3D12_READBACK * | Readback, |
| _In_ DWORD | TimeoutMs ) |
Drains outstanding copies and destroys the session before resize or unload.
Quiesce both submit and poll before calling. Use a zero timeout to poll for completion or retry from a worker with a bounded timeout. Never call under the loader lock. On failure the handle remains valid for another drain attempt. A NULL session is a no-op. On success the handle is set to NULL.
References HYDRAHOOK_API, and HydraHookD3D12ReadbackDestroy().
Referenced by HydraHookD3D12ReadbackDestroy(), and HydraHookD3D12ReadbackDestroy().
| void HydraHookD3D12ReadbackReleaseFrame | ( | _Inout_ HYDRAHOOK_D3D12_READBACK_FRAME * | Frame | ) |
Releases a frame returned by HydraHookD3D12ReadbackTryReadLatest and zeros it.
References HYDRAHOOK_API, and HydraHookD3D12ReadbackReleaseFrame().
Referenced by HydraHookD3D12ReadbackReleaseFrame(), and HydraHookD3D12ReadbackReleaseFrame().
| HRESULT HydraHookD3D12ReadbackTryReadLatest | ( | _In_ PHYDRAHOOK_D3D12_READBACK | Readback, |
| _Inout_ HYDRAHOOK_D3D12_READBACK_FRAME * | Frame ) |
Copies the newest completed frame to CPU-owned memory on a consumer thread.
Older completed frames are discarded. S_FALSE leaves Frame unchanged when no result is ready or the session is busy. Release a prior frame before polling. A returned frame may outlive the readback session.
References HYDRAHOOK_API, and HydraHookD3D12ReadbackTryReadLatest().
Referenced by HydraHookD3D12ReadbackTryReadLatest(), and HydraHookD3D12ReadbackTryReadLatest().
| HRESULT HydraHookD3D12ReadbackTrySubmit | ( | _In_ PHYDRAHOOK_D3D12_READBACK | Readback, |
| _In_ ID3D12Resource * | Source, | ||
| _In_ ID3D12CommandQueue * | CurrentQueue ) |
Submits a copy of the current back buffer without waiting for the GPU.
Call before drawing overlays, with the buffer in PRESENT state. Supply the actual current buffer's queue, for example from the verified queue accessor. Source must match the session description and device. The session retains each submitted buffer until its GPU copy completes. Older completed ring slots may be reused on the next submit; the newest completed frame stays readable until the worker polls. It does not retain a swap chain. S_FALSE means the queue differs or the readback is busy. The caller controls capture cadence. Do not call for DXGI_PRESENT_TEST.
References HYDRAHOOK_API, and HydraHookD3D12ReadbackTrySubmit().
Referenced by HydraHookD3D12ReadbackTrySubmit(), and HydraHookD3D12ReadbackTrySubmit().