4#include <Crousti/GfxNode.hpp>
9template <
typename Node_T>
11 (avnd::texture_output_introspection<Node_T>::size + avnd::buffer_output_introspection<Node_T>::size + avnd::geometry_output_introspection<Node_T>::size) == 0
15 using texture_inputs = avnd::texture_input_introspection<Node_T>;
16 std::shared_ptr<Node_T> state;
18 ossia::time_value m_last_time{-1};
20 AVND_NO_UNIQUE_ADDRESS texture_inputs_storage<Node_T> texture_ins;
21 AVND_NO_UNIQUE_ADDRESS buffer_inputs_storage<Node_T> buffer_ins;
23 const GfxNode<Node_T>& node() const noexcept
25 return static_cast<const GfxNode<Node_T>&
>(score::gfx::NodeRenderer::node);
27 GfxRenderer(
const GfxNode<Node_T>& p)
28 :
score::gfx::OutputNodeRenderer{p}
29 , state{
std::make_shared<Node_T>()}
31 prepareNewState<Node_T>(state, p);
37 if constexpr(avnd::texture_input_introspection<Node_T>::size > 0)
39 auto it = texture_ins.m_rts.find(&p);
40 SCORE_ASSERT(it != texture_ins.m_rts.end());
48 if constexpr(
requires { state->prepare(); })
50 this->node().processControlIn(
51 *
this, *state, m_last_message, this->node().last_message, this->node().m_ctx);
56 texture_ins.init(*
this, renderer);
102 texture_ins.release();
105 void inputAboutToFinish(
107 QRhiResourceUpdateBatch*& res)
override
109 if constexpr(avnd::texture_input_introspection<Node_T>::size > 0 || avnd::buffer_input_introspection<Node_T>::size > 0)
111 res = renderer.
state.rhi->nextResourceUpdateBatch();
113 texture_ins.inputAboutToFinish(this->node(), p, res);
114 buffer_ins.inputAboutToFinish(renderer, res, *state, this->node());
119 void runInitialPasses(
123 auto& parent = this->node();
124 auto& rhi = *renderer.
state.rhi;
130 if(parent.last_message.token.date == m_last_time)
132 m_last_time = parent.last_message.token.date;
134 texture_ins.runInitialPasses(*
this, rhi);
135 buffer_ins.readInputBuffers(renderer, parent, *state);
137 parent.processControlIn(
138 *
this, *state, m_last_message, parent.last_message, parent.m_ctx);
141 if_possible((*state)());
144 parent.processControlOut(*this->state);
148template <
typename Node_T>
150 (avnd::texture_output_introspection<Node_T>::size + avnd::buffer_output_introspection<Node_T>::size + avnd::geometry_output_introspection<Node_T>::size) == 0
152struct GfxNode<Node_T> final
153 : CustomGpuOutputNodeBase
154 , GpuNodeElements<Node_T>
159 std::weak_ptr<Execution::ExecutionCommandQueue> q, Gfx::exec_controls ctls,
161 : CustomGpuOutputNodeBase{
std::move(q),
std::move(ctls), ctx}
162 , processModel{element}
166 initGfxPorts<Node_T>(
this, this->input, this->output);
172 return new GfxRenderer<Node_T>{*
this};
Definition score-plugin-avnd/Crousti/ProcessModel.hpp:86
Definition OutputNode.hpp:11
List of nodes to be rendered to an output.
Definition RenderList.hpp:19
RenderState & state
RenderState corresponding to this RenderList.
Definition RenderList.hpp:94
Definition Factories.hpp:19
Base toolkit upon which the software is built.
Definition Application.cpp:97
Definition DocumentContext.hpp:18
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:70
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:50
Port of a score::gfx::Node.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:52
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:115