aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2026-08-18 00:43:03 +0200
committerladevieq <ladevie.quentin@gmail.com>2026-08-18 00:43:03 +0200
commit6db256b8eb4cc45c5296070ae7353e65398d121d (patch)
tree0df44bebae817cbc575dbd288f4bb08a08767873 /include
parent0c7ff7a068958d2c23a8f362763cb22d34f32371 (diff)
Finished descriptor heaps implementation
Diffstat (limited to 'include')
-rw-r--r--include/scene.hpp12
-rw-r--r--include/vk-bindless.hpp49
-rw-r--r--include/vk-device.hpp26
3 files changed, 6 insertions, 81 deletions
diff --git a/include/scene.hpp b/include/scene.hpp
index a1c76e2..5cda832 100644
--- a/include/scene.hpp
+++ b/include/scene.hpp
@@ -38,12 +38,12 @@ public:
handle<device_buffer> bvh_buffer_handle;
handle<device_buffer> materials_buffer_handle;
- uint64_t indices_buffer_address() { return vkdevice::get().get_buffer(indices_buffer_handle).device_address; };
- uint64_t positions_buffer_address() { return vkdevice::get().get_buffer(positions_buffer_handle).device_address; };
- uint64_t normals_buffer_address() { return vkdevice::get().get_buffer(normals_buffer_handle).device_address; };
- uint64_t uvs_buffer_address() { return vkdevice::get().get_buffer(uvs_buffer_handle).device_address; };
- uint64_t bvh_buffer_address() { return vkdevice::get().get_buffer(bvh_buffer_handle).device_address; };
- uint64_t materials_buffer_address() { return vkdevice::get().get_buffer(materials_buffer_handle).device_address; };
+ uint64_t indices_buffer_address() { return vkdevice::get().get_buffer(indices_buffer_handle)->device_address; };
+ uint64_t positions_buffer_address() { return vkdevice::get().get_buffer(positions_buffer_handle)->device_address; };
+ uint64_t normals_buffer_address() { return vkdevice::get().get_buffer(normals_buffer_handle)->device_address; };
+ uint64_t uvs_buffer_address() { return vkdevice::get().get_buffer(uvs_buffer_handle)->device_address; };
+ uint64_t bvh_buffer_address() { return vkdevice::get().get_buffer(bvh_buffer_handle)->device_address; };
+ uint64_t materials_buffer_address() { return vkdevice::get().get_buffer(materials_buffer_handle)->device_address; };
};
#endif // !__SCENE_HPP_
diff --git a/include/vk-bindless.hpp b/include/vk-bindless.hpp
deleted file mode 100644
index be076b8..0000000
--- a/include/vk-bindless.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#pragma once
-
-#include <vulkan/vulkan_core.h>
-
-#include "handle.hpp"
-
-enum UniformTypes : uint32_t {
- GLOBAL,
- PASS,
- DRAW,
- MAX,
-};
-
-enum SamplerType : uint32_t {
- NEAREST,
- LINEAR,
- MAX_SAMPLER,
-};
-
-struct device_buffer;
-
-struct bindless_model {
- [[nodiscard]] device_buffer* get_uniform_buffer(enum UniformTypes type) const;
-
- void init();
-
- void deinit();
-
- VkPipelineLayout global_layout;
- VkDescriptorSet global_set;
-
-public:
- static constexpr size_t push_constant_slot_size = sizeof(uintptr_t);
- static constexpr size_t push_constant_slots = 3U;
-
-private:
- VkDescriptorSetLayout global_set_layout;
- VkDescriptorPool descriptor_pool;
- handle<device_buffer> uniform_buffers[UniformTypes::MAX];
-
- static constexpr size_t descriptor_pool_allocable_sets_count = 64U;
- static constexpr uint32_t set_descriptors_count = 1024U;
-
- VkSampler samplers[SamplerType::MAX_SAMPLER];
-
- static constexpr size_t globals_uniform_buffer_size = 64 * KB;
- static constexpr size_t passes_uniform_buffer_size = 64 * KB;
- static constexpr size_t draws_uniform_buffer_size = 64 * KB;
-};
diff --git a/include/vk-device.hpp b/include/vk-device.hpp
index 84a1a36..913a28b 100644
--- a/include/vk-device.hpp
+++ b/include/vk-device.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "freelist.hpp"
-#include "vk-bindless.hpp"
#include "vk-command-buffer.hpp"
using VmaAllocator = struct VmaAllocator_T*;
@@ -72,14 +71,6 @@ class vkdevice {
return &surfaces[handle];
}
- inline VmaAllocator get_allocator() const {
- return gpu_allocator;
- }
-
- inline VkDevice get_device() const {
- return device;
- }
-
// 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);
@@ -104,27 +95,10 @@ class vkdevice {
void create_device();
- void create_heaps(VkPhysicalDeviceDescriptorHeapPropertiesEXT& descriptor_heap_props);
-
bool device_support_features(VkPhysicalDevice physical_dev);
queue queues[static_cast<uint32_t>(QueueType::MAX)];
- VkInstance instance;
- VkPhysicalDevice physical_device;
- VkPhysicalDeviceProperties2 physical_device_props;
- VkDevice device;
-
- 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;
-
- static size_t
-
- VmaAllocator gpu_allocator;
-
static constexpr size_t max_allocable_command_buffers = 16;
static constexpr size_t max_submitable_command_buffers = 16;