refactor(rendering): add srp host stage recorder bridge
This commit is contained in:
@@ -71,6 +71,11 @@ ScriptableRenderPipelineHost::~ScriptableRenderPipelineHost() {
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void ScriptableRenderPipelineHost::SetStageRecorder(
|
||||
std::unique_ptr<RenderPipelineStageRecorder> stageRecorder) {
|
||||
ResetStageRecorder(std::move(stageRecorder));
|
||||
}
|
||||
|
||||
void ScriptableRenderPipelineHost::SetPipelineRenderer(
|
||||
std::unique_ptr<RenderPipelineRenderer> pipelineRenderer) {
|
||||
m_pipelineRendererAsset.reset();
|
||||
@@ -88,11 +93,25 @@ void ScriptableRenderPipelineHost::SetPipelineRendererAsset(
|
||||
}
|
||||
|
||||
bool ScriptableRenderPipelineHost::Initialize(const RenderContext& context) {
|
||||
return m_pipelineRenderer != nullptr &&
|
||||
m_pipelineRenderer->Initialize(context);
|
||||
if (m_pipelineRenderer == nullptr ||
|
||||
!m_pipelineRenderer->Initialize(context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_stageRecorder != nullptr &&
|
||||
!m_stageRecorder->Initialize(context)) {
|
||||
m_stageRecorder->Shutdown();
|
||||
m_pipelineRenderer->Shutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScriptableRenderPipelineHost::Shutdown() {
|
||||
if (m_stageRecorder != nullptr) {
|
||||
m_stageRecorder->Shutdown();
|
||||
}
|
||||
if (m_pipelineRenderer != nullptr) {
|
||||
m_pipelineRenderer->Shutdown();
|
||||
}
|
||||
@@ -101,12 +120,19 @@ void ScriptableRenderPipelineHost::Shutdown() {
|
||||
|
||||
bool ScriptableRenderPipelineHost::SupportsStageRenderGraph(
|
||||
CameraFrameStage stage) const {
|
||||
return m_pipelineRenderer != nullptr &&
|
||||
m_pipelineRenderer->SupportsStageRenderGraph(stage);
|
||||
return (m_stageRecorder != nullptr &&
|
||||
m_stageRecorder->SupportsStageRenderGraph(stage)) ||
|
||||
(m_pipelineRenderer != nullptr &&
|
||||
m_pipelineRenderer->SupportsStageRenderGraph(stage));
|
||||
}
|
||||
|
||||
bool ScriptableRenderPipelineHost::RecordStageRenderGraph(
|
||||
const RenderPipelineStageRenderGraphContext& context) {
|
||||
if (m_stageRecorder != nullptr &&
|
||||
m_stageRecorder->SupportsStageRenderGraph(context.stage)) {
|
||||
return m_stageRecorder->RecordStageRenderGraph(context);
|
||||
}
|
||||
|
||||
return m_pipelineRenderer != nullptr &&
|
||||
m_pipelineRenderer->RecordStageRenderGraph(context);
|
||||
}
|
||||
@@ -125,6 +151,15 @@ bool ScriptableRenderPipelineHost::Render(
|
||||
m_pipelineRenderer->Render(context, surface, sceneData);
|
||||
}
|
||||
|
||||
void ScriptableRenderPipelineHost::ResetStageRecorder(
|
||||
std::unique_ptr<RenderPipelineStageRecorder> stageRecorder) {
|
||||
if (m_stageRecorder != nullptr) {
|
||||
m_stageRecorder->Shutdown();
|
||||
}
|
||||
|
||||
m_stageRecorder = std::move(stageRecorder);
|
||||
}
|
||||
|
||||
void ScriptableRenderPipelineHost::ResetPipelineRenderer(
|
||||
std::unique_ptr<RenderPipelineRenderer> pipelineRenderer) {
|
||||
if (m_pipelineRenderer != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user