adding pixel put pipeline

This commit is contained in:
2023-03-31 22:16:21 +02:00
parent 3b29305936
commit 88404afb2b
23 changed files with 8443 additions and 165 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/18 17:14:45 by maldavid #+# #+# */
/* Updated: 2023/01/25 16:05:05 by maldavid ### ########.fr */
/* Updated: 2023/03/31 17:59:09 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,6 +17,7 @@
#include <vector>
#include <memory>
#include <renderer/pixel_put.h>
#include <renderer/buffers/vk_ubo.h>
#include <renderer/core/vk_surface.h>
#include <renderer/core/render_core.h>
@@ -40,6 +41,7 @@ namespace mlx
{
glm::vec2 pos;
glm::vec3 color;
glm::vec2 uv;
static VkVertexInputBindingDescription getBindingDescription()
{
@@ -51,9 +53,9 @@ namespace mlx
return bindingDescription;
}
static std::array<VkVertexInputAttributeDescription, 2> getAttributeDescriptions()
static std::array<VkVertexInputAttributeDescription, 3> getAttributeDescriptions()
{
std::array<VkVertexInputAttributeDescription, 2> attributeDescriptions;
std::array<VkVertexInputAttributeDescription, 3> attributeDescriptions;
attributeDescriptions[0].binding = 0;
attributeDescriptions[0].location = 0;
@@ -65,6 +67,11 @@ namespace mlx
attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[1].offset = offsetof(Vertex, color);
attributeDescriptions[2].binding = 0;
attributeDescriptions[2].location = 2;
attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
attributeDescriptions[2].offset = offsetof(Vertex, uv);
return attributeDescriptions;
}
};
@@ -93,8 +100,11 @@ namespace mlx
inline CmdBuffer& getCmdBuffer(int i) noexcept { return _cmd_buffers[i]; }
inline GraphicPipeline& getPipeline() noexcept { return _pipeline; }
inline CmdBuffer& getActiveCmdBuffer() noexcept { return _cmd_buffers[_active_image_index]; }
inline DescriptorSet& getDescriptorSet() noexcept { return _set; }
inline DescriptorSetLayout& getDescriptorSetLayout() noexcept { return _layout; }
inline DescriptorSet& getVertDescriptorSet() noexcept { return _vert_set; }
inline DescriptorSet& getFragDescriptorSet() noexcept { return _frag_set; }
inline DescriptorSetLayout& getVertDescriptorSetLayout() noexcept { return _vert_layout; }
inline DescriptorSetLayout& getFragDescriptorSetLayout() noexcept { return _frag_layout; }
inline PixelPutPipeline& getPixelPutPipeline() noexcept { return _pixel_put_pipeline; }
inline uint32_t getActiveImageIndex() noexcept { return _active_image_index; }
inline uint32_t getImageIndex() noexcept { return _image_index; }
@@ -103,19 +113,26 @@ namespace mlx
~Renderer() = default;
private:
PixelPutPipeline _pixel_put_pipeline;
GraphicPipeline _pipeline;
RenderPass _pass;
Surface _surface;
CmdPool _cmd_pool;
SwapChain _swapchain;
Semaphore _semaphore;
DescriptorPool _desc_pool;
DescriptorSet _set;
DescriptorSetLayout _layout;
std::array<CmdBuffer, MAX_FRAMES_IN_FLIGHT> _cmd_buffers;
DescriptorSetLayout _vert_layout;
DescriptorSetLayout _frag_layout;
DescriptorSet _vert_set;
DescriptorSet _frag_set;
std::array<CmdBuffer, MAX_FRAMES_IN_FLIGHT> _cmd_buffers;
std::unique_ptr<UBO> _uniform_buffer = nullptr;
class MLX_Window* _window;
class MLX_Window* _window = nullptr;
uint32_t _active_image_index = 0;
uint32_t _image_index = 0;