Auto stash before merge of "SP3-4-editor" and "origin/SP3-4-editor"
This commit is contained in:
parent
fdc8a61c1d
commit
5a1abe6530
|
@ -199,7 +199,7 @@ namespace SHADE
|
||||||
viewport->PlatformHandle = io.UserData;
|
viewport->PlatformHandle = io.UserData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHImGuiVulkanBackend::Render(void) noexcept
|
void SHImGuiVulkanBackend::Render(Handle<SHVkCommandBuffer> const& commandBuffer) noexcept
|
||||||
{
|
{
|
||||||
GETINSTANCE
|
GETINSTANCE
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
@ -324,14 +324,22 @@ namespace SHADE
|
||||||
|
|
||||||
fontsMipOffset.push_back(0);
|
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, {});
|
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
|
// We could put here the texture id if we wanted
|
||||||
io.Fonts->TexID = nullptr;
|
io.Fonts->TexID = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHImGuiVulkanBackend::SHBreachInstance::InitializePipeline(ImGuiIO& io, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) noexcept
|
void SHImGuiVulkanBackend::SHBreachInstance::InitializePipeline(ImGuiIO& io, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) noexcept
|
||||||
{
|
{
|
||||||
|
// Vertex input state
|
||||||
SHVertexInputState vInputState{};
|
SHVertexInputState vInputState{};
|
||||||
vInputState.AddBinding(false, true,
|
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> 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");
|
Handle<SHVkShaderModule> fs = device->CreateShaderModule(__glsl_shader_frag_spv, "main", vk::ShaderStageFlagBits::eFragment, "__glsl_shader_frag_spv");
|
||||||
|
|
||||||
|
// pipeline layout initialize shaders
|
||||||
SHPipelineLayoutParams pipelineLayoutParams
|
SHPipelineLayoutParams pipelineLayoutParams
|
||||||
{
|
{
|
||||||
.shaderModules = std::move (std::vector<Handle<SHVkShaderModule>>
|
.shaderModules = std::move (std::vector<Handle<SHVkShaderModule>>
|
||||||
|
@ -353,11 +363,34 @@ namespace SHADE
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Create pipeline layout
|
||||||
Handle<SHVkPipelineLayout> pipelineLayouot = device->CreatePipelineLayout(pipelineLayoutParams);
|
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);
|
Handle<SHVkPipeline> newPipeline = device->CreatePipeline(pipelineLayouot, nullptr, renderpass, subpassIndex, SH_PIPELINE_TYPE::GRAPHICS);
|
||||||
|
|
||||||
|
// Set the vertex input state
|
||||||
newPipeline->GetPipelineState().SetVertexInputState(vInputState);
|
newPipeline->GetPipelineState().SetVertexInputState(vInputState);
|
||||||
|
|
||||||
|
// Actually construct the pipeline
|
||||||
newPipeline->ConstructPipeline();
|
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
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -23,8 +23,13 @@ namespace SHADE
|
||||||
Handle<SHVkBuffer> vertexBuffer;
|
Handle<SHVkBuffer> vertexBuffer;
|
||||||
Handle<SHVkBuffer> indicesBuffer;
|
Handle<SHVkBuffer> indicesBuffer;
|
||||||
};
|
};
|
||||||
|
//Required to create stuff
|
||||||
Handle<SHVkLogicalDevice> device;
|
Handle<SHVkLogicalDevice> device;
|
||||||
|
|
||||||
|
// Window of the imgui window
|
||||||
SHWindow window;
|
SHWindow window;
|
||||||
|
|
||||||
|
// Buffers required to draw the imgui entities
|
||||||
std::array<Buffers, 2> primitiveBuffers;
|
std::array<Buffers, 2> primitiveBuffers;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -34,18 +39,33 @@ namespace SHADE
|
||||||
|
|
||||||
struct SHBreachInstance : public SHImGuiWindow
|
struct SHBreachInstance : public SHImGuiWindow
|
||||||
{
|
{
|
||||||
|
// pipeline/shaders used to render imgui entities
|
||||||
Handle<SHVkPipeline> pipeline;
|
Handle<SHVkPipeline> pipeline;
|
||||||
Handle<SHVkRenderpass> renderpass;
|
|
||||||
|
// Last frame time
|
||||||
std::chrono::time_point<std::chrono::steady_clock> lastFrameTime;
|
std::chrono::time_point<std::chrono::steady_clock> lastFrameTime;
|
||||||
|
|
||||||
|
// Fonts texture
|
||||||
Handle<SHVkImage> fontsTexture;
|
Handle<SHVkImage> fontsTexture;
|
||||||
|
|
||||||
|
// mip maps for font image (should just contain 1)
|
||||||
std::vector<uint32_t> fontsMipOffset;
|
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:
|
public:
|
||||||
void CreateFontsTexture (Handle<SHVkImage> image, ImGuiIO& io) noexcept;
|
void CreateFontsTexture (Handle<SHVkImage> image, ImGuiIO& io) noexcept;
|
||||||
void InitializePipeline(ImGuiIO& io, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex) 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:
|
public:
|
||||||
static void CreateInstance(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkRenderpass> const& renderpass, uint32_t subpassIndex, SHWindow& mainWindow) noexcept;
|
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;
|
static void EnableDocking(void) noexcept;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include "SHVkSampler.h"
|
||||||
|
|
||||||
|
namespace SHADE
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue