Fixed some render graph ctors and added if checks for buffers
This commit is contained in:
parent
335c19cfc7
commit
8ac2c39e2b
|
@ -40,8 +40,8 @@ namespace Sandbox
|
||||||
|
|
||||||
// Create Stress Test Objects
|
// Create Stress Test Objects
|
||||||
static const SHVec3 TEST_OBJ_SCALE = { 0.2f, 0.2f, 0.2f };
|
static const SHVec3 TEST_OBJ_SCALE = { 0.2f, 0.2f, 0.2f };
|
||||||
constexpr int NUM_ROWS = 200;
|
constexpr int NUM_ROWS = 1;
|
||||||
constexpr int NUM_COLS = 100;
|
constexpr int NUM_COLS = 1;
|
||||||
static const SHVec3 TEST_OBJ_SPACING = { 1.0f, 1.0f, 1.0f };
|
static const SHVec3 TEST_OBJ_SPACING = { 1.0f, 1.0f, 1.0f };
|
||||||
static const SHVec3 TEST_OBJ_START_POS = { - (NUM_COLS / 2 * TEST_OBJ_SPACING.x ), 0.0f, 0.0f };
|
static const SHVec3 TEST_OBJ_START_POS = { - (NUM_COLS / 2 * TEST_OBJ_SPACING.x ), 0.0f, 0.0f };
|
||||||
for (int z = 0; z < NUM_ROWS; ++z)
|
for (int z = 0; z < NUM_ROWS; ++z)
|
||||||
|
|
|
@ -325,8 +325,11 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (cmdBufferState == SH_CMD_BUFFER_STATE::RECORDING)
|
if (cmdBufferState == SH_CMD_BUFFER_STATE::RECORDING)
|
||||||
{
|
{
|
||||||
auto bufferHandle = buffer->GetVkBuffer();
|
if (buffer)
|
||||||
vkCommandBuffer.bindVertexBuffers (bindingPoint, 1, &bufferHandle, &offset);
|
{
|
||||||
|
auto bufferHandle = buffer->GetVkBuffer();
|
||||||
|
vkCommandBuffer.bindVertexBuffers (bindingPoint, 1, &bufferHandle, &offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +448,8 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vkCommandBuffer.drawIndexedIndirect(indirectDrawData->GetVkBuffer(), 0, drawCount, sizeof(vk::DrawIndexedIndirectCommand));
|
if (indirectDrawData)
|
||||||
|
vkCommandBuffer.drawIndexedIndirect(indirectDrawData->GetVkBuffer(), 0, drawCount, sizeof(vk::DrawIndexedIndirectCommand));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHVkCommandBuffer::CopyBufferToImage(const vk::Buffer& src, const vk::Image& dst, const std::vector<vk::BufferImageCopy>& copyInfo)
|
void SHVkCommandBuffer::CopyBufferToImage(const vk::Buffer& src, const vk::Image& dst, const std::vector<vk::BufferImageCopy>& copyInfo)
|
||||||
|
|
|
@ -130,7 +130,8 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer to GPU
|
// Transfer to GPU
|
||||||
transformDataBuffer[frameIndex]->WriteToMemory(transformData.data(), transformData.size() * sizeof(SHMatrix), 0, 0);
|
if (transformDataBuffer[frameIndex])
|
||||||
|
transformDataBuffer[frameIndex]->WriteToMemory(transformData.data(), transformData.size() * sizeof(SHMatrix), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHBatch::Build(Handle<SHVkLogicalDevice> device, uint32_t frameIndex)
|
void SHBatch::Build(Handle<SHVkLogicalDevice> device, uint32_t frameIndex)
|
||||||
|
|
|
@ -135,11 +135,13 @@ namespace SHADE
|
||||||
//worldRenderGraph->AddResource("Position", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
//worldRenderGraph->AddResource("Position", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
//worldRenderGraph->AddResource("Normals", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
//worldRenderGraph->AddResource("Normals", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
//worldRenderGraph->AddResource("Composite", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
//worldRenderGraph->AddResource("Composite", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
|
worldRenderGraph->AddResource("Scene", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eB8G8R8A8Unorm);
|
||||||
worldRenderGraph->AddResource("Present", SH_ATT_DESC_TYPE::COLOR_PRESENT, windowDims.first, windowDims.second);
|
worldRenderGraph->AddResource("Present", SH_ATT_DESC_TYPE::COLOR_PRESENT, windowDims.first, windowDims.second);
|
||||||
auto node = worldRenderGraph->AddNode("G-Buffer", { /*"Composite", "Position", "Normals",*/ "Present" }, {}); // no predecessors
|
auto node = worldRenderGraph->AddNode("G-Buffer", { /*"Composite", "Position", */"Present" }, {}); // 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("Present");
|
gBufferWriteSubpass->AddColorOutput("Present");
|
||||||
//writeSubpass->AddColorOutput("Normals");
|
//writeSubpass->AddColorOutput("Normals");
|
||||||
|
|
||||||
|
@ -149,11 +151,11 @@ namespace SHADE
|
||||||
//compositeSubpass->AddInput("Normals");
|
//compositeSubpass->AddInput("Normals");
|
||||||
//compositeSubpass->AddInput("Position");
|
//compositeSubpass->AddInput("Position");
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
//#ifdef SHEDITOR
|
||||||
auto imguiNode = worldRenderGraph->AddNode("ImGui Node", { "Present" }, {});
|
auto imguiNode = worldRenderGraph->AddNode("ImGui Node", { "Present" }, {});
|
||||||
auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
|
auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
|
||||||
imguiSubpass->AddColorOutput("Present");
|
imguiSubpass->AddColorOutput("Present");
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
worldRenderGraph->Generate();
|
worldRenderGraph->Generate();
|
||||||
|
|
||||||
|
|
|
@ -524,6 +524,7 @@ namespace SHADE
|
||||||
, configured{ rhs.configured }
|
, configured{ rhs.configured }
|
||||||
, executed{ rhs.executed }
|
, executed{ rhs.executed }
|
||||||
, ptrToResources{ rhs.ptrToResources }
|
, ptrToResources{ rhs.ptrToResources }
|
||||||
|
, pipelineLibrary{ std::move (rhs.pipelineLibrary) }
|
||||||
{
|
{
|
||||||
rhs.renderpass = {};
|
rhs.renderpass = {};
|
||||||
}
|
}
|
||||||
|
@ -544,6 +545,7 @@ namespace SHADE
|
||||||
resourceAttachmentMapping = std::move(rhs.resourceAttachmentMapping);
|
resourceAttachmentMapping = std::move(rhs.resourceAttachmentMapping);
|
||||||
subpassIndexing = std::move(rhs.subpassIndexing);
|
subpassIndexing = std::move(rhs.subpassIndexing);
|
||||||
ptrToResources = std::move(rhs.ptrToResources);
|
ptrToResources = std::move(rhs.ptrToResources);
|
||||||
|
pipelineLibrary = std::move (rhs.pipelineLibrary);
|
||||||
|
|
||||||
rhs.renderpass = {};
|
rhs.renderpass = {};
|
||||||
|
|
||||||
|
@ -993,6 +995,34 @@ namespace SHADE
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHRenderGraph::SHRenderGraph(SHRenderGraph&& rhs) noexcept
|
||||||
|
: logicalDeviceHdl{ rhs.logicalDeviceHdl }
|
||||||
|
, swapchainHdl{ rhs.swapchainHdl}
|
||||||
|
, nodeIndexing {std::move (rhs.nodeIndexing)}
|
||||||
|
, nodes{ std::move (rhs.nodes)}
|
||||||
|
, graphResources{std::move(rhs.graphResources)}
|
||||||
|
, resourceManager{std::move (rhs.resourceManager)}
|
||||||
|
, globalData {rhs.globalData}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SHRenderGraph& SHRenderGraph::operator=(SHRenderGraph&& rhs) noexcept
|
||||||
|
{
|
||||||
|
if (&rhs == this)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
logicalDeviceHdl = rhs.logicalDeviceHdl;
|
||||||
|
swapchainHdl = rhs.swapchainHdl;
|
||||||
|
nodeIndexing = std::move(rhs.nodeIndexing);
|
||||||
|
nodes = std::move(rhs.nodes);
|
||||||
|
graphResources = std::move(rhs.graphResources);
|
||||||
|
resourceManager = std::move(rhs.resourceManager);
|
||||||
|
globalData = rhs.globalData;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
|
|
|
@ -279,6 +279,9 @@ namespace SHADE
|
||||||
/* CTORS AND DTORS */
|
/* CTORS AND DTORS */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
SHRenderGraph (void) noexcept;
|
SHRenderGraph (void) noexcept;
|
||||||
|
SHRenderGraph(SHRenderGraph&& rhs) noexcept;
|
||||||
|
SHRenderGraph& operator=(SHRenderGraph&& rhs) noexcept;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* PUBLIC MEMBER FUNCTIONS */
|
/* PUBLIC MEMBER FUNCTIONS */
|
||||||
|
|
Loading…
Reference in New Issue