diff options
Diffstat (limited to 'include/api-test')
| -rw-r--r-- | include/api-test/command-buffer.hpp | 8 | ||||
| -rw-r--r-- | include/api-test/handle.hpp | 2 | ||||
| -rw-r--r-- | include/api-test/vk-bindless.hpp | 9 | ||||
| -rw-r--r-- | include/api-test/vk-device-types.hpp | 2 | ||||
| -rw-r--r-- | include/api-test/vk-device.hpp | 19 |
5 files changed, 33 insertions, 7 deletions
diff --git a/include/api-test/command-buffer.hpp b/include/api-test/command-buffer.hpp index 2cd1d75..31b1254 100644 --- a/include/api-test/command-buffer.hpp +++ b/include/api-test/command-buffer.hpp @@ -40,13 +40,17 @@ private: public: rect render_area; std::span<handle<device_texture>> color_attachments; - // optional viewport - // optional scissor + // rect viewport; + // rect scissor; }; struct draw_params { handle<device_pipeline> pipeline; + handle<device_buffer> index_buffer; uint32_t vertex_count; + uint32_t vertex_offset; + uint32_t index_offset; uint32_t instance_count; + uint32_t uniforms_offset; }; struct command_buffer { diff --git a/include/api-test/handle.hpp b/include/api-test/handle.hpp index 2355191..956739d 100644 --- a/include/api-test/handle.hpp +++ b/include/api-test/handle.hpp @@ -6,5 +6,7 @@ template<typename T> struct handle { uint32_t id = handle::invalid_handle; + [[nodiscard]] inline bool is_valid() const { return id != handle::invalid_handle; } + static constexpr uint32_t invalid_handle = -1; }; diff --git a/include/api-test/vk-bindless.hpp b/include/api-test/vk-bindless.hpp index c292878..80918fe 100644 --- a/include/api-test/vk-bindless.hpp +++ b/include/api-test/vk-bindless.hpp @@ -8,7 +8,8 @@ enum BindlessSetType : uint32_t { GLOBAL, - UNIFORMS, + INSTANCES_UNIFORMS, + DRAWS_UNIFORMS, MAX, }; @@ -34,7 +35,8 @@ struct bindless_model { private: VkDescriptorSetLayout sets_layout[BindlessSetType::MAX]; VkDescriptorPool descriptor_pool; - handle<device_buffer> uniform_buffer; + handle<device_buffer> instances_uniform_buffer_handle; + handle<device_buffer> draws_uniform_buffer_handle; static constexpr size_t descriptor_pool_allocable_sets_count = 64U; static constexpr uint32_t set_descriptors_count[BindlessSetType::MAX]{ 1024U }; @@ -50,6 +52,9 @@ private: void destroy_immutable_samplers(VkDevice device); VkSampler samplers[SamplerType::MAX_SAMPLER]; + + static constexpr size_t instances_uniform_buffer_size = 64ULL * 1024ULL; + static constexpr size_t draws_uniform_buffer_size = 64ULL * 1024ULL; #else VkPipelineLayout layout; VkDescriptorSetLayout sets_layout[BindlessSetType::MAX]; diff --git a/include/api-test/vk-device-types.hpp b/include/api-test/vk-device-types.hpp index bca57af..987eb13 100644 --- a/include/api-test/vk-device-types.hpp +++ b/include/api-test/vk-device-types.hpp @@ -48,7 +48,7 @@ struct buffer_desc { struct device_buffer { VkBuffer vk_buffer; VmaAllocation alloc; - VkDeviceAddress device_address; + VkDeviceAddress device_address = 0U; void* mapped_ptr; buffer_desc desc; diff --git a/include/api-test/vk-device.hpp b/include/api-test/vk-device.hpp index a30b18c..32a0707 100644 --- a/include/api-test/vk-device.hpp +++ b/include/api-test/vk-device.hpp @@ -15,6 +15,17 @@ using VmaAllocator = struct VmaAllocator_T*; class window; +struct vksurface { + VkSurfaceKHR vk_surface; + VkSwapchainKHR vk_swapchain; + uint32_t image_index; +}; + +struct vksemaphore { + VkSemaphore vk_semaphore = nullptr; + uint64_t value = 0U; +}; + class vkdevice { struct queue { VkQueue vk_queue; @@ -38,6 +49,8 @@ class vkdevice { handle<device_pipeline> create_pipeline(const pipeline_desc& desc); + vksemaphore create_semaphore(); + void destroy_texture(const device_texture& texture); void destroy_texture(handle<device_texture> handle); @@ -72,9 +85,11 @@ class vkdevice { return device; } - void submit(command_buffer* buffers, size_t count); + void wait(vksemaphore& semaphore); + + void submit(std::span<command_buffer> buffers, vksemaphore* wait, vksemaphore* signal); - void present(); + void present(vksurface& surface, const vksemaphore& semaphore); private: vkdevice(const window& window); |
