aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/api-test/dx12-device-types.hpp26
-rw-r--r--include/api-test/dx12-device.hpp14
-rw-r--r--include/api-test/freelist.hpp1
3 files changed, 37 insertions, 4 deletions
diff --git a/include/api-test/dx12-device-types.hpp b/include/api-test/dx12-device-types.hpp
new file mode 100644
index 0000000..dee1811
--- /dev/null
+++ b/include/api-test/dx12-device-types.hpp
@@ -0,0 +1,26 @@
+#include <cstdint>
+#include <dxgi.h>
+
+namespace dx12 {
+ struct texture_desc {
+ };
+
+ struct device_texture {
+ };
+
+ 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;
+
+ static constexpr uint32_t max_image_count = 3U;
+ static constexpr uint32_t default_image_count = 3U;
+ };
+
+ struct device_surface {
+ IDXGISwapChain* swapchain;
+ };
+}
diff --git a/include/api-test/dx12-device.hpp b/include/api-test/dx12-device.hpp
index 8d8d1c3..5f48f95 100644
--- a/include/api-test/dx12-device.hpp
+++ b/include/api-test/dx12-device.hpp
@@ -1,5 +1,7 @@
#include <d3d12.h>
-#include <dxgi.h>
+
+#include "freelist.hpp"
+#include "dx12-device-types.hpp"
class dx12device {
public:
@@ -9,7 +11,7 @@ class dx12device {
return render_device;
}
- void create_surface(const surface_desc& desc);
+ handle<dx12::device_surface> create_surface(const dx12::surface_desc& desc);
void create_buffer() {};
@@ -25,12 +27,18 @@ class dx12device {
void get_texture() {};
+ [[nodiscard]] inline dx12::device_surface& get_surface(handle<dx12::device_surface> handle) {
+ return surfaces[handle];
+ }
+
private:
IDXGIFactory* factory;
IDXGIAdapter* adapter;
ID3D12Device* device;
- ID3D12CommandQueue queues[3U];
+ ID3D12CommandQueue* queues[3U];
+
+ freelist<dx12::device_surface> surfaces;
static dx12device render_device;
};
diff --git a/include/api-test/freelist.hpp b/include/api-test/freelist.hpp
index ffefdff..3d0324d 100644
--- a/include/api-test/freelist.hpp
+++ b/include/api-test/freelist.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include <numeric>
#include <vector>
#include <cassert>