From c29105b461135f3909cca0308fb05715cee45763 Mon Sep 17 00:00:00 2001 From: Quentin LADEVIE Date: Sun, 26 Jan 2025 22:27:10 +0100 Subject: DX12 command buffers and resources --- include/api-test/dx12-device-types.hpp | 47 +++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'include/api-test/dx12-device-types.hpp') diff --git a/include/api-test/dx12-device-types.hpp b/include/api-test/dx12-device-types.hpp index b70ecf4..4b2fc42 100644 --- a/include/api-test/dx12-device-types.hpp +++ b/include/api-test/dx12-device-types.hpp @@ -1,5 +1,9 @@ +#pragma once +#include +#include +#include + #include -#include namespace dx12 { enum class QueueType : uint32_t { @@ -9,17 +13,54 @@ namespace dx12 { MAX, }; + struct buffer_desc { + uint32_t size; + bool map; + + D3D12_RESOURCE_STATES states; + D3D12_RESOURCE_FLAGS usages; + D3D12_HEAP_TYPE heap_type = D3D12_HEAP_TYPE_DEFAULT; + }; + + struct device_buffer { + ID3D12Resource* resource; + + D3D12MA::Allocation* alloc; + uint32_t size; + void* mapped_ptr = nullptr; + }; + + struct texture_desc { + uint32_t width = 1U; + uint32_t height = 1U; + uint32_t depth = 1U; + uint32_t mips = 1U; + + D3D12_RESOURCE_STATES states; + D3D12_RESOURCE_FLAGS usages; + DXGI_FORMAT format; + D3D12_RESOURCE_DIMENSION type; }; struct device_texture { + ID3D12Resource* resource; + D3D12MA::Allocation* alloc; + + uint32_t width = 1U; + uint32_t height = 1U; + uint32_t depth = 1U; + uint32_t mips = 1U; + uint64_t row_pitch = 1U; + + DXGI_FORMAT format; + }; struct surface_desc { HWND window_handle; DXGI_FORMAT surface_format; DXGI_SWAP_EFFECT present_mode; - // VkImageUsageFlags usages; DXGI_USAGE usages; uint32_t image_count = surface_desc::default_image_count; @@ -28,6 +69,6 @@ namespace dx12 { }; struct device_surface { - IDXGISwapChain* swapchain; + IDXGISwapChain1* swapchain; }; } -- cgit v1.3