Made SHGraphicsGlobalData static and modified SHBatch to generate and bind material descriptor set
This commit is contained in:
parent
76617ae571
commit
b3417c2011
|
@ -41,7 +41,8 @@ namespace SHADE
|
|||
{ vk::DescriptorType::eCombinedImageSampler, 100 },
|
||||
{ vk::DescriptorType::eUniformBuffer, 100 },
|
||||
{ vk::DescriptorType::eUniformBufferDynamic, 100 },
|
||||
{ vk::DescriptorType::eStorageImage, 100}
|
||||
{ vk::DescriptorType::eStorageImage, 100},
|
||||
{ vk::DescriptorType::eStorageBufferDynamic, 100 }
|
||||
};
|
||||
/// <summary>
|
||||
/// Maximum number of descriptor sets allowed
|
||||
|
|
|
@ -22,8 +22,11 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||
#include "Math/Transform/SHTransformComponent.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -120,7 +123,7 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
void SHBatch::UpdateMaterialBuffer(uint32_t frameIndex)
|
||||
void SHBatch::UpdateMaterialBuffer(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool)
|
||||
{
|
||||
if (frameIndex >= SHGraphicsConstants::NUM_FRAME_BUFFERS)
|
||||
{
|
||||
|
@ -154,21 +157,17 @@ namespace SHADE
|
|||
if (!matBufferDirty[frameIndex])
|
||||
return;
|
||||
|
||||
// Build CPI Buffer
|
||||
// Build CPU Buffer
|
||||
char* propsCurrPtr = matPropsData.get();
|
||||
for (auto& subBatch : subBatches)
|
||||
for (const SHRenderable* renderable : subBatch.Renderables)
|
||||
{
|
||||
renderable->GetMaterial()->ExportProperties(propsCurrPtr);
|
||||
propsCurrPtr += singleMatPropSize;
|
||||
propsCurrPtr += singleMatPropAlignedSize;
|
||||
}
|
||||
|
||||
// Transfer to GPU
|
||||
SHVkUtil::EnsureBufferAndCopyHostVisibleData
|
||||
(
|
||||
device, matPropsBuffer[frameIndex], matPropsData.get(), static_cast<uint32_t>(matPropsDataSize),
|
||||
vk::BufferUsageFlagBits::eStorageBuffer
|
||||
);
|
||||
rebuildMaterialBuffers(frameIndex, descPool);
|
||||
|
||||
// This frame is updated
|
||||
matBufferDirty[frameIndex] = false;
|
||||
|
@ -207,7 +206,7 @@ namespace SHADE
|
|||
transformDataBuffer[frameIndex]->WriteToMemory(transformData.data(), static_cast<uint32_t>(transformData.size() * sizeof(SHMatrix)), 0, 0);
|
||||
}
|
||||
|
||||
void SHBatch::Build(Handle<SHVkLogicalDevice> _device, uint32_t frameIndex)
|
||||
void SHBatch::Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex)
|
||||
{
|
||||
if (frameIndex >= SHGraphicsConstants::NUM_FRAME_BUFFERS)
|
||||
{
|
||||
|
@ -247,7 +246,8 @@ namespace SHADE
|
|||
if (!EMPTY_MAT_PROPS)
|
||||
{
|
||||
singleMatPropSize = SHADER_INFO->GetBytesRequired();
|
||||
matPropTotalBytes = drawData.size() * singleMatPropSize;
|
||||
singleMatPropAlignedSize = device->PadSSBOSize(singleMatPropSize);
|
||||
matPropTotalBytes = drawData.size() * singleMatPropAlignedSize;
|
||||
if (matPropsDataSize < matPropTotalBytes)
|
||||
{
|
||||
matPropsData.reset(new char[matPropTotalBytes]);
|
||||
|
@ -289,7 +289,7 @@ namespace SHADE
|
|||
if (!EMPTY_MAT_PROPS)
|
||||
{
|
||||
renderable->GetMaterial()->ExportProperties(propsCurrPtr);
|
||||
propsCurrPtr += singleMatPropSize;
|
||||
propsCurrPtr += singleMatPropAlignedSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,30 +304,24 @@ namespace SHADE
|
|||
const uint32_t DRAW_DATA_BYTES = static_cast<uint32_t>(drawData.size() * sizeof(vk::DrawIndexedIndirectCommand));
|
||||
SHVkUtil::EnsureBufferAndCopyHostVisibleData
|
||||
(
|
||||
_device, drawDataBuffer[frameIndex], drawData.data(), DRAW_DATA_BYTES,
|
||||
device, drawDataBuffer[frameIndex], drawData.data(), DRAW_DATA_BYTES,
|
||||
BuffUsage::eIndirectBuffer
|
||||
);
|
||||
// - Transform Buffer
|
||||
const uint32_t TF_DATA_BYTES = static_cast<uint32_t>(transformData.size() * sizeof(SHMatrix));
|
||||
SHVkUtil::EnsureBufferAndCopyHostVisibleData
|
||||
(
|
||||
_device, transformDataBuffer[frameIndex], transformData.data(), TF_DATA_BYTES,
|
||||
device, transformDataBuffer[frameIndex], transformData.data(), TF_DATA_BYTES,
|
||||
BuffUsage::eVertexBuffer
|
||||
);
|
||||
// - Material Properties Buffer
|
||||
if (matPropsData)
|
||||
{
|
||||
SHVkUtil::EnsureBufferAndCopyHostVisibleData
|
||||
(
|
||||
_device, matPropsBuffer[frameIndex], matPropsData.get(), static_cast<uint32_t>(matPropsDataSize),
|
||||
BuffUsage::eStorageBuffer
|
||||
);
|
||||
}
|
||||
rebuildMaterialBuffers(frameIndex, descPool);
|
||||
|
||||
// Mark this frame as no longer dirty
|
||||
isDirty[frameIndex] = false;
|
||||
|
||||
// Save logical device
|
||||
this->device = _device;
|
||||
this->device = device;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -341,8 +335,20 @@ namespace SHADE
|
|||
return;
|
||||
}
|
||||
|
||||
// Bind all required objects before drawing
|
||||
static std::array<uint32_t, 1> dynamicOffset { 0 };
|
||||
cmdBuffer->BindPipeline(pipeline);
|
||||
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::TRANSFORM, transformDataBuffer[frameIndex], 0);
|
||||
if (matPropsDescSet[frameIndex])
|
||||
{
|
||||
cmdBuffer->BindDescriptorSet
|
||||
(
|
||||
matPropsDescSet[frameIndex],
|
||||
vk::PipelineBindPoint::eGraphics,
|
||||
0,
|
||||
dynamicOffset
|
||||
);
|
||||
}
|
||||
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
|
||||
}
|
||||
|
||||
|
@ -355,4 +361,39 @@ namespace SHADE
|
|||
dirt = true;
|
||||
isCPUBuffersDirty = true;
|
||||
}
|
||||
|
||||
void SHBatch::rebuildMaterialBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool)
|
||||
{
|
||||
if (matPropsData)
|
||||
{
|
||||
SHVkUtil::EnsureBufferAndCopyHostVisibleData
|
||||
(
|
||||
device, matPropsBuffer[frameIndex], matPropsData.get(), static_cast<uint32_t>(matPropsDataSize),
|
||||
vk::BufferUsageFlagBits::eStorageBuffer
|
||||
);
|
||||
|
||||
if (!matPropsDescSet[frameIndex])
|
||||
{
|
||||
matPropsDescSet[frameIndex] = descPool->Allocate
|
||||
(
|
||||
{ SHGraphicsGlobalData::GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE] },
|
||||
{ static_cast<uint32_t>(drawData.size()) }
|
||||
);
|
||||
}
|
||||
std::array<Handle<SHVkBuffer>, 1> bufferList = { matPropsBuffer[frameIndex] };
|
||||
matPropsDescSet[frameIndex]->ModifyWriteDescBuffer
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA,
|
||||
bufferList,
|
||||
0, 1
|
||||
);
|
||||
matPropsDescSet[frameIndex]->UpdateDescriptorSetBuffer
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
|
||||
SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace SHADE
|
|||
class SHRenderable;
|
||||
class SHVkLogicalDevice;
|
||||
class SHMaterialInstance;
|
||||
class SHVkDescriptorSetGroup;
|
||||
class SHVkDescriptorPool;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
|
@ -74,9 +76,9 @@ namespace SHADE
|
|||
void Add(const SHRenderable* renderable);
|
||||
void Remove(const SHRenderable* renderable);
|
||||
void Clear();
|
||||
void UpdateMaterialBuffer(uint32_t frameIndex);
|
||||
void UpdateMaterialBuffer(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||
void UpdateTransformBuffer(uint32_t frameIndex);
|
||||
void Build(Handle<SHVkLogicalDevice> device, uint32_t frameIndex);
|
||||
void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) ;
|
||||
void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
@ -84,34 +86,44 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------*/
|
||||
Handle<SHVkPipeline> GetPipeline() const noexcept { return pipeline; };
|
||||
|
||||
private:
|
||||
private:
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Type Definition */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
using TripleBool = std::array<bool, SHGraphicsConstants::NUM_FRAME_BUFFERS>;
|
||||
using TripleBuffer = std::array<Handle<SHVkBuffer>, SHGraphicsConstants::NUM_FRAME_BUFFERS>;
|
||||
using TripleDescSet = std::array<Handle<SHVkDescriptorSetGroup>, SHGraphicsConstants::NUM_FRAME_BUFFERS>;
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Data Members */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
// Resources
|
||||
Handle<SHVkLogicalDevice> device;
|
||||
Handle<SHVkLogicalDevice> device;
|
||||
// Batch Properties
|
||||
Handle<SHVkPipeline> pipeline;
|
||||
Handle<SHVkPipeline> pipeline;
|
||||
std::unordered_set<Handle<SHMaterialInstance>> referencedMatInstances;
|
||||
std::array<bool, SHGraphicsConstants::NUM_FRAME_BUFFERS> matBufferDirty;
|
||||
TripleBool matBufferDirty;
|
||||
// Batch Tree
|
||||
std::vector<SHSubBatch> subBatches;
|
||||
std::array<bool, SHGraphicsConstants::NUM_FRAME_BUFFERS> isDirty;
|
||||
// CPU Buffers
|
||||
std::vector<vk::DrawIndexedIndirectCommand> drawData;
|
||||
std::vector<SHMatrix> transformData;
|
||||
std::unique_ptr<char> matPropsData;
|
||||
Byte matPropsDataSize = 0;
|
||||
Byte singleMatPropSize = 0;
|
||||
bool isCPUBuffersDirty = true;
|
||||
// GPU Buffers
|
||||
std::array<Handle<SHVkBuffer>, SHGraphicsConstants::NUM_FRAME_BUFFERS> drawDataBuffer;
|
||||
std::array<Handle<SHVkBuffer>, SHGraphicsConstants::NUM_FRAME_BUFFERS> transformDataBuffer;
|
||||
std::array<Handle<SHVkBuffer>, SHGraphicsConstants::NUM_FRAME_BUFFERS> matPropsBuffer;
|
||||
std::vector<SHSubBatch> subBatches;
|
||||
TripleBool isDirty;
|
||||
// CPU Buffers
|
||||
std::vector<vk::DrawIndexedIndirectCommand> drawData;
|
||||
std::vector<SHMatrix> transformData;
|
||||
std::unique_ptr<char> matPropsData;
|
||||
Byte matPropsDataSize = 0;
|
||||
Byte singleMatPropAlignedSize = 0;
|
||||
Byte singleMatPropSize = 0;
|
||||
bool isCPUBuffersDirty = true;
|
||||
// GPU Buffers
|
||||
TripleBuffer drawDataBuffer;
|
||||
TripleBuffer transformDataBuffer;
|
||||
TripleBuffer matPropsBuffer;
|
||||
TripleDescSet matPropsDescSet;
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
void setAllDirtyFlags();
|
||||
void rebuildMaterialBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -91,12 +91,12 @@ namespace SHADE
|
|||
(*superBatch)->Remove(renderable);
|
||||
}
|
||||
|
||||
void SHBatcher::FinaliseBatches(Handle<SHVkLogicalDevice> device, uint32_t frameIndex)
|
||||
void SHBatcher::FinaliseBatches(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex)
|
||||
{
|
||||
// Build SuperBatches
|
||||
for (auto& batch : superBatches)
|
||||
{
|
||||
batch->Build(device, frameIndex);
|
||||
batch->Build(device, descPool, frameIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,11 +109,11 @@ namespace SHADE
|
|||
superBatches.clear();
|
||||
}
|
||||
|
||||
void SHBatcher::UpdateBuffers(uint32_t frameIndex)
|
||||
void SHBatcher::UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool)
|
||||
{
|
||||
for (auto& batch : superBatches)
|
||||
{
|
||||
batch->UpdateBuffers(frameIndex);
|
||||
batch->UpdateBuffers(frameIndex, descPool);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace SHADE
|
|||
class SHSuperBatch;
|
||||
class SHVkLogicalDevice;
|
||||
class SHVkCommandBuffer;
|
||||
class SHVkDescriptorPool;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
|
@ -51,9 +52,9 @@ namespace SHADE
|
|||
void PrepareBatches();
|
||||
void AddToBatch(SHRenderable const* renderable);
|
||||
void RemoveFromBatch(SHRenderable const* renderable);
|
||||
void FinaliseBatches(Handle<SHVkLogicalDevice> device, uint32_t frameIndex);
|
||||
void FinaliseBatches(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex);
|
||||
void ClearBatches();
|
||||
void UpdateBuffers(uint32_t frameIndex);
|
||||
void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||
void RegisterSuperBatch(Handle<SHSuperBatch> superBatch);
|
||||
void DeregisterSuperBatch(Handle<SHSuperBatch> superBatch);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "SHBatch.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -78,21 +79,21 @@ namespace SHADE
|
|||
batches.clear();
|
||||
}
|
||||
|
||||
void SHSuperBatch::UpdateBuffers(uint32_t frameIndex)
|
||||
void SHSuperBatch::UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool)
|
||||
{
|
||||
for (auto& batch : batches)
|
||||
{
|
||||
batch.UpdateMaterialBuffer(frameIndex);
|
||||
batch.UpdateMaterialBuffer(frameIndex, descPool);
|
||||
batch.UpdateTransformBuffer(frameIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void SHSuperBatch::Build(Handle<SHVkLogicalDevice> device, uint32_t frameIndex) noexcept
|
||||
void SHSuperBatch::Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept
|
||||
{
|
||||
// Build all batches
|
||||
for (auto& batch : batches)
|
||||
{
|
||||
batch.Build(device, frameIndex);
|
||||
batch.Build(device, descPool, frameIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ namespace SHADE
|
|||
void Add(const SHRenderable* renderable) noexcept;
|
||||
void Remove(const SHRenderable* renderable) noexcept;
|
||||
void Clear() noexcept;
|
||||
void UpdateBuffers(uint32_t frameIndex);
|
||||
void Build(Handle<SHVkLogicalDevice> device, uint32_t frameIndex) noexcept;
|
||||
void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||
void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
||||
void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept;
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -7,7 +7,17 @@
|
|||
|
||||
namespace SHADE
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Static Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsGlobalData::globalDescSetLayouts;
|
||||
Handle<SHVkDescriptorSetGroup> SHGraphicsGlobalData::globalDescSets;
|
||||
SHVertexInputState SHGraphicsGlobalData::defaultVertexInputState;
|
||||
Handle<SHVkPipelineLayout> SHGraphicsGlobalData::dummyPipelineLayout;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Function Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHGraphicsGlobalData::InitDescSetLayouts(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
{
|
||||
SHVkDescriptorSetLayout::Binding genericDataBinding
|
||||
|
@ -87,18 +97,18 @@ namespace SHADE
|
|||
InitDefaultVertexInputState();
|
||||
}
|
||||
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> const& SHGraphicsGlobalData::GetDescSetLayouts(void) const noexcept
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> const& SHGraphicsGlobalData::GetDescSetLayouts(void) noexcept
|
||||
{
|
||||
return globalDescSetLayouts;
|
||||
}
|
||||
|
||||
|
||||
SHVertexInputState const& SHGraphicsGlobalData::GetDefaultViState(void) const noexcept
|
||||
SHVertexInputState const& SHGraphicsGlobalData::GetDefaultViState(void) noexcept
|
||||
{
|
||||
return defaultVertexInputState;
|
||||
}
|
||||
|
||||
Handle<SHVkPipelineLayout> SHGraphicsGlobalData::GetDummyPipelineLayout(void) const noexcept
|
||||
Handle<SHVkPipelineLayout> SHGraphicsGlobalData::GetDummyPipelineLayout(void) noexcept
|
||||
{
|
||||
return dummyPipelineLayout;
|
||||
}
|
||||
|
|
|
@ -15,31 +15,37 @@ namespace SHADE
|
|||
{
|
||||
private:
|
||||
//! Global descriptor set layouts. Used to allocate descriptor sets
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> globalDescSetLayouts;
|
||||
static std::vector<Handle<SHVkDescriptorSetLayout>> globalDescSetLayouts;
|
||||
|
||||
//! Global Descriptor sets
|
||||
Handle<SHVkDescriptorSetGroup> globalDescSets;
|
||||
static Handle<SHVkDescriptorSetGroup> globalDescSets;
|
||||
|
||||
//! Default vertex input state (used by everything).
|
||||
SHVertexInputState defaultVertexInputState;
|
||||
static SHVertexInputState defaultVertexInputState;
|
||||
|
||||
//! Since we want to bind global data but can't do so without a pipeline layout,
|
||||
//! we create a dummy pipeline layout to use it for binding.
|
||||
Handle<SHVkPipelineLayout> dummyPipelineLayout;
|
||||
static Handle<SHVkPipelineLayout> dummyPipelineLayout;
|
||||
|
||||
static void InitDescSetLayouts (Handle<SHVkLogicalDevice> logicalDevice) noexcept;
|
||||
static void InitDefaultVertexInputState(void) noexcept;
|
||||
|
||||
void InitDescSetLayouts (Handle<SHVkLogicalDevice> logicalDevice) noexcept;
|
||||
void InitDefaultVertexInputState(void) noexcept;
|
||||
public:
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Constructors */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
SHGraphicsGlobalData() = delete;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* PUBLIC MEMBER FUNCTIONS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
void Init (Handle<SHVkLogicalDevice> logicalDevice) noexcept;
|
||||
static void Init (Handle<SHVkLogicalDevice> logicalDevice) noexcept;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* SETTERS AND GETTERS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> const& GetDescSetLayouts (void) const noexcept;
|
||||
SHVertexInputState const& GetDefaultViState (void) const noexcept;
|
||||
Handle<SHVkPipelineLayout> GetDummyPipelineLayout (void) const noexcept;
|
||||
static std::vector<Handle<SHVkDescriptorSetLayout>> const& GetDescSetLayouts (void) noexcept;
|
||||
static SHVertexInputState const& GetDefaultViState (void) noexcept;
|
||||
static Handle<SHVkPipelineLayout> GetDummyPipelineLayout (void) noexcept;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -110,8 +110,7 @@ namespace SHADE
|
|||
- Global data
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
globalData = resourceManager.Create<SHGraphicsGlobalData>();
|
||||
globalData->Init(device);
|
||||
SHGraphicsGlobalData::Init(device);
|
||||
|
||||
// Set Up Cameras
|
||||
screenCamera = resourceManager.Create<SHCamera>();
|
||||
|
@ -135,7 +134,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Initialize world render graph
|
||||
worldRenderGraph->Init(device, swapchain, globalData);
|
||||
worldRenderGraph->Init(device, swapchain);
|
||||
//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("Composite", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||
|
@ -175,7 +174,7 @@ namespace SHADE
|
|||
debugWorldRenderer->SetCamera(worldCamera);*/
|
||||
|
||||
// Add world renderer to default viewport
|
||||
worldRenderer = defaultViewport->AddRenderer(resourceManager, swapchain->GetNumImages(), renderContextCmdPools, descPool, globalData->GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::HIGH_FREQUENCY_GLOBALS], worldRenderGraph);
|
||||
worldRenderer = defaultViewport->AddRenderer(resourceManager, swapchain->GetNumImages(), renderContextCmdPools, descPool, SHGraphicsGlobalData::GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::HIGH_FREQUENCY_GLOBALS], worldRenderGraph);
|
||||
worldRenderer->SetCamera(worldCamera);
|
||||
|
||||
|
||||
|
@ -248,7 +247,7 @@ namespace SHADE
|
|||
// Begin recording the command buffer
|
||||
currentCmdBuffer->BeginRecording();
|
||||
|
||||
currentCmdBuffer->ForceSetPipelineLayout(globalData->GetDummyPipelineLayout());
|
||||
currentCmdBuffer->ForceSetPipelineLayout(SHGraphicsGlobalData::GetDummyPipelineLayout());
|
||||
|
||||
// Bind all the buffers required for meshes
|
||||
for (auto& [buffer, bindingPoint] : MESH_DATA)
|
||||
|
@ -270,7 +269,7 @@ namespace SHADE
|
|||
textureDescSet,
|
||||
vk::PipelineBindPoint::eGraphics,
|
||||
0,
|
||||
std::span<uint32_t, 1>{texDynamicOffset.data(), texDynamicOffset.size()}
|
||||
texDynamicOffset
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -278,7 +277,7 @@ namespace SHADE
|
|||
renderers[renIndex]->UpdateDataAndBind(currentCmdBuffer, frameIndex);
|
||||
|
||||
// Draw first
|
||||
renderers[renIndex]->Draw(frameIndex);
|
||||
renderers[renIndex]->Draw(frameIndex, descPool);
|
||||
|
||||
// End the command buffer recording
|
||||
currentCmdBuffer->EndRecording();
|
||||
|
@ -331,7 +330,7 @@ namespace SHADE
|
|||
for (auto vp : viewports)
|
||||
for (auto renderer : vp->GetRenderers())
|
||||
{
|
||||
renderer->GetRenderGraph()->FinaliseBatch(renderContext.GetCurrentFrame());
|
||||
renderer->GetRenderGraph()->FinaliseBatch(renderContext.GetCurrentFrame(), descPool);
|
||||
}
|
||||
|
||||
// Resize
|
||||
|
@ -504,8 +503,7 @@ namespace SHADE
|
|||
{
|
||||
texLibrary.BuildTextures
|
||||
(
|
||||
device, graphicsTexCmdBuffer, graphicsQueue, descPool,
|
||||
globalData->GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS]
|
||||
device, graphicsTexCmdBuffer, graphicsQueue, descPool
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -287,9 +287,6 @@ namespace SHADE
|
|||
// Not Owned Resources
|
||||
SHWindow* window = nullptr;
|
||||
|
||||
// global data (descriptor sets as well)
|
||||
Handle<SHGraphicsGlobalData> globalData;
|
||||
|
||||
// Middle End Resources
|
||||
ResourceManager resourceManager;
|
||||
SHMeshLibrary meshLibrary;
|
||||
|
|
|
@ -60,9 +60,9 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Drawing Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHRenderer::Draw(uint32_t frameIndex) noexcept
|
||||
void SHRenderer::Draw(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool) noexcept
|
||||
{
|
||||
renderGraph->Execute(frameIndex, commandBuffers[frameIndex]);
|
||||
renderGraph->Execute(frameIndex, commandBuffers[frameIndex], descPool);
|
||||
}
|
||||
|
||||
void SHRenderer::UpdateDataAndBind(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------*/
|
||||
/* Drawing Functions */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
void Draw(uint32_t frameIndex) noexcept;
|
||||
void Draw(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool) noexcept;
|
||||
void UpdateDataAndBind (Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex) noexcept;
|
||||
void UpdateCameraDataToBuffer (void) noexcept;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace SHADE
|
|||
SHPipelineLayoutParams params
|
||||
{
|
||||
.shaderModules = {vsFsPair.first, vsFsPair.second},
|
||||
.globalDescSetLayouts = globalData->GetDescSetLayouts()
|
||||
.globalDescSetLayouts = SHGraphicsGlobalData::GetDescSetLayouts()
|
||||
};
|
||||
|
||||
// Create the pipeline layout
|
||||
|
@ -19,7 +19,7 @@ namespace SHADE
|
|||
|
||||
// Create the pipeline and configure the default vertex input state
|
||||
auto newPipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderpass, subpass);
|
||||
newPipeline->GetPipelineState().SetVertexInputState(globalData->GetDefaultViState());
|
||||
newPipeline->GetPipelineState().SetVertexInputState(SHGraphicsGlobalData::GetDefaultViState());
|
||||
|
||||
// Actually construct the pipeline
|
||||
newPipeline->ConstructPipeline();
|
||||
|
@ -30,10 +30,9 @@ namespace SHADE
|
|||
return newPipeline;
|
||||
}
|
||||
|
||||
void SHPipelineLibrary::Init(Handle<SHVkLogicalDevice> device, Handle<SHGraphicsGlobalData> inGlobalData) noexcept
|
||||
void SHPipelineLibrary::Init(Handle<SHVkLogicalDevice> device) noexcept
|
||||
{
|
||||
logicalDevice = device;
|
||||
globalData = inGlobalData;
|
||||
}
|
||||
|
||||
Handle<SHVkPipeline> SHPipelineLibrary::GetDrawPipline(std::pair<Handle<SHVkShaderModule>, Handle<SHVkShaderModule>> const& vsFsPair) noexcept
|
||||
|
|
|
@ -24,14 +24,9 @@ namespace SHADE
|
|||
|
||||
//! a map of pipelines that are hashed using a pair of shader module handles
|
||||
std::unordered_map<std::pair<Handle<SHVkShaderModule>, Handle<SHVkShaderModule>>, Handle<SHVkPipeline>> pipelines;
|
||||
|
||||
// Global data
|
||||
Handle<SHGraphicsGlobalData> globalData;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
void Init (Handle<SHVkLogicalDevice> device, Handle<SHGraphicsGlobalData> inGlobalData) noexcept;
|
||||
void Init (Handle<SHVkLogicalDevice> device) noexcept;
|
||||
|
||||
// Draw pipeline functions. used only when creating pipelines for drawing using a vertex and fragment shader
|
||||
Handle<SHVkPipeline> CreateDrawPipeline (
|
||||
|
|
|
@ -24,6 +24,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||
#include "Assets/Asset Types/SHDDSAsset.h"
|
||||
#include "Graphics/Images/SHVkImage.h"
|
||||
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -77,7 +78,7 @@ namespace SHADE
|
|||
isDirty = true;
|
||||
}
|
||||
|
||||
void SHTextureLibrary::BuildTextures(Handle<SHVkLogicalDevice> device, Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHVkQueue> graphicsQueue, Handle<SHVkDescriptorPool> descPool, Handle<SHVkDescriptorSetLayout> descLayout)
|
||||
void SHTextureLibrary::BuildTextures(Handle<SHVkLogicalDevice> device, Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHVkQueue> graphicsQueue, Handle<SHVkDescriptorPool> descPool)
|
||||
{
|
||||
// Don't do anything if there are no updates
|
||||
if (!isDirty)
|
||||
|
@ -173,9 +174,12 @@ namespace SHADE
|
|||
{
|
||||
if (!texDescriptors)
|
||||
{
|
||||
texDescriptors = descPool->Allocate({ descLayout }, { static_cast<uint32_t>(texOrder.size()) });
|
||||
texDescriptors = descPool->Allocate
|
||||
(
|
||||
{ SHGraphicsGlobalData::GetDescSetLayouts()[SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS] },
|
||||
{ static_cast<uint32_t>(texOrder.size()) }
|
||||
);
|
||||
}
|
||||
const auto ALIGNED_SIZE = device->PadSSBOSize(sizeof(uint32_t));
|
||||
texDescriptors->ModifyWriteDescImage
|
||||
(
|
||||
SHGraphicsConstants::DescriptorSetIndex::STATIC_GLOBALS,
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace SHADE
|
|||
queue.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
void BuildTextures(Handle<SHVkLogicalDevice> device, Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHVkQueue> graphicsQueue, Handle<SHVkDescriptorPool> descPool, Handle<SHVkDescriptorSetLayout> descLayout);
|
||||
void BuildTextures(Handle<SHVkLogicalDevice> device, Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHVkQueue> graphicsQueue, Handle<SHVkDescriptorPool> descPool);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Getter Functions */
|
||||
|
|
|
@ -328,11 +328,10 @@ namespace SHADE
|
|||
|
||||
*/
|
||||
/***************************************************************************/
|
||||
void SHRenderGraph::Init(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, Handle<SHGraphicsGlobalData> inGlobalData) noexcept
|
||||
void SHRenderGraph::Init(Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain) noexcept
|
||||
{
|
||||
logicalDeviceHdl = logicalDevice;
|
||||
swapchainHdl = swapchain;
|
||||
globalData = inGlobalData;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -364,7 +363,6 @@ namespace SHADE
|
|||
, nodes{ std::move(rhs.nodes) }
|
||||
, graphResources{ std::move(rhs.graphResources) }
|
||||
, resourceManager{ std::move(rhs.resourceManager) }
|
||||
, globalData{ rhs.globalData }
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -380,7 +378,6 @@ namespace SHADE
|
|||
nodes = std::move(rhs.nodes);
|
||||
graphResources = std::move(rhs.graphResources);
|
||||
resourceManager = std::move(rhs.resourceManager);
|
||||
globalData = rhs.globalData;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -438,7 +435,7 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
nodes.emplace_back(resourceManager.Create<SHRenderGraphNode>(resourceManager, logicalDeviceHdl, swapchainHdl, std::move(resources), std::move(predecessors), &graphResources, globalData));
|
||||
nodes.emplace_back(resourceManager.Create<SHRenderGraphNode>(resourceManager, logicalDeviceHdl, swapchainHdl, std::move(resources), std::move(predecessors), &graphResources));
|
||||
nodeIndexing.emplace(nodeName, static_cast<uint32_t>(nodes.size()) - 1u);
|
||||
return nodes.at(nodeIndexing[nodeName]);
|
||||
}
|
||||
|
@ -466,20 +463,20 @@ namespace SHADE
|
|||
|
||||
// TODO: The graph scope buffers were meant to bind vertex buffers and index buffers for meshes. Find a
|
||||
// better way to manage these
|
||||
void SHRenderGraph::Execute(uint32_t frameIndex, Handle<SHVkCommandBuffer> cmdBuffer) noexcept
|
||||
void SHRenderGraph::Execute(uint32_t frameIndex, Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHVkDescriptorPool> descPool) noexcept
|
||||
{
|
||||
// TODO: DON'T HARDCODE THIS
|
||||
cmdBuffer->SetViewportScissor(1920.0f, 1080.0f, 1920, 1080);
|
||||
|
||||
for (auto& node : nodes)
|
||||
node->Execute(cmdBuffer, frameIndex);
|
||||
node->Execute(cmdBuffer, descPool, frameIndex);
|
||||
}
|
||||
|
||||
void SHRenderGraph::FinaliseBatch(uint32_t frameIndex)
|
||||
void SHRenderGraph::FinaliseBatch(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool)
|
||||
{
|
||||
for (auto& node : nodes)
|
||||
{
|
||||
node->FinaliseBatch(frameIndex);
|
||||
node->FinaliseBatch(frameIndex, descPool);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,9 +61,6 @@ namespace SHADE
|
|||
|
||||
//! Resource library for graph handles
|
||||
ResourceManager resourceManager;
|
||||
|
||||
//! Handle to global data
|
||||
Handle<SHGraphicsGlobalData> globalData;
|
||||
|
||||
public:
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
@ -77,12 +74,12 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
/* PUBLIC MEMBER FUNCTIONS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
void Init (Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, Handle<SHGraphicsGlobalData> inGlobalData) noexcept;
|
||||
void Init (Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain) noexcept;
|
||||
void AddResource (std::string resourceName, SH_ATT_DESC_TYPE type, uint32_t w = static_cast<uint32_t>(-1), uint32_t h = static_cast<uint32_t>(-1), vk::Format format = vk::Format::eB8G8R8A8Unorm, uint8_t levels = 1, vk::ImageCreateFlagBits createFlags = {});
|
||||
Handle<SHRenderGraphNode> AddNode (std::string nodeName, std::initializer_list<std::string> resourceNames, std::initializer_list<std::string> predecessorNodes) noexcept;
|
||||
void Generate (void) noexcept;
|
||||
void Execute (uint32_t frameIndex, Handle<SHVkCommandBuffer> cmdBuffer) noexcept;
|
||||
void FinaliseBatch(uint32_t frameIndex);
|
||||
void Execute (uint32_t frameIndex, Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHVkDescriptorPool> descPool) noexcept;
|
||||
void FinaliseBatch(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* SETTERS AND GETTERS */
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace SHADE
|
|||
|
||||
*/
|
||||
/***************************************************************************/
|
||||
SHRenderGraphNode::SHRenderGraphNode(ResourceManager& rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<Handle<SHRenderGraphResource>> attRes, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources, Handle<SHGraphicsGlobalData> globalData) noexcept
|
||||
SHRenderGraphNode::SHRenderGraphNode(ResourceManager& rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<Handle<SHRenderGraphResource>> attRes, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept
|
||||
: logicalDeviceHdl{ logicalDevice }
|
||||
, renderpass{}
|
||||
, framebuffers{}
|
||||
|
@ -91,7 +91,7 @@ namespace SHADE
|
|||
, ptrToResources{ resources }
|
||||
{
|
||||
// pipeline library initialization
|
||||
pipelineLibrary.Init(logicalDeviceHdl, globalData);
|
||||
pipelineLibrary.Init(logicalDeviceHdl);
|
||||
|
||||
attachmentDescriptions.resize(attResources.size());
|
||||
|
||||
|
@ -207,14 +207,14 @@ namespace SHADE
|
|||
return subpass;
|
||||
}
|
||||
|
||||
void SHRenderGraphNode::Execute(Handle<SHVkCommandBuffer>& commandBuffer, uint32_t frameIndex) noexcept
|
||||
void SHRenderGraphNode::Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept
|
||||
{
|
||||
frameIndex = (framebuffers.size() > 1) ? frameIndex : 0;
|
||||
commandBuffer->BeginRenderpass(renderpass, framebuffers[frameIndex]);
|
||||
|
||||
for (uint32_t i = 0; i < subpasses.size(); ++i)
|
||||
{
|
||||
subpasses[i]->Execute(commandBuffer, frameIndex);
|
||||
subpasses[i]->Execute(commandBuffer, descPool, frameIndex);
|
||||
|
||||
// Go to next subpass if not last subpass
|
||||
if (i != subpasses.size() - 1)
|
||||
|
@ -247,9 +247,9 @@ namespace SHADE
|
|||
return pipeline;
|
||||
}
|
||||
|
||||
void SHRenderGraphNode::FinaliseBatch(uint32_t frameIndex)
|
||||
void SHRenderGraphNode::FinaliseBatch(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool)
|
||||
{
|
||||
batcher.FinaliseBatches(logicalDeviceHdl, frameIndex);
|
||||
batcher.FinaliseBatches(logicalDeviceHdl, descPool, frameIndex);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SHADE
|
|||
class SHRenderGraphResource;
|
||||
class SHVkLogicalDevice;
|
||||
class SHVkRenderpass;
|
||||
class SHVkDescriptorPool;
|
||||
|
||||
class SH_API SHRenderGraphNode : public ISelfHandle<SHRenderGraphNode>
|
||||
{
|
||||
|
@ -85,7 +86,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
/* CTORS AND DTORS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
SHRenderGraphNode(ResourceManager& rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<Handle<SHRenderGraphResource>> attRes, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources, Handle<SHGraphicsGlobalData> globalData) noexcept;
|
||||
SHRenderGraphNode(ResourceManager& rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<Handle<SHRenderGraphResource>> attRes, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept;
|
||||
SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept;
|
||||
SHRenderGraphNode& operator= (SHRenderGraphNode&& rhs) noexcept;
|
||||
|
||||
|
@ -94,9 +95,9 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
Handle<SHSubpass> AddSubpass(std::string subpassName) noexcept;
|
||||
// TODO: RemoveSubpass()
|
||||
void Execute(Handle<SHVkCommandBuffer>& commandBuffer, uint32_t frameIndex) noexcept;
|
||||
void Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
||||
Handle<SHVkPipeline> GetOrCreatePipeline(std::pair<Handle<SHVkShaderModule>, Handle<SHVkShaderModule>> const& vsFsPair, Handle<SHSubpass> subpass) noexcept;
|
||||
void FinaliseBatch(uint32_t frameIndex);
|
||||
void FinaliseBatch(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* SETTERS AND GETTERS */
|
||||
|
|
|
@ -156,10 +156,10 @@ namespace SHADE
|
|||
inputReferences.push_back({ resourceAttachmentMapping->at(ptrToResources->at(resourceToReference).GetId().Raw), vk::ImageLayout::eShaderReadOnlyOptimal });
|
||||
}
|
||||
|
||||
void SHSubpass::Execute(Handle<SHVkCommandBuffer>& commandBuffer, uint32_t frameIndex) noexcept
|
||||
void SHSubpass::Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept
|
||||
{
|
||||
// Ensure correct transforms are provided
|
||||
superBatch->UpdateBuffers(frameIndex);
|
||||
superBatch->UpdateBuffers(frameIndex, descPool);
|
||||
|
||||
// Draw all the batches
|
||||
superBatch->Draw(commandBuffer, frameIndex);
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace SHADE
|
|||
class SHRenderGraphResource;
|
||||
class SHVkCommandBuffer;
|
||||
class SHVkDescriptorSetLayout;
|
||||
class SHVkDescriptorPool;
|
||||
|
||||
class SH_API SHSubpass : public ISelfHandle<SHSubpass>
|
||||
{
|
||||
|
@ -74,7 +75,7 @@ namespace SHADE
|
|||
void AddInput(std::string resourceToReference) noexcept;
|
||||
|
||||
// Runtime functions
|
||||
void Execute(Handle<SHVkCommandBuffer>& commandBuffer, uint32_t frameIndex) noexcept;
|
||||
void Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
||||
void AddExteriorDrawCalls(std::function<void(Handle<SHVkCommandBuffer>&)> const& newDrawCall) noexcept;
|
||||
|
||||
void Init(ResourceManager& resourceManager) noexcept;
|
||||
|
|
Loading…
Reference in New Issue