3#include <Gfx/Graph/CommonUBOs.hpp>
4#include <Gfx/Graph/Mesh.hpp>
5#include <Gfx/Graph/RenderState.hpp>
6#include <Gfx/Graph/Uniforms.hpp>
7#include <Gfx/Graph/Utils.hpp>
9#include <ossia/dataflow/geometry_port.hpp>
10#include <ossia/dataflow/nodes/media.hpp>
11#include <ossia/dataflow/texture_port.hpp>
12#include <ossia/dataflow/token_request.hpp>
13#include <ossia/detail/flat_map.hpp>
14#include <ossia/detail/variant.hpp>
15#include <ossia/network/value/value.hpp>
17#include <score_plugin_gfx_export.h>
19#include <boost/version.hpp>
33class GenericNodeRenderer;
36#if BOOST_VERSION < 107900
37#define a <::BOOST_VERSION>
39#error Boost version not supported anymore
41using gfx_input = ossia::variant<
42 ossia::monostate, ossia::value, ossia::audio_vector, ossia::render_target_spec,
43 ossia::transform3d, FunctionMessage, ossia::buffer_spec>;
52 ossia::time_value date{};
53 ossia::time_value parent_duration{};
63 std::vector<gfx_input> input;
74 QRhiTexture::Format format = QRhiTexture::Format ::RGBA8;
76 QRhiSampler::Filter mag_filter = QRhiSampler::Linear;
77 QRhiSampler::Filter min_filter = QRhiSampler::Linear;
78 QRhiSampler::Filter mipmap_mode = QRhiSampler::None;
80 QRhiSampler::AddressMode address_u = QRhiSampler::Repeat;
81 QRhiSampler::AddressMode address_v = QRhiSampler::Repeat;
82 QRhiSampler::AddressMode address_w = QRhiSampler::Repeat;
96inline bool isUnsetSamplerField(
auto v)
noexcept
103SCORE_PLUGIN_GFX_EXPORT
108SCORE_PLUGIN_GFX_EXPORT
114class SCORE_PLUGIN_GFX_EXPORT
Node :
public QObject
122 Node& operator=(
const Node&) =
delete;
133 virtual void renderedNodesChanged();
138 virtual void process(
Message&& msg);
139 virtual void update();
150 ossia::small_pod_vector<Port*, 1>
output;
175 materialChanged.fetch_add(1, std::memory_order_release);
177 bool hasMaterialChanged(int64_t& renderer)
const noexcept
179 int64_t res = materialChanged.load(std::memory_order_acquire);
187 std::atomic_int64_t materialChanged{0};
194 renderTargetSpecChanged.fetch_add(1, std::memory_order_release);
196 bool hasRenderTargetChanged(int64_t& renderer)
const noexcept
198 int64_t res = renderTargetSpecChanged.load(std::memory_order_acquire);
206 std::atomic_int64_t renderTargetSpecChanged{-1};
208 int32_t nodeId = score::gfx::invalid_node_index;
209 bool requiresDepth{};
220 auto it = renderTargetSpecs.find(port);
221 return it != renderTargetSpecs.end() && it->second.size.has_value();
231 auto it = renderTargetSpecs.find(port);
232 return it != renderTargetSpecs.end()
233 && (it->second.size.has_value() || it->second.format_set
234 || it->second.format != ossia::texture_format::RGBA8);
237 QSize resolveRenderTargetSize(int32_t port,
RenderList& renderer)
const noexcept;
239 resolveRenderTargetSpecs(int32_t port,
RenderList& renderer)
const noexcept;
244 virtual void adjustRenderTargetSpecs(int32_t port,
RenderTargetSpecs& spec)
const noexcept;
257 std::optional<RenderTargetSpecs> firstInputRenderTargetSpecs() const noexcept;
259 void process(int32_t port, const ossia::render_target_spec& v);
277 void process(
Message&& msg)
override;
278 virtual void process(
Timings tk);
279 virtual void process(int32_t port,
const ossia::value& v);
280 virtual void process(int32_t port,
const ossia::audio_vector& v);
282 virtual void process(int32_t port,
const ossia::transform3d& v);
283 void process(int32_t port, ossia::monostate)
const noexcept { }
284 virtual void process(int32_t port,
const FunctionMessage&);
285 virtual void process(int32_t port,
const ossia::buffer_spec&);
297 for(
int* p : m_event_ports)
313 if(!v.target<ossia::impulse>() || port < 0 || port >=
int(this->input.size()))
315 auto* data =
static_cast<int*
>(this->input[port]->value);
316 if(std::find(m_event_ports.begin(), m_event_ports.end(), data)
317 == m_event_ports.end())
320 this->materialChange();
335 createRenderer(
RenderList& r)
const noexcept override;
338 std::unique_ptr<char[]> m_materialData;
345QDebug operator<<(QDebug,
const std::vector<score::gfx::gfx_input>&);
Generic renderer.
Definition NodeRenderer.hpp:337
Root data model for visual nodes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:115
bool hasExplicitRenderTargetSize(int32_t port) const noexcept
Whether a given port has a user-specified render target size.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:218
ossia::flat_map< int32_t, ossia::render_target_spec > renderTargetSpecs
Render target info.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:168
std::vector< Port * > input
Input ports of that node.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:144
bool hasExplicitRenderTargetSpecs(int32_t port) const noexcept
Whether the user set a size or a format on a texture inlet.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:229
void renderTargetChange() noexcept
Used to notify a render target (texture inlet) change from the model to the renderers.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:192
void materialChange() noexcept
Used to notify a material change from the model to the renderers.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:173
std::vector< std::shared_ptr< PreviewTap > > previewTaps
Previews of the outputs of this node, read back by a render list of the patch that renders it....
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:161
ossia::flat_map< RenderList *, score::gfx::NodeRenderer * > renderedNodes
Map associating each RenderList to a Renderer for this model.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:155
virtual NodeRenderer * createRenderer(RenderList &r) const noexcept=0
Create a renderer in a given context for this node.
ossia::small_pod_vector< Port *, 1 > output
Output ports of that node.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:150
Common base class for most single-pass, simple nodes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:329
Renderer for a given node.
Definition NodeRenderer.hpp:11
Common base class for nodes that map to score processes.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:266
bool fireEventPort(int32_t port, const ossia::value &v) noexcept
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:311
std::vector< int * > m_event_ports
Values of the EVENT inputs: 1 for the frame they fire in, else 0.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:289
bool resetEventPortsAfterFrame() noexcept
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:294
List of nodes to be rendered to an output.
Definition RenderList.hpp:36
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
RenderTargetSpecs toRenderTargetSpecs(const ossia::render_target_spec &in) noexcept
Definition score-plugin-gfx/Gfx/Graph/Node.cpp:445
void resolveSamplerFields(RenderTargetSpecs &spec, const isf::sampler_config &cfg) noexcept
Definition score-plugin-gfx/Gfx/Graph/Utils.cpp:2839
constexpr int unsetSamplerField
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:95
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:60
uint64_t tick
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:67
UBO specific to individual processes / nodes.
Definition CommonUBOs.hpp:23
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:71
Messages sent from the execution thread to the rendering thread.
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:51
double sample_rate
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:56