From 8f7d8cd8bc29726570b4332fdcafc7e54fc2dd57 Mon Sep 17 00:00:00 2001 From: Brandon Mak Date: Tue, 13 Sep 2022 09:13:39 +0800 Subject: [PATCH] Added vertex attributes --- SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.cpp | 9 +++++++++ SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.h | 2 ++ SHADE_Engine/src/Graphics/Pipeline/SHPipelineState.cpp | 5 ++++- .../src/Graphics/VertexDescriptors/SHVertexAttribute.h | 5 ++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.cpp b/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.cpp index 29a8e703..f00a2072 100644 --- a/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.cpp +++ b/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.cpp @@ -305,7 +305,16 @@ namespace SHADE void SHImGuiVulkanBackend::SHBreachInstance::InitializePipeline(ImGuiIO& io) noexcept { + SHVertexInputState vInputState{}; + vInputState.AddBinding(false, true, + { + SHVertexAttribute(SHAttribFormat::FLOAT_2D), + SHVertexAttribute(SHAttribFormat::FLOAT_2D), + SHVertexAttribute(SHAttribFormat::UINT32_1D), + } + ); + //Handle newPipeline = device->CreatePipeline() } } \ No newline at end of file diff --git a/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.h b/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.h index fdfa4160..387d173d 100644 --- a/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.h +++ b/SHADE_Engine/src/Editor/Backend/SHImGuiVulkanBackend.h @@ -35,11 +35,13 @@ namespace SHADE struct SHBreachInstance : public SHImGuiWindow { Handle pipeline; + Handle renderpass; std::chrono::time_point lastFrameTime; Handle fontsTexture; std::vector fontsMipOffset; public: void CreateFontsTexture (Handle image, ImGuiIO& io) noexcept; + void InitializeRenderpass (void) noexcept; void InitializePipeline(ImGuiIO& io) noexcept; }; public: diff --git a/SHADE_Engine/src/Graphics/Pipeline/SHPipelineState.cpp b/SHADE_Engine/src/Graphics/Pipeline/SHPipelineState.cpp index 8179444f..6094958e 100644 --- a/SHADE_Engine/src/Graphics/Pipeline/SHPipelineState.cpp +++ b/SHADE_Engine/src/Graphics/Pipeline/SHPipelineState.cpp @@ -117,7 +117,7 @@ namespace SHADE dirty = isDirty; } - std::tuple SHVertexInputState::GetInfoFromAttribFormat(SHAttribFormat attribFormat) const noexcept + std::tuple SHVertexInputState::GetInfoFromAttribFormat(SHAttribFormat attribFormat) const noexcept { switch (attribFormat) { @@ -138,6 +138,9 @@ namespace SHADE case SHAttribFormat::MAT_4D: return std::make_tuple(4, 16, vk::Format::eR32G32B32A32Sfloat); break; + + case SHAttribFormat::UINT32_1D: + return std::make_tuple(1, 4, vk::Format::eR32Uint); } return std::make_tuple(0, 0, vk::Format::eR32Sfloat); } diff --git a/SHADE_Engine/src/Graphics/VertexDescriptors/SHVertexAttribute.h b/SHADE_Engine/src/Graphics/VertexDescriptors/SHVertexAttribute.h index fd8ee3d1..b216f5f4 100644 --- a/SHADE_Engine/src/Graphics/VertexDescriptors/SHVertexAttribute.h +++ b/SHADE_Engine/src/Graphics/VertexDescriptors/SHVertexAttribute.h @@ -18,7 +18,10 @@ namespace SHADE // that a mat2 can be interpreted as (x, y, x, y), (o, o, o, o) instead of (x, y, o, o), (o, o, o, o)? MAT_2D, MAT_3D, - MAT_4D + MAT_4D, + + // integer formats + UINT32_1D, }; struct SHVertexAttribute