From ddff2fa5d0cbae17cb819c91bad0a79105ba0ea7 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 31 Jan 2023 21:16:16 +0100 Subject: Graphics pipeline rendering --- include/api-test/command-buffer.hpp | 28 +++++++++++++++++++++++++++- include/api-test/vk-device-types.hpp | 3 +++ include/vulkan-loader.hpp | 2 ++ 3 files changed, 32 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/api-test/command-buffer.hpp b/include/api-test/command-buffer.hpp index ffeafc4..2cd1d75 100644 --- a/include/api-test/command-buffer.hpp +++ b/include/api-test/command-buffer.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include @@ -27,6 +28,27 @@ struct dispatch_params { uint32_t uniforms_offset; }; +struct renderpass_params { +private: + struct rect { + int32_t x; + int32_t y; + uint32_t width; + uint32_t height; + }; + +public: + rect render_area; + std::span> color_attachments; + // optional viewport + // optional scissor +}; +struct draw_params { + handle pipeline; + uint32_t vertex_count; + uint32_t instance_count; +}; + struct command_buffer { void start() const; void stop() const; @@ -41,7 +63,11 @@ struct command_buffer { // General purpose queue struct graphics_command_buffer: public command_buffer { - void dispatch(const dispatch_params& params); + void dispatch(const dispatch_params& params) const; + + void begin_renderpass(const renderpass_params& params) const; + void render(const draw_params& params) const; + void end_renderpass() const; }; struct compute_command_buffer: public command_buffer { diff --git a/include/api-test/vk-device-types.hpp b/include/api-test/vk-device-types.hpp index 33a7738..bca57af 100644 --- a/include/api-test/vk-device-types.hpp +++ b/include/api-test/vk-device-types.hpp @@ -59,6 +59,9 @@ struct pipeline_desc { std::span vs_code; std::span fs_code; std::span cs_code; + std::span color_attachments_format; + VkFormat depth_attachment_format; + VkFormat stencil_attachment_format; }; struct device_pipeline { diff --git a/include/vulkan-loader.hpp b/include/vulkan-loader.hpp index d0ad3a5..cd93415 100644 --- a/include/vulkan-loader.hpp +++ b/include/vulkan-loader.hpp @@ -88,6 +88,7 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES; X(vkCmdPushConstants) \ X(vkCmdClearColorImage) \ X(vkCmdBeginRenderPass) \ + X(vkCmdBeginRendering) \ X(vkCmdBindPipeline) \ X(vkCmdBindVertexBuffers) \ X(vkCmdBindIndexBuffer) \ @@ -101,6 +102,7 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES; X(vkCmdDraw) \ X(vkCmdDrawIndexed) \ X(vkCmdDispatch) \ + X(vkCmdEndRendering) \ X(vkCmdEndRenderPass) \ X(vkEndCommandBuffer) \ X(vkResetCommandBuffer) \ -- cgit v1.3