Graphics/FramePipelinePass: Replace pointer + size by span
This commit is contained in:
parent
7cd1b32e95
commit
9fb308a531
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue