Ctor for compute pipelines

This commit is contained in:
Brandon Mak 2022-09-23 18:50:40 +08:00
parent 5c4384b589
commit bd54b16e01
5 changed files with 40 additions and 13 deletions

View File

@ -493,9 +493,9 @@ namespace SHADE
*/
/***************************************************************************/
Handle<SHVkPipeline> SHVkLogicalDevice::CreatePipeline(Handle<SHVkPipelineLayout> const& pipelineLayoutHdl, SHVkPipelineState const* const state, Handle<SHVkRenderpass> const& renderpassHdl, Handle<SHSubpass> subpass, SH_PIPELINE_TYPE type) noexcept
Handle<SHVkPipeline> SHVkLogicalDevice::CreateGraphicsPipeline(Handle<SHVkPipelineLayout> const& pipelineLayoutHdl, SHVkPipelineState const* const state, Handle<SHVkRenderpass> const& renderpassHdl, Handle<SHSubpass> subpass) noexcept
{
return SHVkInstance::GetResourceManager().Create <SHVkPipeline>(GetHandle(), pipelineLayoutHdl, state, renderpassHdl, subpass, type);
return SHVkInstance::GetResourceManager().Create <SHVkPipeline>(GetHandle(), pipelineLayoutHdl, state, renderpassHdl, subpass);
}

View File

@ -21,6 +21,7 @@
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
#include "Graphics/Images/SHVkImage.h"
namespace SHADE
{
/*-----------------------------------------------------------------------*/
@ -171,12 +172,11 @@ namespace SHADE
std::string const& shaderName
) noexcept;
Handle<SHVkPipeline> CreatePipeline (
Handle<SHVkPipeline> CreateGraphicsPipeline (
Handle<SHVkPipelineLayout> const& pipelineLayoutHdl,
SHVkPipelineState const* const state,
Handle<SHVkRenderpass> const& renderpassHdl,
Handle<SHSubpass> subpass,
SH_PIPELINE_TYPE type
Handle<SHSubpass> subpass
) noexcept;
Handle<SHVkRenderpass> CreateRenderpass (std::span<vk::AttachmentDescription> const vkDescriptions, std::vector<SHVkSubpassParams> const& subpasses) noexcept;

View File

@ -18,7 +18,7 @@ namespace SHADE
auto pipelineLayout = logicalDevice->CreatePipelineLayout(params);
// Create the pipeline and configure the default vertex input state
auto newPipeline = logicalDevice->CreatePipeline(pipelineLayout, nullptr, renderpass, subpass, SH_PIPELINE_TYPE::GRAPHICS);
auto newPipeline = logicalDevice->CreateGraphicsPipeline(pipelineLayout, nullptr, renderpass, subpass);
newPipeline->GetPipelineState().SetVertexInputState(globalData->GetDefaultViState());
// Actually construct the pipeline

View File

@ -179,7 +179,7 @@ namespace SHADE
/*!
\brief
Non-default ctor.
Non-default ctor for creating graphics pipeline.
\param inLogicalDeviceHdl
Needed for creation and destruction.
@ -200,14 +200,12 @@ namespace SHADE
The subpass that this pipeline will be used in. If state is not
nullptr, this parameter is ignored.
\param type
The type of the pipeline.
*/
/***************************************************************************/
SHVkPipeline::SHVkPipeline(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl, Handle<SHVkPipelineLayout> const& inPipelineLayout, SHVkPipelineState const* const state, Handle<SHVkRenderpass> const& renderpassHdl, Handle<SHSubpass> subpass, SH_PIPELINE_TYPE type) noexcept
SHVkPipeline::SHVkPipeline(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl, Handle<SHVkPipelineLayout> const& inPipelineLayout, SHVkPipelineState const* const state, Handle<SHVkRenderpass> const& renderpassHdl, Handle<SHSubpass> subpass) noexcept
: pipelineState{ }
, pipelineType {type}
, pipelineType {SH_PIPELINE_TYPE::GRAPHICS}
, vkPipeline {VK_NULL_HANDLE}
, logicalDeviceHdl{ inLogicalDeviceHdl }
, pipelineLayout { inPipelineLayout }
@ -250,6 +248,33 @@ namespace SHADE
vkPipeline = VK_NULL_HANDLE;
}
/***************************************************************************/
/*!
\brief
Just to differentiate between compute and graphics pipeline, we will
have a constructor that takes in less parameters; sufficient for the
compute pipeline to be created.
\param inLogicalDeviceHdl
\param inPipelineLayout
\return
*/
/***************************************************************************/
SHVkPipeline::SHVkPipeline(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl, Handle<SHVkPipelineLayout> const& inPipelineLayout) noexcept
: pipelineState{ }
, pipelineType{ SH_PIPELINE_TYPE::COMPUTE }
, vkPipeline{ VK_NULL_HANDLE }
, logicalDeviceHdl{ inLogicalDeviceHdl }
, pipelineLayout{ inPipelineLayout }
, created{ false }
{
}
/***************************************************************************/
/*!

View File

@ -51,8 +51,10 @@ namespace SHADE
Handle<SHVkPipelineLayout> const& inPipelineLayout,
SHVkPipelineState const* const state,
Handle<SHVkRenderpass> const& renderpassHdl,
Handle<SHSubpass> subpass,
SH_PIPELINE_TYPE type) noexcept;
Handle<SHSubpass> subpass) noexcept;
SHVkPipeline(Handle<SHVkLogicalDevice> const& inLogicalDeviceHdl,
Handle<SHVkPipelineLayout> const& inPipelineLayout) noexcept;
SHVkPipeline (SHVkPipeline&& rhs) noexcept;
~SHVkPipeline (void) noexcept;