diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-04 18:50:48 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-04 18:50:48 -0800 |
| commit | d89331f1636f8d53a3c8e9d0f7bfcf7a6041b88a (patch) | |
| tree | d35cd39cf534d0d7ce4e4a817e2bc52036471c67 /dxg | |
| parent | 6c8ae19be66cee247980a48e736a4e05d14de179 (diff) | |
Diffstat (limited to 'dxg')
| -rw-r--r-- | dxg/include/dxg/dxcommon.h | 2 | ||||
| -rw-r--r-- | dxg/include/dxg/imm.h | 2 | ||||
| -rw-r--r-- | dxg/src/imm.c | 8 |
3 files changed, 5 insertions, 7 deletions
diff --git a/dxg/include/dxg/dxcommon.h b/dxg/include/dxg/dxcommon.h index 96cf3a5..6cc3466 100644 --- a/dxg/include/dxg/dxcommon.h +++ b/dxg/include/dxg/dxcommon.h | |||
| @@ -43,6 +43,8 @@ static inline free_aligned(alloc_t* alloc) { | |||
| 43 | #define FREE(ALLOC) free_aligned(&(ALLOC)) | 43 | #define FREE(ALLOC) free_aligned(&(ALLOC)) |
| 44 | 44 | ||
| 45 | #ifndef NDEBUG | 45 | #ifndef NDEBUG |
| 46 | #define WIN32_LEAN_AND_MEAN | ||
| 47 | #include <Windows.h> // OutputDebugStringA | ||
| 46 | #define DEBUG_PRINT OutputDebugStringA | 48 | #define DEBUG_PRINT OutputDebugStringA |
| 47 | #else | 49 | #else |
| 48 | #define DEBUG_PRINT | 50 | #define DEBUG_PRINT |
diff --git a/dxg/include/dxg/imm.h b/dxg/include/dxg/imm.h index fdee725..831c1b8 100644 --- a/dxg/include/dxg/imm.h +++ b/dxg/include/dxg/imm.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | typedef struct DxgImm DxgImm; | 7 | typedef struct DxgImm DxgImm; |
| 8 | 8 | ||
| 9 | DxgImm* dxg_imm_init(ID3D12Device* pDevice, ID3D12CommandQueue*, DXGI_FORMAT swapChainRtvFormat, DXGI_SAMPLE_DESC swapChainSampleDesc, size_t bufferSizeVerts); | 9 | DxgImm* dxg_imm_init(ID3D12Device* pDevice, ID3D12CommandQueue*, DXGI_FORMAT swapChainRtvFormat, DXGI_SAMPLE_DESC swapChainSampleDesc, size_t bufferSize); |
| 10 | void dxg_imm_destroy(DxgImm**); | 10 | void dxg_imm_destroy(DxgImm**); |
| 11 | void dxg_imm_set_graphics_state(DxgImm*, const D3D12_VIEWPORT*, D3D12_CPU_DESCRIPTOR_HANDLE hBackBufferView, D3D12_CPU_DESCRIPTOR_HANDLE hDepthStencilView); | 11 | void dxg_imm_set_graphics_state(DxgImm*, const D3D12_VIEWPORT*, D3D12_CPU_DESCRIPTOR_HANDLE hBackBufferView, D3D12_CPU_DESCRIPTOR_HANDLE hDepthStencilView); |
| 12 | void dxg_imm_flush(DxgImm*); | 12 | void dxg_imm_flush(DxgImm*); |
diff --git a/dxg/src/imm.c b/dxg/src/imm.c index 28baa99..4a4be93 100644 --- a/dxg/src/imm.c +++ b/dxg/src/imm.c | |||
| @@ -18,9 +18,6 @@ ping-ponging between the two buffers.*/ | |||
| 18 | #include <imm_vs.h> // generated | 18 | #include <imm_vs.h> // generated |
| 19 | #include <imm_ps.h> // generated | 19 | #include <imm_ps.h> // generated |
| 20 | 20 | ||
| 21 | #define WIN32_LEAN_AND_MEAN | ||
| 22 | #include <Windows.h> // OutputDebugStringA | ||
| 23 | |||
| 24 | #include <stdint.h> | 21 | #include <stdint.h> |
| 25 | #include <stdlib.h> | 22 | #include <stdlib.h> |
| 26 | 23 | ||
| @@ -181,7 +178,7 @@ static void dxg_imm_draw(DxgImm* imm) { | |||
| 181 | pCmdQueue->lpVtbl->ExecuteCommandLists(pCmdQueue, 1, cmdLists); | 178 | pCmdQueue->lpVtbl->ExecuteCommandLists(pCmdQueue, 1, cmdLists); |
| 182 | } | 179 | } |
| 183 | 180 | ||
| 184 | DxgImm* dxg_imm_init(ID3D12Device* pDevice, ID3D12CommandQueue* pCmdQueue, DXGI_FORMAT swapChainRtvFormat, DXGI_SAMPLE_DESC swapChainSampleDesc, size_t bufferSizeVerts) { | 181 | DxgImm* dxg_imm_init(ID3D12Device* pDevice, ID3D12CommandQueue* pCmdQueue, DXGI_FORMAT swapChainRtvFormat, DXGI_SAMPLE_DESC swapChainSampleDesc, size_t bufferSize) { |
| 185 | assert(pDevice); | 182 | assert(pDevice); |
| 186 | assert(pCmdQueue); | 183 | assert(pCmdQueue); |
| 187 | 184 | ||
| @@ -192,7 +189,7 @@ DxgImm* dxg_imm_init(ID3D12Device* pDevice, ID3D12CommandQueue* pCmdQueue, DXGI_ | |||
| 192 | 189 | ||
| 193 | imm->pDevice = pDevice; | 190 | imm->pDevice = pDevice; |
| 194 | imm->pCmdQueue = pCmdQueue; | 191 | imm->pCmdQueue = pCmdQueue; |
| 195 | imm->bufferSizeVerts = bufferSizeVerts; | 192 | imm->bufferSizeVerts = bufferSize / 3 / sizeof(float); |
| 196 | imm->fenceValue = 0; | 193 | imm->fenceValue = 0; |
| 197 | 194 | ||
| 198 | // TODO: Move this to the application side. | 195 | // TODO: Move this to the application side. |
| @@ -271,7 +268,6 @@ DxgImm* dxg_imm_init(ID3D12Device* pDevice, ID3D12CommandQueue* pCmdQueue, DXGI_ | |||
| 271 | TrapIfFailed(imm->pDevice->lpVtbl->CreateGraphicsPipelineState( | 268 | TrapIfFailed(imm->pDevice->lpVtbl->CreateGraphicsPipelineState( |
| 272 | imm->pDevice, &gpso, &IID_ID3D12PipelineState, &imm->pPipelineState)); | 269 | imm->pDevice, &gpso, &IID_ID3D12PipelineState, &imm->pPipelineState)); |
| 273 | 270 | ||
| 274 | const size_t bufferSize = verts_byte_count(bufferSizeVerts); | ||
| 275 | for (int i = 0; i < 2; ++i) { | 271 | for (int i = 0; i < 2; ++i) { |
| 276 | imm->resources[i].pVertexBuffer = create_buffer(pDevice, bufferSize); | 272 | imm->resources[i].pVertexBuffer = create_buffer(pDevice, bufferSize); |
| 277 | if (!imm->resources[i].pVertexBuffer) { | 273 | if (!imm->resources[i].pVertexBuffer) { |
