Graphics/FramePipelinePass: Replace pointer + size by span

This commit is contained in:
Lynix 2023-12-25 20:05:45 +01:00
parent 7cd1b32e95
commit 9fb308a531
6 changed files with 13 additions and 17 deletions

View File

@ -14,6 +14,7 @@
#include <Nazara/Math/Rect.hpp> #include <Nazara/Math/Rect.hpp>
#include <NazaraUtils/Bitset.hpp> #include <NazaraUtils/Bitset.hpp>
#include <limits> #include <limits>
#include <span>
namespace Nz namespace Nz
{ {
@ -74,13 +75,10 @@ namespace Nz
struct PassInputOuputs struct PassInputOuputs
{ {
// TODO: Add Nz::View / Nz::Span std::span<const std::size_t> inputAttachments;
const std::size_t* inputAttachments; std::span<const std::size_t> outputAttachments;
const std::size_t* outputAttachments;
std::size_t depthStencilInput = InvalidAttachmentIndex; std::size_t depthStencilInput = InvalidAttachmentIndex;
std::size_t depthStencilOutput = InvalidAttachmentIndex; std::size_t depthStencilOutput = InvalidAttachmentIndex;
std::size_t inputCount = 0;
std::size_t outputCount = 0;
}; };
struct VisibleRenderable struct VisibleRenderable

View File

@ -21,10 +21,10 @@ namespace Nz
FramePass& DebugDrawPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs) FramePass& DebugDrawPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs)
{ {
if (inputOuputs.inputCount != 1) if (inputOuputs.inputAttachments.size() != 1)
throw std::runtime_error("one input expected"); throw std::runtime_error("one input expected");
if (inputOuputs.outputCount != 1) if (inputOuputs.outputAttachments.size() != 1)
throw std::runtime_error("one output expected"); throw std::runtime_error("one output expected");
FramePass& debugDrawPass = frameGraph.AddPass("Debug draw pass"); FramePass& debugDrawPass = frameGraph.AddPass("Debug draw pass");

View File

@ -119,10 +119,10 @@ namespace Nz
FramePass& DepthPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs) FramePass& DepthPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs)
{ {
if (inputOuputs.inputCount > 0) if (inputOuputs.inputAttachments.size() > 0)
throw std::runtime_error("no input expected"); throw std::runtime_error("no input expected");
if (inputOuputs.outputCount > 0) if (inputOuputs.outputAttachments.size() > 0)
throw std::runtime_error("no output expected"); throw std::runtime_error("no output expected");
if (inputOuputs.depthStencilInput != InvalidAttachmentIndex) if (inputOuputs.depthStencilInput != InvalidAttachmentIndex)

View File

@ -146,10 +146,10 @@ namespace Nz
FramePass& ForwardPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs) FramePass& ForwardPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs)
{ {
if (inputOuputs.inputCount > 0) if (inputOuputs.inputAttachments.size() > 0)
throw std::runtime_error("no input expected"); throw std::runtime_error("no input expected");
if (inputOuputs.outputCount != 1) if (inputOuputs.outputAttachments.size() != 1)
throw std::runtime_error("one output expected"); throw std::runtime_error("one output expected");
if (inputOuputs.depthStencilOutput == InvalidAttachmentIndex) if (inputOuputs.depthStencilOutput == InvalidAttachmentIndex)

View File

@ -83,10 +83,8 @@ namespace Nz
FramePipelinePass::PassInputOuputs passInputOuputs; FramePipelinePass::PassInputOuputs passInputOuputs;
passInputOuputs.depthStencilInput = GetAttachmentIndex(passData.depthStencilInput); passInputOuputs.depthStencilInput = GetAttachmentIndex(passData.depthStencilInput);
passInputOuputs.depthStencilOutput = GetAttachmentIndex(passData.depthStencilOutput); passInputOuputs.depthStencilOutput = GetAttachmentIndex(passData.depthStencilOutput);
passInputOuputs.inputAttachments = inputs.data(); passInputOuputs.inputAttachments = inputs;
passInputOuputs.inputCount = passData.inputs.size(); passInputOuputs.outputAttachments = outputs;
passInputOuputs.outputAttachments = outputs.data();
passInputOuputs.outputCount = passData.outputs.size();
FramePass& framePass = passes[passIndex]->RegisterToFrameGraph(frameGraph, passInputOuputs); FramePass& framePass = passes[passIndex]->RegisterToFrameGraph(frameGraph, passInputOuputs);
if (passCallback) if (passCallback)

View File

@ -52,10 +52,10 @@ namespace Nz
FramePass& PostProcessPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs) FramePass& PostProcessPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs)
{ {
if (inputOuputs.inputCount != 1) if (inputOuputs.inputAttachments.size() != 1)
throw std::runtime_error("one input expected"); throw std::runtime_error("one input expected");
if (inputOuputs.outputCount != 1) if (inputOuputs.outputAttachments.size() != 1)
throw std::runtime_error("one output expected"); throw std::runtime_error("one output expected");
if (inputOuputs.depthStencilInput != InvalidAttachmentIndex) if (inputOuputs.depthStencilInput != InvalidAttachmentIndex)