Auto stash before merge of "SP3-4-editor" and "origin/SP3-4-editor"

This commit is contained in:
Brandon Mak 2022-09-14 19:18:54 +08:00
parent fdc8a61c1d
commit 5a1abe6530
4 changed files with 88 additions and 3 deletions

View File

@ -199,7 +199,7 @@ namespace SHADE
viewport->PlatformHandle = io.UserData;
}
void SHImGuiVulkanBackend::Render(void) noexcept
void SHImGuiVulkanBackend::Render(Handle<SHVkCommandBuffer> const& commandBuffer) noexcept
{
GETINSTANCE
ImGui::Render();
@ -324,14 +324,22 @@ namespace SHADE
fontsMipOffset.push_back(0);
// Create image. Data should be in staging only now
fontsTexture = device->CreateImage(createParams, pixels, width * height * sizeof(uint32_t), fontsMipOffset, VmaMemoryUsage::VMA_MEMORY_USAGE_AUTO, {});
// TODO: Copy the image to device memory here
// 1. Start record
// 2. Do transfer
// 3. End record
// 4. execute cmd buffer
// We could put here the texture id if we wanted
io.Fonts->TexID = nullptr;
}
void SHImGuiVulkanBackend::SHBreachInstance::InitializePipeline(ImGuiIO& io, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) noexcept
{
// Vertex input state
SHVertexInputState vInputState{};
vInputState.AddBinding(false, true,
{
@ -341,9 +349,11 @@ namespace SHADE
}
);
// Shaders
Handle<SHVkShaderModule> vs = device->CreateShaderModule(__glsl_shader_vert_spv, "main", vk::ShaderStageFlagBits::eVertex, "__glsl_shader_vert_spv");
Handle<SHVkShaderModule> fs = device->CreateShaderModule(__glsl_shader_frag_spv, "main", vk::ShaderStageFlagBits::eFragment, "__glsl_shader_frag_spv");
// pipeline layout initialize shaders
SHPipelineLayoutParams pipelineLayoutParams
{
.shaderModules = std::move (std::vector<Handle<SHVkShaderModule>>
@ -353,11 +363,34 @@ namespace SHADE
}),
};
// Create pipeline layout
Handle<SHVkPipelineLayout> pipelineLayouot = device->CreatePipelineLayout(pipelineLayoutParams);
// Create pipeline (but dont construct it yet)
Handle<SHVkPipeline> newPipeline = device->CreatePipeline(pipelineLayouot, nullptr, renderpass, subpassIndex, SH_PIPELINE_TYPE::GRAPHICS);
// Set the vertex input state
newPipeline->GetPipelineState().SetVertexInputState(vInputState);
// Actually construct the pipeline
newPipeline->ConstructPipeline();
SHVkDescriptorPool::Config config
{
.MaxSets = 10,
.Flags = {},
};
// Create a descriptor pool
descriptorPool = device->CreateDescriptorPools(config);
// Allocate descriptor sets required for the fonts
descriptorSetGroup =
}
void SHImGuiVulkanBackend::SHBreachInstance::Render(Handle<SHVkCommandBuffer> const& commandBuffer, ImGuiIO& io, ImDrawData* draw_data, Handle<SHVkDescriptorSetGroup> const& descriptorSetGroup) noexcept
{
}
}

View File

@ -23,8 +23,13 @@ namespace SHADE
Handle<SHVkBuffer> vertexBuffer;
Handle<SHVkBuffer> indicesBuffer;
};
//Required to create stuff
Handle<SHVkLogicalDevice> device;
// Window of the imgui window
SHWindow window;
// Buffers required to draw the imgui entities
std::array<Buffers, 2> primitiveBuffers;
public:
@ -34,18 +39,33 @@ namespace SHADE
struct SHBreachInstance : public SHImGuiWindow
{
// pipeline/shaders used to render imgui entities
Handle<SHVkPipeline> pipeline;
Handle<SHVkRenderpass> renderpass;
// Last frame time
std::chrono::time_point<std::chrono::steady_clock> lastFrameTime;
// Fonts texture
Handle<SHVkImage> fontsTexture;
// mip maps for font image (should just contain 1)
std::vector<uint32_t> fontsMipOffset;
// Descriptor pool rquired to allocate descriptor sets
Handle<SHVkDescriptorPool> descriptorPool;
// Descriptor set required to store font texture
Handle<SHVkDescriptorSetGroup> descriptorSetGroup;
public:
void CreateFontsTexture (Handle<SHVkImage> image, ImGuiIO& io) noexcept;
void InitializePipeline(ImGuiIO& io, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) noexcept;
void Render (Handle<SHVkCommandBuffer> const& commandBuffer, ImGuiIO& io, ImDrawData* draw_data, Handle<SHVkDescriptorSetGroup> const& descriptorSetGroup) noexcept;
};
public:
static void CreateInstance(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex, SHWindow& mainWindow) noexcept;
static void Render(void) noexcept;
static void Render(Handle<SHVkCommandBuffer> const& commandBuffer) noexcept;
static void EnableDocking(void) noexcept;

View File

@ -0,0 +1,6 @@
#include "SHVkSampler.h"
namespace SHADE
{
}

View File

@ -0,0 +1,26 @@
#pragma once
#include "Graphics/SHVulkanIncludes.h"
namespace SHADE
{
struct SHVkSamplerParams
{
vk::Filter minFilter;
vk::Filter maxFilter;
};
class SHVkSampler
{
private:
//! The vulkan sampler handler
vk::Sampler vkSampler;
public:
SHVkSampler () noexcept;
SHVkSampler (SHVkSampler&& rhs) noexcept;
SHVkSampler&& operator=(SHVkSampler&& rhs) noexcept;
};
}