HydraHook
Direct3D and Core Audio hooking library for Windows
Loading...
Searching...
No Matches
HydraHookDirect3D12.h
Go to the documentation of this file.
1
14
15/*
16MIT License
17
18Copyright (c) 2018-2026 Benjamin Höglinger-Stelzer
19
20Permission is hereby granted, free of charge, to any person obtaining a copy
21of this software and associated documentation files (the "Software"), to deal
22in the Software without restriction, including without limitation the rights
23to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24copies of the Software, and to permit persons to whom the Software is
25furnished to do so, subject to the following conditions:
26
27The above copyright notice and this permission notice shall be included in all
28copies or substantial portions of the Software.
29
30THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36SOFTWARE.
37*/
38
39
40#ifndef HydraHookDirect3D12_h__
41#define HydraHookDirect3D12_h__
42
43#ifndef HYDRAHOOK_NO_D3D12
44
45#include "HydraHookCore.h"
46#include <dxgi.h>
47#include <d3d12.h>
48
49
51typedef
52_Function_class_(EVT_HYDRAHOOK_D3D12_PRE_PRESENT)
53VOID
55 IDXGISwapChain *pSwapChain,
56 UINT SyncInterval,
57 UINT Flags,
58 PHYDRAHOOK_EVT_PRE_EXTENSION Extension
59);
60
62
64typedef
66VOID
68 IDXGISwapChain *pSwapChain,
69 UINT SyncInterval,
70 UINT Flags,
71 PHYDRAHOOK_EVT_POST_EXTENSION Extension
72);
73
75
77typedef
79VOID
81 IDXGISwapChain *pSwapChain,
82 const DXGI_MODE_DESC *pNewTargetParameters,
83 PHYDRAHOOK_EVT_PRE_EXTENSION Extension
84);
85
87
89typedef
91VOID
93 IDXGISwapChain *pSwapChain,
94 const DXGI_MODE_DESC *pNewTargetParameters,
95 PHYDRAHOOK_EVT_POST_EXTENSION Extension
96);
97
99
101typedef
103VOID
105 IDXGISwapChain *pSwapChain,
106 UINT BufferCount,
107 UINT Width,
108 UINT Height,
109 DXGI_FORMAT NewFormat,
110 UINT SwapChainFlags,
111 PHYDRAHOOK_EVT_PRE_EXTENSION Extension
112);
113
115
117typedef
119VOID
121 IDXGISwapChain *pSwapChain,
122 UINT BufferCount,
123 UINT Width,
124 UINT Height,
125 DXGI_FORMAT NewFormat,
126 UINT SwapChainFlags,
127 PHYDRAHOOK_EVT_POST_EXTENSION Extension
128);
129
131
138HRESULT
139FORCEINLINE
141 IDXGISwapChain *pSwapChain,
142 ID3D12Device **ppDevice
143)
144{
145 return pSwapChain->GetDevice(__uuidof(ID3D12Device), (PVOID*)ppDevice);
146}
147
155HRESULT
156FORCEINLINE
158 IDXGISwapChain *pSwapChain,
159 ID3D12Resource **ppBackBuffer,
160 UINT uBuffer = 0
161)
162{
163 return pSwapChain->GetBuffer(uBuffer, __uuidof(ID3D12Resource), (PVOID*)ppBackBuffer);
164}
165
181
189)
190{
191 ZeroMemory(Callbacks, sizeof(HYDRAHOOK_D3D12_EVENT_CALLBACKS));
192}
193
194#ifdef __cplusplus
195extern "C" {
196#endif
197
204 _In_ PHYDRAHOOK_ENGINE Engine,
206);
207
220 _In_ IDXGISwapChain* pSwapChain
221);
222
233 _In_ IDXGISwapChain* pSwapChain
234);
235
245 _In_ PHYDRAHOOK_EVT_PRE_EXTENSION Extension
246);
247
248#ifdef __cplusplus
249}
250#endif
251
252#endif
253
254#endif // HydraHookDirect3D12_h__
IDXGISwapChain vtable indices for D3D10/11/12 hooking.
Core engine API for HydraHook - Direct3D and Core Audio hooking library.
struct _HYDRAHOOK_D3D12_EVENT_CALLBACKS * PHYDRAHOOK_D3D12_EVENT_CALLBACKS
#define HYDRAHOOK_API
struct _HYDRAHOOK_ENGINE * PHYDRAHOOK_ENGINE
Opaque handle to the HydraHook engine instance.
HRESULT D3D12_DEVICE_FROM_SWAPCHAIN(IDXGISwapChain *pSwapChain, ID3D12Device **ppDevice)
EVT_HYDRAHOOK_D3D12_POST_RESIZE_BUFFERS * PFN_HYDRAHOOK_D3D12_POST_RESIZE_BUFFERS
EVT_HYDRAHOOK_D3D12_PRE_RESIZE_TARGET * PFN_HYDRAHOOK_D3D12_PRE_RESIZE_TARGET
VOID HydraHookEngineSetD3D12EventCallbacks(_In_ PHYDRAHOOK_ENGINE Engine, _In_ PHYDRAHOOK_D3D12_EVENT_CALLBACKS Callbacks)
Registers Direct3D 12 render pipeline callbacks.
VOID EVT_HYDRAHOOK_D3D12_POST_PRESENT(IDXGISwapChain *pSwapChain, UINT SyncInterval, UINT Flags, PHYDRAHOOK_EVT_POST_EXTENSION Extension)
Post-Present callback; receives extension with engine handle.
VOID HYDRAHOOK_D3D12_EVENT_CALLBACKS_INIT(_Out_ PHYDRAHOOK_D3D12_EVENT_CALLBACKS Callbacks)
VOID EVT_HYDRAHOOK_D3D12_POST_RESIZE_TARGET(IDXGISwapChain *pSwapChain, const DXGI_MODE_DESC *pNewTargetParameters, PHYDRAHOOK_EVT_POST_EXTENSION Extension)
Post-ResizeTarget callback.
HRESULT D3D12_BACKBUFFER_FROM_SWAPCHAIN(IDXGISwapChain *pSwapChain, ID3D12Resource **ppBackBuffer, UINT uBuffer=0)
Retrieves back buffer resource from swap chain.
VOID EVT_HYDRAHOOK_D3D12_POST_RESIZE_BUFFERS(IDXGISwapChain *pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags, PHYDRAHOOK_EVT_POST_EXTENSION Extension)
Post-ResizeBuffers callback.
VOID EVT_HYDRAHOOK_D3D12_PRE_PRESENT(IDXGISwapChain *pSwapChain, UINT SyncInterval, UINT Flags, PHYDRAHOOK_EVT_PRE_EXTENSION Extension)
Pre-Present callback; receives extension with engine handle.
EVT_HYDRAHOOK_D3D12_PRE_RESIZE_BUFFERS * PFN_HYDRAHOOK_D3D12_PRE_RESIZE_BUFFERS
ID3D12CommandQueue * HydraHookEngineGetD3D12CommandQueue(_In_ IDXGISwapChain *pSwapChain)
Returns the D3D12 command queue for a swap chain (for overlay rendering). Exact associations are reco...
VOID EVT_HYDRAHOOK_D3D12_PRE_RESIZE_TARGET(IDXGISwapChain *pSwapChain, const DXGI_MODE_DESC *pNewTargetParameters, PHYDRAHOOK_EVT_PRE_EXTENSION Extension)
Pre-ResizeTarget callback.
VOID EVT_HYDRAHOOK_D3D12_PRE_RESIZE_BUFFERS(IDXGISwapChain *pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags, PHYDRAHOOK_EVT_PRE_EXTENSION Extension)
Pre-ResizeBuffers callback.
EVT_HYDRAHOOK_D3D12_POST_RESIZE_TARGET * PFN_HYDRAHOOK_D3D12_POST_RESIZE_TARGET
EVT_HYDRAHOOK_D3D12_POST_PRESENT * PFN_HYDRAHOOK_D3D12_POST_PRESENT
EVT_HYDRAHOOK_D3D12_PRE_PRESENT * PFN_HYDRAHOOK_D3D12_PRE_PRESENT
BOOL HydraHookEngineDeferD3D12Resize(_In_ PHYDRAHOOK_EVT_PRE_EXTENSION Extension)
Defers the active D3D12 ResizeBuffers or ResizeBuffers1 call.
ID3D12CommandQueue * HydraHookEngineGetVerifiedD3D12CommandQueue(_In_ IDXGISwapChain *pSwapChain)
Returns the verified direct queue for the current D3D12 back buffer.
Direct3D 12 event callback collection.
PFN_HYDRAHOOK_D3D12_POST_RESIZE_TARGET EvtHydraHookD3D12PostResizeTarget
PFN_HYDRAHOOK_D3D12_PRE_RESIZE_BUFFERS EvtHydraHookD3D12PreResizeBuffers
PFN_HYDRAHOOK_D3D12_POST_RESIZE_BUFFERS EvtHydraHookD3D12PostResizeBuffers
PFN_HYDRAHOOK_D3D12_PRE_RESIZE_TARGET EvtHydraHookD3D12PreResizeTarget
PFN_HYDRAHOOK_D3D12_PRE_PRESENT EvtHydraHookD3D12PrePresent
PFN_HYDRAHOOK_D3D12_POST_PRESENT EvtHydraHookD3D12PostPresent