From 5e3bb454d50091e581d5d1d03af34e38277694b3 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Thu, 12 Jan 2023 00:47:59 +0100 Subject: WIP new rendering api --- api-proto.txt | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'api-proto.txt') diff --git a/api-proto.txt b/api-proto.txt index 751f390..a8ca1ff 100644 --- a/api-proto.txt +++ b/api-proto.txt @@ -4,19 +4,18 @@ enum CMD_BUF_TYPE { ASYNC_COMPUTE, } -class command_buffer { +class device_command_buffer { void start(); void stop(); VkCommandBuffer handle; - queue owner; } -class graphics_command_buffer : command_buffer { +class graphics_device_command_buffer : device_command_buffer { void image_barrier(handle tex, State new_state) { texture = rm::get_texture(tex); - cmd.barrier(texture.img.device_image, texture.current_state, new_state); + vkCmdBarrier(texture.img.device_image, texture.current_state, new_state, handle); texture.current_state = new_state; } @@ -35,7 +34,7 @@ class device_buffer { VkDeviceAddr gpu_address; } -class device_image { +class device_texture { VkImage handle; VmaAllocation allocation; array bindless_id; // TODO: Handle this in a higher level ? @@ -46,27 +45,25 @@ class device_image { const uint invalid_id = -1; } -class device_command_buffer { - CMD_BUF_TYPE buf_type = CMD_BUF_TYPE::MAX; - VkCommandBuffer handle; -} - class global_descriptor_set { VkDescritptorSetLayout layout; VkDescriptorSet set; }; class device { - device_image create_image(TextureDesc desc) { - img {}; - img.handle = vmaCreateImage(&img.alloc); + device_image create_texture(TextureDesc desc) { + auto tex {}; + tex.handle = vmaCreateImage(&tex.alloc); } device_buffer create_buffer(BufferDesc desc); - device_command_buffer allocate_command_buffer(uint32_t count); + template + void allocate_command_buffers(command_buffer_type ptr, uint32_t count, CMD_BUF_TYPE type) { + vkAllocate(ptr, count, queue[type]); + } - submit(span cmd_buffers, semaphore) + fence submit(span cmd_buffers, CMD_BUF_TYPE type); wait(fence); wait_idle(); @@ -78,7 +75,7 @@ class device { device_swapchain sc; - array sc_images; + array sc_textures; array queues; global_descriptor_set global_set; -- cgit v1.3