Linked MeshLibrary to RenderGraph
This commit is contained in:
parent
d025abe43a
commit
f408247007
|
@ -59,7 +59,8 @@ namespace Sandbox
|
|||
SHADE::SHScriptEngine::Init();
|
||||
|
||||
// Create temp meshes
|
||||
|
||||
SHADE::SHPrimitiveGenerator::Cube(*graphicsSystem);
|
||||
graphicsSystem->BuildMeshBuffers();
|
||||
}
|
||||
|
||||
void SBApplication::Update(void)
|
||||
|
|
|
@ -73,6 +73,34 @@ namespace SHADE
|
|||
|
||||
struct VertexBufferBindings
|
||||
{
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
Vertex buffer bindings for the transform matrix buffer.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t POSITION = 0;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
Vertex buffer bindings for the transform matrix buffer.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t TEX_COORD = 1;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
Vertex buffer bindings for the transform matrix buffer.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t NORMAL = 2;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
Vertex buffer bindings for the transform matrix buffer.
|
||||
*/
|
||||
/***************************************************************************/
|
||||
static constexpr uint32_t TANGENT = 3;
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
|
|
|
@ -27,6 +27,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "ECS_Base/Managers/SHComponentManager.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||
#include "Graphics/MiddleEnd/Batching/SHSuperBatch.h"
|
||||
#include "SHGraphicsConstants.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -197,6 +198,16 @@ namespace SHADE
|
|||
// semaphore index. This is for render graphs to have semaphores to signal that the next render graph will use to wait on.
|
||||
bool semIndex = 0;
|
||||
|
||||
using BufferPair = std::pair<Handle<SHVkBuffer>, uint32_t>;
|
||||
const std::initializer_list<BufferPair> MESH_DATA =
|
||||
{
|
||||
std::make_pair(meshLibrary.GetVertexPositionsBuffer(), SHGraphicsConstants::VertexBufferBindings::POSITION),
|
||||
std::make_pair(meshLibrary.GetVertexTexCoordsBuffer(), SHGraphicsConstants::VertexBufferBindings::TEX_COORD),
|
||||
std::make_pair(meshLibrary.GetVertexNormalsBuffer(), SHGraphicsConstants::VertexBufferBindings::NORMAL),
|
||||
std::make_pair(meshLibrary.GetVertexTangentsBuffer(), SHGraphicsConstants::VertexBufferBindings::TANGENT),
|
||||
std::make_pair(meshLibrary.GetIndexBuffer(), 0),
|
||||
};
|
||||
|
||||
// For every viewport
|
||||
for (int vpIndex = 0; vpIndex < static_cast<int>(viewports.size()); ++vpIndex)
|
||||
{
|
||||
|
@ -206,7 +217,7 @@ namespace SHADE
|
|||
for (int renIndex = 0; renIndex < static_cast<int>(renderers.size()); ++renIndex)
|
||||
{
|
||||
// Draw first
|
||||
renderers[renIndex]->Draw(renderContext.GetCurrentFrame());
|
||||
renderers[renIndex]->Draw(renderContext.GetCurrentFrame(), MESH_DATA);
|
||||
|
||||
// get render graph
|
||||
auto rg = renderers[renIndex]->GetRenderGraph();
|
||||
|
@ -388,7 +399,7 @@ namespace SHADE
|
|||
transferCmdBuffer->BeginRecording();
|
||||
meshLibrary.BuildBuffers(device, transferCmdBuffer);
|
||||
transferCmdBuffer->EndRecording();
|
||||
queue->SubmitCommandBuffer({ transferCmdBuffer });
|
||||
graphicsQueue->SubmitCommandBuffer({ transferCmdBuffer });
|
||||
}
|
||||
|
||||
void SHGraphicsSystem::SetWindow(SHWindow* wind) noexcept
|
||||
|
@ -418,10 +429,6 @@ namespace SHADE
|
|||
// For global data (generic data and textures)
|
||||
Handle<SHVkDescriptorSetLayout> staticGlobalLayout = device->CreateDescriptorSetLayout({genericDataBinding, texturesBinding});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SHVkDescriptorSetLayout::Binding lightBinding
|
||||
{
|
||||
.Type = vk::DescriptorType::eStorageBufferDynamic,
|
||||
|
@ -433,10 +440,6 @@ namespace SHADE
|
|||
// For Dynamic global data (lights)
|
||||
Handle<SHVkDescriptorSetLayout> dynamicGlobalLayout = device->CreateDescriptorSetLayout({ lightBinding });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SHVkDescriptorSetLayout::Binding cameraDataBinding
|
||||
{
|
||||
.Type = vk::DescriptorType::eUniformBufferDynamic,
|
||||
|
@ -448,10 +451,6 @@ namespace SHADE
|
|||
// For High frequency global data (camera)
|
||||
Handle<SHVkDescriptorSetLayout> cameraDataGlobalLayout = device->CreateDescriptorSetLayout({ cameraDataBinding });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SHVkDescriptorSetLayout::Binding materialDataBinding
|
||||
{
|
||||
.Type = vk::DescriptorType::eStorageBufferDynamic,
|
||||
|
|
|
@ -40,9 +40,9 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Drawing Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHRenderer::Draw(uint32_t frameIndex) noexcept
|
||||
void SHRenderer::Draw(uint32_t frameIndex, std::initializer_list<std::pair<Handle<SHVkBuffer>, uint32_t>> graphScopeBuffers) noexcept
|
||||
{
|
||||
renderGraph->Execute(frameIndex);
|
||||
renderGraph->Execute(frameIndex, graphScopeBuffers);
|
||||
}
|
||||
|
||||
Handle<SHRenderGraph> SHRenderer::GetRenderGraph(void) const noexcept
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------*/
|
||||
/* Drawing Functions */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
void Draw(uint32_t frameIndex) noexcept;
|
||||
void Draw(uint32_t frameIndex, std::initializer_list<std::pair<Handle<SHVkBuffer>, uint32_t>> graphScopeBuffers) noexcept;
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Setters and Getters */
|
||||
|
|
|
@ -14,6 +14,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "SHPrimitiveGenerator.h"
|
||||
|
||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHMeshLibrary.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
|
|
@ -14,17 +14,27 @@ of DigiPen Institute of Technology is prohibited.
|
|||
// Project Includes
|
||||
#include "Math/SHMath.h"
|
||||
#include "SHMeshData.h"
|
||||
#include "SH_API.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Forward Declarations */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
class SHGraphicsSystem;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*************************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
Static class that contains functions for generating 3D primitives.
|
||||
*/
|
||||
/*************************************************************************************/
|
||||
class SHPrimitiveGenerator
|
||||
class SH_API SHPrimitiveGenerator
|
||||
{
|
||||
public:
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Constructors */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Reference in New Issue