Modified AddMaterial() to take in a subpass

This commit is contained in:
Kah Wei 2022-09-18 14:58:32 +08:00
parent 7a126bf1fc
commit 8c30e656f7
3 changed files with 9 additions and 8 deletions

View File

@ -321,18 +321,19 @@ namespace SHADE
viewports.erase(iter); viewports.erase(iter);
} }
Handle<SHMaterial> SHGraphicsSystem::AddMaterial(Handle<SHVkShaderModule> vertShader, Handle<SHVkShaderModule> fragShader) Handle<SHMaterial> SHGraphicsSystem::AddMaterial(Handle<SHVkShaderModule> vertShader, Handle<SHVkShaderModule> fragShader, Handle<SHRenderGraphNode::SHSubpass> subpass)
{ {
// Retrieve pipeline from pipeline storage or create if unavailable // Retrieve pipeline from pipeline storage or create if unavailable
auto shaderPair = std::make_pair(vertShader, fragShader); auto shaderPair = std::make_pair(vertShader, fragShader);
Handle<SHVkPipeline> pipeline = pipelineLibrary.GetDrawPipline(shaderPair); Handle<SHVkPipeline> pipeline = pipelineLibrary.GetDrawPipline(shaderPair);
if (!pipeline) if (!pipeline)
{ {
/*pipeline = pipelineLibrary.CreateDrawPipeline pipeline = pipelineLibrary.CreateDrawPipeline
( (
shaderPair, shaderPair,
subpass->GetParentNode()->GetRenderpass(),
);*/ subpass->GetIndex()
);
} }
// Create material // Create material

View File

@ -25,11 +25,10 @@ of DigiPen Institute of Technology is prohibited.
#include "ECS_Base/System/SHSystemRoutine.h" #include "ECS_Base/System/SHSystemRoutine.h"
#include "Graphics/Descriptors/SHVkDescriptorPool.h" #include "Graphics/Descriptors/SHVkDescriptorPool.h"
#include "Graphics/MiddleEnd/Pipeline/SHPipelineLibrary.h" #include "Graphics/MiddleEnd/Pipeline/SHPipelineLibrary.h"
#include "Graphics/RenderGraph/SHRenderGraph.h"
namespace SHADE namespace SHADE
{ {
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Forward Declarations */ /* Forward Declarations */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
@ -112,7 +111,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Material Creation Functions */ /* Material Creation Functions */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
Handle<SHMaterial> AddMaterial(Handle<SHVkShaderModule> vertShader, Handle<SHVkShaderModule> fragShader); Handle<SHMaterial> AddMaterial(Handle<SHVkShaderModule> vertShader, Handle<SHVkShaderModule> fragShader, Handle<SHRenderGraphNode::SHSubpass> subpass);
void RemoveMaterial(Handle<SHMaterial> material);; void RemoveMaterial(Handle<SHMaterial> material);;
Handle<SHMaterialInstance> AddMaterialInstance(Handle<SHMaterial> material); Handle<SHMaterialInstance> AddMaterialInstance(Handle<SHMaterial> material);
void RemoveMaterialInstance(Handle<SHMaterialInstance> materialInstance); void RemoveMaterialInstance(Handle<SHMaterialInstance> materialInstance);

View File

@ -105,6 +105,7 @@ namespace SHADE
/* GETTERS AND SETTERS */ /* GETTERS AND SETTERS */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
Handle<SHRenderGraphNode> const& GetParentNode (void) const noexcept; Handle<SHRenderGraphNode> const& GetParentNode (void) const noexcept;
SHSubPassIndex GetIndex() const noexcept { return 0; } // TODO
private: private:
/*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/