WIP
This commit is contained in:
parent
17b71393f3
commit
7b7533420e
|
@ -25,6 +25,12 @@ namespace SHADE
|
||||||
struct SHGraphicsConstants
|
struct SHGraphicsConstants
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
struct RenderGraphIndices
|
||||||
|
{
|
||||||
|
static constexpr uint32_t WORLD = 0;
|
||||||
|
static constexpr uint32_t EDITOR = 0;
|
||||||
|
};
|
||||||
|
|
||||||
struct DescriptorSetIndex
|
struct DescriptorSetIndex
|
||||||
{
|
{
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
|
@ -119,7 +119,6 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
auto windowDims = window->GetWindowSize();
|
auto windowDims = window->GetWindowSize();
|
||||||
|
|
||||||
SHGraphicsGlobalData::Init(device);
|
|
||||||
|
|
||||||
// Set Up Cameras
|
// Set Up Cameras
|
||||||
screenCamera = resourceManager.Create<SHCamera>();
|
screenCamera = resourceManager.Create<SHCamera>();
|
||||||
|
@ -134,7 +133,7 @@ namespace SHADE
|
||||||
defaultViewport = AddViewport(vk::Viewport(0.0f, 0.0f, static_cast<float>(window->GetWindowSize().first), static_cast<float>(window->GetWindowSize().second), 0.0f, 1.0f));
|
defaultViewport = AddViewport(vk::Viewport(0.0f, 0.0f, static_cast<float>(window->GetWindowSize().first), static_cast<float>(window->GetWindowSize().second), 0.0f, 1.0f));
|
||||||
|
|
||||||
// Get render graph from default viewport world renderer
|
// Get render graph from default viewport world renderer
|
||||||
sceneRenderGraph = resourceManager.Create<SHRenderGraph>();
|
worldRenderGraph = resourceManager.Create<SHRenderGraph>();
|
||||||
|
|
||||||
std::vector<Handle<SHVkCommandPool>> renderContextCmdPools{ swapchain->GetNumImages() };
|
std::vector<Handle<SHVkCommandPool>> renderContextCmdPools{ swapchain->GetNumImages() };
|
||||||
for (uint32_t i = 0; i < renderContextCmdPools.size(); ++i)
|
for (uint32_t i = 0; i < renderContextCmdPools.size(); ++i)
|
||||||
|
@ -143,35 +142,36 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize world render graph
|
// Initialize world render graph
|
||||||
sceneRenderGraph->Init(device, swapchain);
|
worldRenderGraph->Init(device, swapchain);
|
||||||
sceneRenderGraph->AddResource("Present", { SH_ATT_DESC_TYPE_FLAGS::COLOR_PRESENT }, windowDims.first, windowDims.second);
|
//worldRenderGraph->AddResource("Present", { SH_ATT_DESC_TYPE_FLAGS::COLOR_PRESENT }, windowDims.first, windowDims.second);
|
||||||
sceneRenderGraph->AddResource("Scene", { SH_ATT_DESC_TYPE_FLAGS::COLOR, SH_ATT_DESC_TYPE_FLAGS::INPUT }, windowDims.first, windowDims.second);
|
worldRenderGraph->AddResource("Scene", { SH_ATT_DESC_TYPE_FLAGS::COLOR, SH_ATT_DESC_TYPE_FLAGS::INPUT }, windowDims.first, windowDims.second);
|
||||||
sceneRenderGraph->AddResource("Depth Buffer", { SH_ATT_DESC_TYPE_FLAGS::DEPTH_STENCIL }, windowDims.first, windowDims.second, vk::Format::eD32SfloatS8Uint);
|
worldRenderGraph->AddResource("Depth Buffer", { SH_ATT_DESC_TYPE_FLAGS::DEPTH_STENCIL }, windowDims.first, windowDims.second, vk::Format::eD32SfloatS8Uint);
|
||||||
sceneRenderGraph->AddResource("Entity ID", { SH_ATT_DESC_TYPE_FLAGS::COLOR }, windowDims.first, windowDims.second, vk::Format::eR32Uint, 1, vk::ImageUsageFlagBits::eTransferSrc);
|
worldRenderGraph->AddResource("Entity ID", { SH_ATT_DESC_TYPE_FLAGS::COLOR }, windowDims.first, windowDims.second, vk::Format::eR32Uint, 1, vk::ImageUsageFlagBits::eTransferSrc);
|
||||||
|
|
||||||
auto node = sceneRenderGraph->AddNode("G-Buffer", { "Entity ID", "Depth Buffer", "Scene" }, {}); // no predecessors
|
auto node = worldRenderGraph->AddNode("G-Buffer", { /*"Present", */"Entity ID", "Depth Buffer", "Scene"}, {}); // no predecessors
|
||||||
|
|
||||||
//First subpass to write to G-Buffer
|
//First subpass to write to G-Buffer
|
||||||
auto gBufferWriteSubpass = node->AddSubpass("G-Buffer Write");
|
auto gBufferWriteSubpass = node->AddSubpass("G-Buffer Write");
|
||||||
gBufferWriteSubpass->AddColorOutput("Scene");
|
gBufferWriteSubpass->AddColorOutput("Scene");
|
||||||
gBufferWriteSubpass->AddColorOutput("Entity ID");
|
gBufferWriteSubpass->AddColorOutput("Entity ID");
|
||||||
|
//gBufferWriteSubpass->AddColorOutput("Present");
|
||||||
gBufferWriteSubpass->AddDepthOutput("Depth Buffer", SH_ATT_DESC_TYPE_FLAGS::DEPTH_STENCIL);
|
gBufferWriteSubpass->AddDepthOutput("Depth Buffer", SH_ATT_DESC_TYPE_FLAGS::DEPTH_STENCIL);
|
||||||
|
|
||||||
// We do this to just transition our scene layout to shader read
|
// We do this to just transition our scene layout to shader read
|
||||||
auto sceneLayoutTransitionSubpass = node->AddSubpass("Scene Layout Transition");
|
auto sceneLayoutTransitionSubpass = node->AddSubpass("Scene Layout Transition");
|
||||||
sceneLayoutTransitionSubpass->AddInput("Scene");
|
sceneLayoutTransitionSubpass->AddInput("Scene");
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
//#ifdef SHEDITOR
|
||||||
auto imguiNode = sceneRenderGraph->AddNode("ImGui Node", { "Present" }, { "G-Buffer" });
|
// auto imguiNode = worldRenderGraph->AddNode("ImGui Node", { "Present" }, { "G-Buffer" });
|
||||||
auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
|
// auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
|
||||||
imguiSubpass->AddColorOutput("Present");
|
// imguiSubpass->AddColorOutput("Present");
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
// Generate world render graph
|
// Generate world render graph
|
||||||
sceneRenderGraph->Generate();
|
worldRenderGraph->Generate();
|
||||||
|
|
||||||
// Add world renderer to default viewport
|
// Add world renderer to default viewport
|
||||||
worldRenderer = defaultViewport->AddRenderer(resourceManager, swapchain->GetNumImages(), renderContextCmdPools, descPool, SHGraphicsGlobalData::GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::HIGH_FREQUENCY_GLOBALS], sceneRenderGraph);
|
worldRenderer = defaultViewport->AddRenderer(resourceManager, swapchain->GetNumImages(), renderContextCmdPools, descPool, SHGraphicsGlobalData::GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::HIGH_FREQUENCY_GLOBALS], worldRenderGraph);
|
||||||
worldRenderer->SetCamera(worldCamera);
|
worldRenderer->SetCamera(worldCamera);
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,8 +192,14 @@ namespace SHADE
|
||||||
|
|
||||||
void SHGraphicsSystem::InitMiddleEnd(void) noexcept
|
void SHGraphicsSystem::InitMiddleEnd(void) noexcept
|
||||||
{
|
{
|
||||||
|
SHGraphicsGlobalData::Init(device);
|
||||||
|
|
||||||
InitSceneRenderGraph();
|
InitSceneRenderGraph();
|
||||||
|
|
||||||
|
#ifdef SHEDITOR
|
||||||
|
InitEditorRenderGraph();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Create Semaphore
|
// Create Semaphore
|
||||||
for (auto& semaHandle : graphSemaphores)
|
for (auto& semaHandle : graphSemaphores)
|
||||||
{
|
{
|
||||||
|
@ -211,13 +217,45 @@ namespace SHADE
|
||||||
for (uint32_t i = 0; i < swapchain->GetNumImages(); ++i)
|
for (uint32_t i = 0; i < swapchain->GetNumImages(); ++i)
|
||||||
cmdPools.push_back(renderContext.GetFrameData(i).cmdPoolHdls[0]);
|
cmdPools.push_back(renderContext.GetFrameData(i).cmdPoolHdls[0]);
|
||||||
|
|
||||||
mousePickSystem->Init(device, cmdPools, sceneRenderGraph->GetRenderGraphResource("Entity ID"));
|
mousePickSystem->Init(device, cmdPools, worldRenderGraph->GetRenderGraphResource("Entity ID"));
|
||||||
|
|
||||||
// Register the post offscreen render to the system
|
// Register the post offscreen render to the system
|
||||||
postOffscreenRender = resourceManager.Create<SHPostOffscreenRenderSystem>();
|
postOffscreenRender = resourceManager.Create<SHPostOffscreenRenderSystem>();
|
||||||
postOffscreenRender->Init(device, sceneRenderGraph->GetRenderGraphResource("Scene"), descPool);
|
postOffscreenRender->Init(device, worldRenderGraph->GetRenderGraphResource("Scene"), descPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SHEDITOR
|
||||||
|
void SHGraphicsSystem::InitEditorRenderGraph(void) noexcept
|
||||||
|
{
|
||||||
|
auto windowDims = window->GetWindowSize();
|
||||||
|
|
||||||
|
// Create Default Viewport
|
||||||
|
editorViewport = AddViewport(vk::Viewport(0.0f, 0.0f, static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.0f, 1.0f));
|
||||||
|
|
||||||
|
// Get render graph from viewport editor renderer
|
||||||
|
editorRenderGraph = resourceManager.Create<SHRenderGraph>();
|
||||||
|
|
||||||
|
std::vector<Handle<SHVkCommandPool>> renderContextCmdPools{ swapchain->GetNumImages() };
|
||||||
|
for (uint32_t i = 0; i < renderContextCmdPools.size(); ++i)
|
||||||
|
renderContextCmdPools[i] = renderContext.GetFrameData(i).cmdPoolHdls[0];
|
||||||
|
|
||||||
|
editorRenderGraph->Init(device, swapchain);
|
||||||
|
editorRenderGraph->AddResource("Present", { SH_ATT_DESC_TYPE_FLAGS::COLOR_PRESENT }, windowDims.first, windowDims.second);
|
||||||
|
|
||||||
|
|
||||||
|
auto imguiNode = editorRenderGraph->AddNode("ImGui Node", { "Present"}, {});
|
||||||
|
auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
|
||||||
|
imguiSubpass->AddColorOutput("Present");
|
||||||
|
|
||||||
|
// Generate world render graph
|
||||||
|
editorRenderGraph->Generate();
|
||||||
|
|
||||||
|
// Add world renderer to default viewport
|
||||||
|
editorRenderer = editorViewport->AddRenderer(resourceManager, swapchain->GetNumImages(), renderContextCmdPools, descPool, SHGraphicsGlobalData::GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::HIGH_FREQUENCY_GLOBALS], editorRenderGraph);
|
||||||
|
editorRenderer->SetCamera(worldCamera);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Constructor/Destructors */
|
/* Constructor/Destructors */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
@ -664,7 +702,8 @@ namespace SHADE
|
||||||
|
|
||||||
renderContext.HandleResize();
|
renderContext.HandleResize();
|
||||||
|
|
||||||
sceneRenderGraph->HandleResize(resizeWidth, resizeHeight);
|
worldRenderGraph->HandleResize(resizeWidth, resizeHeight);
|
||||||
|
editorRenderGraph->HandleResize(windowDims.first, windowDims.second);
|
||||||
|
|
||||||
mousePickSystem->HandleResize();
|
mousePickSystem->HandleResize();
|
||||||
postOffscreenRender->HandleResize();
|
postOffscreenRender->HandleResize();
|
||||||
|
|
|
@ -68,10 +68,14 @@ namespace SHADE
|
||||||
class SH_API SHGraphicsSystem : public SHSystem
|
class SH_API SHGraphicsSystem : public SHSystem
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void InitBoilerplate (void) noexcept;
|
void InitBoilerplate (void) noexcept;
|
||||||
void InitSceneRenderGraph(void) noexcept;
|
void InitSceneRenderGraph (void) noexcept;
|
||||||
void InitMiddleEnd (void) noexcept;
|
void InitMiddleEnd (void) noexcept;
|
||||||
void InitSubsystems (void) noexcept;
|
void InitSubsystems (void) noexcept;
|
||||||
|
|
||||||
|
#ifdef SHEDITOR
|
||||||
|
void InitEditorRenderGraph (void) noexcept;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class SH_API BeginRoutine final : public SHSystemRoutine
|
class SH_API BeginRoutine final : public SHSystemRoutine
|
||||||
|
@ -277,6 +281,9 @@ namespace SHADE
|
||||||
Handle<SHVkQueue> GetQueue() const { return graphicsQueue; }
|
Handle<SHVkQueue> GetQueue() const { return graphicsQueue; }
|
||||||
Handle<SHVkDescriptorPool> GetDescriptorPool() const { return descPool; }
|
Handle<SHVkDescriptorPool> GetDescriptorPool() const { return descPool; }
|
||||||
Handle<SHViewport> GetDefaultViewport() const {return defaultViewport;}
|
Handle<SHViewport> GetDefaultViewport() const {return defaultViewport;}
|
||||||
|
#ifdef SHEDITOR
|
||||||
|
Handle<SHViewport> GetEditorViewport () const {return editorViewport;};
|
||||||
|
#endif
|
||||||
Handle<SHMousePickSystem> GetMousePickSystem(void) const noexcept {return mousePickSystem;};
|
Handle<SHMousePickSystem> GetMousePickSystem(void) const noexcept {return mousePickSystem;};
|
||||||
Handle<SHPostOffscreenRenderSystem> GetPostOffscreenRenderSystem(void) const noexcept {return postOffscreenRender;};
|
Handle<SHPostOffscreenRenderSystem> GetPostOffscreenRenderSystem(void) const noexcept {return postOffscreenRender;};
|
||||||
//SHRenderGraph const& GetRenderGraph(void) const noexcept;
|
//SHRenderGraph const& GetRenderGraph(void) const noexcept;
|
||||||
|
@ -306,7 +313,7 @@ namespace SHADE
|
||||||
SHWindow* window = nullptr;
|
SHWindow* window = nullptr;
|
||||||
|
|
||||||
// Middle End Resources
|
// Middle End Resources
|
||||||
ResourceManager resourceManager;
|
ResourceManager resourceManager;
|
||||||
SHMeshLibrary meshLibrary;
|
SHMeshLibrary meshLibrary;
|
||||||
SHTextureLibrary texLibrary;
|
SHTextureLibrary texLibrary;
|
||||||
SHSamplerCache samplerCache;
|
SHSamplerCache samplerCache;
|
||||||
|
@ -339,7 +346,7 @@ namespace SHADE
|
||||||
// Temp Materials
|
// Temp Materials
|
||||||
Handle<SHMaterial> defaultMaterial;
|
Handle<SHMaterial> defaultMaterial;
|
||||||
|
|
||||||
Handle<SHRenderGraph> sceneRenderGraph;
|
Handle<SHRenderGraph> worldRenderGraph;
|
||||||
|
|
||||||
// Sub systems
|
// Sub systems
|
||||||
Handle<SHMousePickSystem> mousePickSystem;
|
Handle<SHMousePickSystem> mousePickSystem;
|
||||||
|
|
|
@ -62,7 +62,10 @@ namespace SHADE
|
||||||
void SHMousePickSystem::HandleResize(void) noexcept
|
void SHMousePickSystem::HandleResize(void) noexcept
|
||||||
{
|
{
|
||||||
if (afterCopyFence)
|
if (afterCopyFence)
|
||||||
|
{
|
||||||
|
afterCopyFence->Reset();
|
||||||
afterCopyFence.Free();
|
afterCopyFence.Free();
|
||||||
|
}
|
||||||
|
|
||||||
if (imageDataDstBuffer)
|
if (imageDataDstBuffer)
|
||||||
imageDataDstBuffer.Free();
|
imageDataDstBuffer.Free();
|
||||||
|
|
|
@ -75,12 +75,15 @@ namespace SHADE
|
||||||
|
|
||||||
void SHRenderer::UpdateDataAndBind(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept
|
void SHRenderer::UpdateDataAndBind(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept
|
||||||
{
|
{
|
||||||
cpuCameraData.viewProjectionMatrix = camera->GetViewProjectionMatrix();
|
if (camera)
|
||||||
cameraBuffer->WriteToMemory(&cpuCameraData, sizeof(SHShaderCameraData), 0, cameraDataAlignedSize * frameIndex);
|
{
|
||||||
|
cpuCameraData.viewProjectionMatrix = camera->GetViewProjectionMatrix();
|
||||||
|
cameraBuffer->WriteToMemory(&cpuCameraData, sizeof(SHShaderCameraData), 0, cameraDataAlignedSize * frameIndex);
|
||||||
|
|
||||||
std::array<uint32_t, 1> dynamicOffsets{ frameIndex * cameraDataAlignedSize };
|
std::array<uint32_t, 1> dynamicOffsets{ frameIndex * cameraDataAlignedSize };
|
||||||
|
|
||||||
cmdBuffer->BindDescriptorSet(cameraDescriptorSet, vk::PipelineBindPoint::eGraphics, SHGraphicsConstants::DescriptorSetIndex::HIGH_FREQUENCY_GLOBALS, std::span{ dynamicOffsets.data(), 1 });
|
cmdBuffer->BindDescriptorSet(cameraDescriptorSet, vk::PipelineBindPoint::eGraphics, SHGraphicsConstants::DescriptorSetIndex::HIGH_FREQUENCY_GLOBALS, std::span{ dynamicOffsets.data(), 1 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHRenderer::UpdateCameraDataToBuffer(void) noexcept
|
void SHRenderer::UpdateCameraDataToBuffer(void) noexcept
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace SHADE
|
||||||
format = swapchainHdl->GetSurfaceFormatKHR().format;
|
format = swapchainHdl->GetSurfaceFormatKHR().format;
|
||||||
}
|
}
|
||||||
|
|
||||||
graphResources.try_emplace(resourceName, resourceManager.Create<SHRenderGraphResource>(logicalDeviceHdl, swapchainHdl, resourceName, typeFlags, format, w, h, levels, usageFlags, createFlags));
|
graphResources.try_emplace(resourceName, resourceManager->Create<SHRenderGraphResource>(logicalDeviceHdl, swapchainHdl, resourceName, typeFlags, format, w, h, levels, usageFlags, createFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -102,11 +102,11 @@ namespace SHADE
|
||||||
resourceAttLayouts[input.attachment] = input.layout;
|
resourceAttLayouts[input.attachment] = input.layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < node->attachmentDescriptions.size(); ++i)
|
for (uint32_t j = 0; j < node->attachmentDescriptions.size(); ++j)
|
||||||
{
|
{
|
||||||
auto& att = node->attachmentDescriptions[i];
|
auto& att = node->attachmentDescriptions[j];
|
||||||
att.initialLayout = vk::ImageLayout::eUndefined;
|
att.initialLayout = vk::ImageLayout::eUndefined;
|
||||||
att.finalLayout = resourceAttLayouts[i];
|
att.finalLayout = resourceAttLayouts[j];
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
@ -365,10 +365,9 @@ namespace SHADE
|
||||||
, swapchainHdl{ }
|
, swapchainHdl{ }
|
||||||
, nodes{}
|
, nodes{}
|
||||||
, graphResources{}
|
, graphResources{}
|
||||||
, resourceManager{}
|
, resourceManager{nullptr}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
resourceManager = std::make_shared<ResourceManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
SHRenderGraph::SHRenderGraph(SHRenderGraph&& rhs) noexcept
|
SHRenderGraph::SHRenderGraph(SHRenderGraph&& rhs) noexcept
|
||||||
|
@ -457,7 +456,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes.emplace_back(resourceManager.Create<SHRenderGraphNode>(resourceManager, logicalDeviceHdl, swapchainHdl, std::move(descInitParams), std::move(predecessors), &graphResources));
|
nodes.emplace_back(resourceManager->Create<SHRenderGraphNode>(resourceManager, logicalDeviceHdl, swapchainHdl, std::move(descInitParams), std::move(predecessors), &graphResources));
|
||||||
nodeIndexing.emplace(nodeName, static_cast<uint32_t>(nodes.size()) - 1u);
|
nodeIndexing.emplace(nodeName, static_cast<uint32_t>(nodes.size()) - 1u);
|
||||||
return nodes.at(nodeIndexing[nodeName]);
|
return nodes.at(nodeIndexing[nodeName]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -70,7 +71,7 @@ namespace SHADE
|
||||||
std::unordered_map<std::string, Handle<SHRenderGraphResource>> graphResources;
|
std::unordered_map<std::string, Handle<SHRenderGraphResource>> graphResources;
|
||||||
|
|
||||||
//! Resource library for graph handles
|
//! Resource library for graph handles
|
||||||
ResourceManager resourceManager;
|
std::shared_ptr<ResourceManager> resourceManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace SHADE
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
SHRenderGraphNode::SHRenderGraphNode(ResourceManager& rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept
|
SHRenderGraphNode::SHRenderGraphNode(std::shared_ptr<ResourceManager> rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept
|
||||||
: logicalDeviceHdl{ logicalDevice }
|
: logicalDeviceHdl{ logicalDevice }
|
||||||
, renderpass{}
|
, renderpass{}
|
||||||
, framebuffers{}
|
, framebuffers{}
|
||||||
|
@ -162,7 +162,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
SHRenderGraphNode::SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept
|
SHRenderGraphNode::SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept
|
||||||
: resourceManager{ rhs.resourceManager }
|
: resourceManager{ std::move (rhs.resourceManager) }
|
||||||
, logicalDeviceHdl{ rhs.logicalDeviceHdl }
|
, logicalDeviceHdl{ rhs.logicalDeviceHdl }
|
||||||
, renderpass{ rhs.renderpass }
|
, renderpass{ rhs.renderpass }
|
||||||
, framebuffers{ std::move(rhs.framebuffers) }
|
, framebuffers{ std::move(rhs.framebuffers) }
|
||||||
|
@ -177,6 +177,8 @@ namespace SHADE
|
||||||
, ptrToResources{ rhs.ptrToResources }
|
, ptrToResources{ rhs.ptrToResources }
|
||||||
, pipelineLibrary{ std::move(rhs.pipelineLibrary) }
|
, pipelineLibrary{ std::move(rhs.pipelineLibrary) }
|
||||||
, batcher{ std::move(rhs.batcher) }
|
, batcher{ std::move(rhs.batcher) }
|
||||||
|
, spDescs{ std::move(rhs.spDescs) }
|
||||||
|
, spDeps{ std::move(rhs.spDeps) }
|
||||||
|
|
||||||
{
|
{
|
||||||
rhs.renderpass = {};
|
rhs.renderpass = {};
|
||||||
|
@ -187,7 +189,7 @@ namespace SHADE
|
||||||
if (&rhs == this)
|
if (&rhs == this)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
resourceManager = rhs.resourceManager;
|
resourceManager = std::move(rhs.resourceManager);
|
||||||
logicalDeviceHdl = rhs.logicalDeviceHdl;
|
logicalDeviceHdl = rhs.logicalDeviceHdl;
|
||||||
renderpass = rhs.renderpass;
|
renderpass = rhs.renderpass;
|
||||||
framebuffers = std::move(rhs.framebuffers);
|
framebuffers = std::move(rhs.framebuffers);
|
||||||
|
@ -200,6 +202,9 @@ namespace SHADE
|
||||||
ptrToResources = std::move(rhs.ptrToResources);
|
ptrToResources = std::move(rhs.ptrToResources);
|
||||||
pipelineLibrary = std::move(rhs.pipelineLibrary);
|
pipelineLibrary = std::move(rhs.pipelineLibrary);
|
||||||
batcher = std::move(rhs.batcher);
|
batcher = std::move(rhs.batcher);
|
||||||
|
spDescs = std::move(rhs.spDescs);
|
||||||
|
spDeps = std::move(rhs.spDeps);
|
||||||
|
|
||||||
|
|
||||||
rhs.renderpass = {};
|
rhs.renderpass = {};
|
||||||
|
|
||||||
|
@ -230,10 +235,10 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add subpass to container and create mapping for it
|
// Add subpass to container and create mapping for it
|
||||||
subpasses.emplace_back(resourceManager.Create<SHSubpass>(resourceManager, GetHandle(), subpasses.size(), &resourceAttachmentMapping, ptrToResources));
|
subpasses.emplace_back(resourceManager->Create<SHSubpass>(GetHandle(), subpasses.size(), &resourceAttachmentMapping, ptrToResources));
|
||||||
subpassIndexing.try_emplace(subpassName, static_cast<uint32_t>(subpasses.size()) - 1u);
|
subpassIndexing.try_emplace(subpassName, static_cast<uint32_t>(subpasses.size()) - 1u);
|
||||||
Handle<SHSubpass> subpass = subpasses.back();
|
Handle<SHSubpass> subpass = subpasses.back();
|
||||||
subpass->Init(resourceManager);
|
subpass->Init(*resourceManager);
|
||||||
|
|
||||||
// Register the SuperBatch
|
// Register the SuperBatch
|
||||||
batcher.RegisterSuperBatch(subpass->GetSuperBatch());
|
batcher.RegisterSuperBatch(subpass->GetSuperBatch());
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* PRIVATE MEMBER VARIABLES */
|
/* PRIVATE MEMBER VARIABLES */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
ResourceManager& resourceManager;
|
std::shared_ptr<ResourceManager> resourceManager;
|
||||||
|
|
||||||
//! For Vulkan object creation
|
//! For Vulkan object creation
|
||||||
Handle<SHVkLogicalDevice> logicalDeviceHdl;
|
Handle<SHVkLogicalDevice> logicalDeviceHdl;
|
||||||
|
@ -88,7 +88,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* CTORS AND DTORS */
|
/* CTORS AND DTORS */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
SHRenderGraphNode(ResourceManager& rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept;
|
SHRenderGraphNode(std::shared_ptr<ResourceManager> rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept;
|
||||||
SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept;
|
SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept;
|
||||||
SHRenderGraphNode& operator= (SHRenderGraphNode&& rhs) noexcept;
|
SHRenderGraphNode& operator= (SHRenderGraphNode&& rhs) noexcept;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace SHADE
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
SHSubpass::SHSubpass(ResourceManager& rm, Handle<SHRenderGraphNode> const& parent, uint32_t index, std::unordered_map<uint64_t, uint32_t> const* mapping, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept
|
SHSubpass::SHSubpass(Handle<SHRenderGraphNode> const& parent, uint32_t index, std::unordered_map<uint64_t, uint32_t> const* mapping, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept
|
||||||
: resourceAttachmentMapping{ mapping }
|
: resourceAttachmentMapping{ mapping }
|
||||||
, ptrToResources{ resources }
|
, ptrToResources{ resources }
|
||||||
, parentNode{ parent }
|
, parentNode{ parent }
|
||||||
|
@ -55,6 +55,8 @@ namespace SHADE
|
||||||
, inputReferences{ std::move(rhs.inputReferences) }
|
, inputReferences{ std::move(rhs.inputReferences) }
|
||||||
, resourceAttachmentMapping{ rhs.resourceAttachmentMapping }
|
, resourceAttachmentMapping{ rhs.resourceAttachmentMapping }
|
||||||
, ptrToResources{ rhs.ptrToResources }
|
, ptrToResources{ rhs.ptrToResources }
|
||||||
|
, descriptorSetLayout{ rhs.descriptorSetLayout }
|
||||||
|
, exteriorDrawCalls{ std::move (rhs.exteriorDrawCalls) }
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,6 +85,8 @@ namespace SHADE
|
||||||
inputReferences = std::move(rhs.inputReferences);
|
inputReferences = std::move(rhs.inputReferences);
|
||||||
resourceAttachmentMapping = rhs.resourceAttachmentMapping;
|
resourceAttachmentMapping = rhs.resourceAttachmentMapping;
|
||||||
ptrToResources = rhs.ptrToResources;
|
ptrToResources = rhs.ptrToResources;
|
||||||
|
descriptorSetLayout = rhs.descriptorSetLayout;
|
||||||
|
exteriorDrawCalls = std::move(rhs.exteriorDrawCalls);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* CTORS AND DTORS */
|
/* CTORS AND DTORS */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
SHSubpass(ResourceManager& rm, Handle<SHRenderGraphNode> const& parent, uint32_t index, std::unordered_map<uint64_t, uint32_t> const* mapping, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* ptrToResources) noexcept;
|
SHSubpass(Handle<SHRenderGraphNode> const& parent, uint32_t index, std::unordered_map<uint64_t, uint32_t> const* mapping, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* ptrToResources) noexcept;
|
||||||
SHSubpass(SHSubpass&& rhs) noexcept;
|
SHSubpass(SHSubpass&& rhs) noexcept;
|
||||||
SHSubpass& operator=(SHSubpass&& rhs) noexcept;
|
SHSubpass& operator=(SHSubpass&& rhs) noexcept;
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,8 @@ namespace SHADE
|
||||||
|
|
||||||
SHVkRenderpass::~SHVkRenderpass(void) noexcept
|
SHVkRenderpass::~SHVkRenderpass(void) noexcept
|
||||||
{
|
{
|
||||||
logicalDeviceHdl->GetVkLogicalDevice().destroyRenderPass(vkRenderpass, nullptr);
|
if (vkRenderpass)
|
||||||
|
logicalDeviceHdl->GetVkLogicalDevice().destroyRenderPass(vkRenderpass, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,9 @@ namespace SHADE
|
||||||
SparseSet();
|
SparseSet();
|
||||||
~SparseSet() = default;
|
~SparseSet() = default;
|
||||||
|
|
||||||
// Disallow moving or copying
|
//// Disallow moving or copying
|
||||||
SparseSet(const SparseSet&) = delete;
|
//SparseSet(const SparseSet&) = delete;
|
||||||
SparseSet(SparseSet&&) = delete;
|
//SparseSet(SparseSet&&) = delete;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
|
|
Loading…
Reference in New Issue