WIP
This commit is contained in:
parent
fc5ff763f3
commit
dc6289e8cf
|
@ -40,8 +40,8 @@ namespace Sandbox
|
|||
|
||||
// Create Stress Test Objects
|
||||
static const SHVec3 TEST_OBJ_SCALE = { 0.2f, 0.2f, 0.2f };
|
||||
constexpr int NUM_ROWS = 200;
|
||||
constexpr int NUM_COLS = 100;
|
||||
constexpr int NUM_ROWS = 1;
|
||||
constexpr int NUM_COLS = 1;
|
||||
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 };
|
||||
for (int z = 0; z < NUM_ROWS; ++z)
|
||||
|
|
|
@ -192,7 +192,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Begin the render pass
|
||||
vkCommandBuffer.beginRenderPass (&renderPassInfo, vk::SubpassContents::eInline);
|
||||
vkCommandBuffer.beginRenderPass(&renderPassInfo, vk::SubpassContents::eInline);
|
||||
|
||||
}
|
||||
|
||||
|
@ -321,12 +321,15 @@ namespace SHADE
|
|||
|
||||
*/
|
||||
/***************************************************************************/
|
||||
void SHVkCommandBuffer::BindVertexBuffer (uint32_t bindingPoint, Handle<SHVkBuffer> const& buffer, vk::DeviceSize offset) noexcept
|
||||
void SHVkCommandBuffer::BindVertexBuffer(uint32_t bindingPoint, Handle<SHVkBuffer> const& buffer, vk::DeviceSize offset) noexcept
|
||||
{
|
||||
if (cmdBufferState == SH_CMD_BUFFER_STATE::RECORDING)
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
auto bufferHandle = buffer->GetVkBuffer();
|
||||
vkCommandBuffer.bindVertexBuffers (bindingPoint, 1, &bufferHandle, &offset);
|
||||
vkCommandBuffer.bindVertexBuffers(bindingPoint, 1, &bufferHandle, &offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,13 +354,13 @@ namespace SHADE
|
|||
if (cmdBufferState == SH_CMD_BUFFER_STATE::RECORDING)
|
||||
{
|
||||
auto bufferHandle = buffer->GetVkBuffer();
|
||||
vkCommandBuffer.bindIndexBuffer (bufferHandle, sizeof (uint32_t) * startingIndex, vk::IndexType::eUint32);
|
||||
vkCommandBuffer.bindIndexBuffer(bufferHandle, sizeof(uint32_t) * startingIndex, vk::IndexType::eUint32);
|
||||
}
|
||||
}
|
||||
|
||||
void SHVkCommandBuffer::BindDescriptorSet(Handle<SHVkDescriptorSetGroup> descSetGroup, vk::PipelineBindPoint bindPoint, uint32_t firstSet, std::span<uint32_t> dynamicOffsets)
|
||||
{
|
||||
vkCommandBuffer.bindDescriptorSets (bindPoint, boundPipelineLayoutHdl->GetVkPipelineLayout(), firstSet, descSetGroup->GetVkHandle(), dynamicOffsets);
|
||||
vkCommandBuffer.bindDescriptorSets(bindPoint, boundPipelineLayoutHdl->GetVkPipelineLayout(), firstSet, descSetGroup->GetVkHandle(), dynamicOffsets);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -387,7 +390,7 @@ namespace SHADE
|
|||
SHLOG_ERROR("Command buffer must have started recording before a pipeline can be bound. ");
|
||||
return;
|
||||
}
|
||||
vkCommandBuffer.draw (vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
vkCommandBuffer.draw(vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -410,7 +413,7 @@ namespace SHADE
|
|||
|
||||
*/
|
||||
/***************************************************************************/
|
||||
void SHVkCommandBuffer::DrawIndexed (uint32_t indexCount, uint32_t firstIndex, uint32_t vertexOffset) const noexcept
|
||||
void SHVkCommandBuffer::DrawIndexed(uint32_t indexCount, uint32_t firstIndex, uint32_t vertexOffset) const noexcept
|
||||
{
|
||||
if (cmdBufferState != SH_CMD_BUFFER_STATE::RECORDING)
|
||||
{
|
||||
|
@ -445,6 +448,7 @@ namespace SHADE
|
|||
return;
|
||||
}
|
||||
|
||||
if (indirectDrawData)
|
||||
vkCommandBuffer.drawIndexedIndirect(indirectDrawData->GetVkBuffer(), 0, drawCount, sizeof(vk::DrawIndexedIndirectCommand));
|
||||
}
|
||||
|
||||
|
@ -466,7 +470,7 @@ namespace SHADE
|
|||
std::vector<vk::ImageMemoryBarrier> const& imageMemoryBarriers
|
||||
) const noexcept
|
||||
{
|
||||
vkCommandBuffer.pipelineBarrier (
|
||||
vkCommandBuffer.pipelineBarrier(
|
||||
srcStage,
|
||||
dstStage,
|
||||
deps,
|
||||
|
@ -616,7 +620,7 @@ namespace SHADE
|
|||
, parentPoolResetMode{ SH_CMD_POOL_RESET::POOL_BASED }
|
||||
, usageFlags{}
|
||||
, commandBufferCount{ 0 }
|
||||
, parentPool{commandPool}
|
||||
, parentPool{ commandPool }
|
||||
, pushConstantData{}
|
||||
|
||||
{
|
||||
|
@ -657,14 +661,14 @@ namespace SHADE
|
|||
commandBufferType = type;
|
||||
commandBufferCount = allocateInfo.commandBufferCount;
|
||||
|
||||
if (parentPool->GetIsTransient ())
|
||||
if (parentPool->GetIsTransient())
|
||||
usageFlags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
|
||||
|
||||
if (commandBufferType == SH_CMD_BUFFER_TYPE::SECONDARY)
|
||||
usageFlags |= vk::CommandBufferUsageFlagBits::eRenderPassContinue;
|
||||
|
||||
// Reset all the push constant data to 0
|
||||
memset (pushConstantData, 0, PUSH_CONSTANT_SIZE);
|
||||
memset(pushConstantData, 0, PUSH_CONSTANT_SIZE);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -679,16 +683,16 @@ namespace SHADE
|
|||
*/
|
||||
/***************************************************************************/
|
||||
SHVkCommandBuffer::SHVkCommandBuffer(SHVkCommandBuffer&& rhs) noexcept
|
||||
: vkCommandBuffer {std::move (rhs.vkCommandBuffer)}
|
||||
, cmdBufferState {rhs.cmdBufferState}
|
||||
, commandBufferType {rhs.commandBufferType}
|
||||
, parentPoolResetMode {rhs.parentPoolResetMode}
|
||||
, usageFlags {rhs.usageFlags}
|
||||
, commandBufferCount {rhs.commandBufferCount}
|
||||
, parentPool {rhs.parentPool}
|
||||
, boundPipelineLayoutHdl{rhs.boundPipelineLayoutHdl }
|
||||
: vkCommandBuffer{ std::move(rhs.vkCommandBuffer) }
|
||||
, cmdBufferState{ rhs.cmdBufferState }
|
||||
, commandBufferType{ rhs.commandBufferType }
|
||||
, parentPoolResetMode{ rhs.parentPoolResetMode }
|
||||
, usageFlags{ rhs.usageFlags }
|
||||
, commandBufferCount{ rhs.commandBufferCount }
|
||||
, parentPool{ rhs.parentPool }
|
||||
, boundPipelineLayoutHdl{ rhs.boundPipelineLayoutHdl }
|
||||
{
|
||||
memcpy (pushConstantData, rhs.pushConstantData, PUSH_CONSTANT_SIZE);
|
||||
memcpy(pushConstantData, rhs.pushConstantData, PUSH_CONSTANT_SIZE);
|
||||
|
||||
rhs.vkCommandBuffer = VK_NULL_HANDLE;
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Transfer to GPU
|
||||
if (transformDataBuffer[frameIndex])
|
||||
transformDataBuffer[frameIndex]->WriteToMemory(transformData.data(), static_cast<uint32_t>(transformData.size() * sizeof(SHMatrix)), 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -150,9 +150,9 @@ namespace SHADE
|
|||
//compositeSubpass->AddInput("Position");
|
||||
|
||||
// TODO: Use macro to add this node when SH_EDITOR is enabled
|
||||
//auto imguiNode = worldRenderGraph->AddNode("ImGui Node", { "Present" }, {});
|
||||
//auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
|
||||
//imguiSubpass->AddColorOutput("Present");
|
||||
auto imguiNode = worldRenderGraph->AddNode("ImGui Node", { "Present" }, {});
|
||||
auto imguiSubpass = imguiNode->AddSubpass("ImGui Draw");
|
||||
imguiSubpass->AddColorOutput("Present");
|
||||
|
||||
worldRenderGraph->Generate();
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ namespace SHADE
|
|||
|
||||
void SHSubpass::Execute(Handle<SHVkCommandBuffer>& commandBuffer, uint32_t frameIndex) noexcept
|
||||
{
|
||||
// Ensure updated transforms and materials are provided
|
||||
// Ensure correct transforms are provided
|
||||
superBatch->UpdateBuffers(frameIndex);
|
||||
|
||||
// Draw all the batches
|
||||
|
@ -524,6 +524,7 @@ namespace SHADE
|
|||
, configured{ rhs.configured }
|
||||
, executed{ rhs.executed }
|
||||
, ptrToResources{ rhs.ptrToResources }
|
||||
, pipelineLibrary{ std::move(rhs.pipelineLibrary) }
|
||||
{
|
||||
rhs.renderpass = {};
|
||||
}
|
||||
|
@ -544,6 +545,7 @@ namespace SHADE
|
|||
resourceAttachmentMapping = std::move(rhs.resourceAttachmentMapping);
|
||||
subpassIndexing = std::move(rhs.subpassIndexing);
|
||||
ptrToResources = std::move(rhs.ptrToResources);
|
||||
pipelineLibrary = std::move(rhs.pipelineLibrary);
|
||||
|
||||
rhs.renderpass = {};
|
||||
|
||||
|
@ -625,7 +627,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
void SHRenderGraphNode::FinaliseBatch(uint32_t frameIndex)
|
||||
{
|
||||
{
|
||||
batcher.FinaliseBatches(logicalDeviceHdl, frameIndex);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
|
||||
|
@ -1084,7 +1114,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
void SHRenderGraph::FinaliseBatch(uint32_t frameIndex)
|
||||
{
|
||||
{
|
||||
for (auto& node : nodes)
|
||||
{
|
||||
node->FinaliseBatch(frameIndex);
|
||||
|
|
|
@ -279,6 +279,8 @@ namespace SHADE
|
|||
/* CTORS AND DTORS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
SHRenderGraph (void) noexcept;
|
||||
SHRenderGraph(SHRenderGraph&& rhs) noexcept;
|
||||
SHRenderGraph& operator=(SHRenderGraph&& rhs) noexcept;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* PUBLIC MEMBER FUNCTIONS */
|
||||
|
|
Loading…
Reference in New Issue