aboutsummaryrefslogtreecommitdiffstats
path: root/include/vk-device.hpp
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2026-08-17 02:20:13 +0200
committerladevieq <ladevie.quentin@gmail.com>2026-08-17 02:20:13 +0200
commit782741f0fea5b2a95aed9ad3673ecafb4b164885 (patch)
tree7e381783dc52fc54eba8d4850b05ea759c5eab11 /include/vk-device.hpp
parent92e09dc06f8c8dd5b7a9323d586f4bf642078727 (diff)
Inital work on vulkan descriptor heap implementation
Diffstat (limited to 'include/vk-device.hpp')
-rw-r--r--include/vk-device.hpp67
1 files changed, 24 insertions, 43 deletions
diff --git a/include/vk-device.hpp b/include/vk-device.hpp
index e2e8c99..84a1a36 100644
--- a/include/vk-device.hpp
+++ b/include/vk-device.hpp
@@ -37,8 +37,6 @@ class vkdevice {
handle<device_surface> create_surface(const surface_desc& desc);
- handle<device_semaphore> create_semaphore(const semaphore_desc& desc, const char* name);
-
void destroy_texture(handle<device_texture> handle);
void destroy_sampler(handle<device_sampler> handle);
@@ -47,8 +45,6 @@ class vkdevice {
void destroy_pipeline(handle<device_pipeline> handle);
- void destroy_semaphore(handle<device_semaphore> handle);
-
void destroy_surface(handle<device_surface> handle);
template<typename buffer_type>
@@ -56,50 +52,34 @@ class vkdevice {
allocate_command_buffers(static_cast<command_buffer*>(buffers), count, queue_type, name);
}
- [[nodiscard]] inline device_texture& get_texture(handle<device_texture> handle) {
- return textures[handle];
- }
-
- [[nodiscard]] inline device_sampler& get_sampler(handle<device_sampler> handle) {
- return samplers[handle];
- }
-
- [[nodiscard]] inline device_buffer& get_buffer(handle<device_buffer> handle) {
- return buffers[handle];
+ [[nodiscard]] inline device_texture* get_texture(handle<device_texture> handle) {
+ return &textures[handle];
}
- [[nodiscard]] inline const device_pipeline& get_pipeline(handle<device_pipeline> handle) const {
- return pipelines[handle];
+ [[nodiscard]] inline device_sampler* get_sampler(handle<device_sampler> handle) {
+ return &samplers[handle];
}
- [[nodiscard]] inline device_surface& get_surface(handle<device_surface> handle) {
- return surfaces[handle];
+ [[nodiscard]] inline device_buffer* get_buffer(handle<device_buffer> handle) {
+ return &buffers[handle];
}
- [[nodiscard]] inline device_semaphore& get_semaphore(handle<device_semaphore> handle) {
- return semaphores[handle];
+ [[nodiscard]] inline const device_pipeline* get_pipeline(handle<device_pipeline> handle) const {
+ return &pipelines[handle];
}
- [[nodiscard]] inline const bindless_model& get_bindingmodel() const {
- return bindless;
+ [[nodiscard]] inline device_surface* get_surface(handle<device_surface> handle) {
+ return &surfaces[handle];
}
- const freelist<device_texture>& get_textures() const {
- return textures;
+ inline VmaAllocator get_allocator() const {
+ return gpu_allocator;
}
inline VkDevice get_device() const {
return device;
}
- inline VmaAllocator get_allocator() {
- return gpu_allocator;
- }
-
- inline const VkPhysicalDeviceLimits& get_device_limits() const {
- return physical_device_props.properties.limits;
- }
-
// uint64_t submit(std::span<command_buffer> buffers, handle<device_semaphore> wait_handle, handle<device_semaphore> signal_handle, handle<device_semaphore> fence_handle);
uint32_t acquire_image_index(handle<device_surface> surface_handle);
uint64_t submit_before_present(handle<device_surface> surface_handle, command_buffer* buffers, uint32_t count);
@@ -109,6 +89,8 @@ class vkdevice {
void wait();
+ void wait_for_fence(u64 value);
+
private:
vkdevice() = default;
~vkdevice() = default;
@@ -122,16 +104,10 @@ class vkdevice {
void create_device();
- void create_memory_allocator();
-
- void create_command_pools();
-
- void pick_physical_device();
+ void create_heaps(VkPhysicalDeviceDescriptorHeapPropertiesEXT& descriptor_heap_props);
bool device_support_features(VkPhysicalDevice physical_dev);
- void create_debug_layer_callback();
-
queue queues[static_cast<uint32_t>(QueueType::MAX)];
VkInstance instance;
@@ -139,9 +115,15 @@ class vkdevice {
VkPhysicalDeviceProperties2 physical_device_props;
VkDevice device;
- VmaAllocator gpu_allocator;
+ handle<device_buffer> image_heap; // TODO: Dont use handle for internally used resources
+ handle<device_buffer> sampler_heap;
+
+ static constexpr size_t max_images_count = UINT16_MAX;
+ static constexpr size_t max_samplers_count = 16U;
- bindless_model bindless;
+ static size_t
+
+ VmaAllocator gpu_allocator;
static constexpr size_t max_allocable_command_buffers = 16;
static constexpr size_t max_submitable_command_buffers = 16;
@@ -151,9 +133,8 @@ class vkdevice {
freelist<device_buffer> buffers;
freelist<device_pipeline> pipelines;
freelist<device_surface> surfaces;
- freelist<device_semaphore> semaphores;
- device_semaphore timeline_semaphore;
+ device_semaphore fence;
static vkdevice render_device;