Loading...
Searching...
No Matches
ISFNode.hpp
1#pragma once
2#include <Gfx/Graph/Mesh.hpp>
3#include <Gfx/Graph/Node.hpp>
4#include <Gfx/Graph/RenderList.hpp>
5
6#include <isf.hpp>
7
8#include <score_plugin_gfx_export.h>
9
10#include <limits>
11#include <list>
12#include <span>
13namespace score::gfx
14{
17inline bool is_texture_dimension(double v) noexcept
18{
19 return v >= 1. && v <= double(std::numeric_limits<int>::max());
20}
21
22struct SinglePassISFNode;
23struct RenderedISFNode;
24struct isf_input_port_vis;
30class SCORE_PLUGIN_GFX_EXPORT ISFNode : public score::gfx::ProcessNode
31{
32public:
33 ISFNode(const isf::descriptor& desc, const QString& vert, const QString& frag);
34 ISFNode(const isf::descriptor& desc, const QString& comp);
35
36 virtual ~ISFNode();
37 QSize computeTextureSize(
38 const isf::pass& pass, QSize origSize,
39 std::span<const Sampler> inputSamplers = {});
40
41 score::gfx::NodeRenderer* createRenderer(RenderList& r) const noexcept override;
42
43 const isf::descriptor& descriptor() const noexcept { return m_descriptor; }
44
45 // A raw raster whose shader reads the `camera` block gets one extra Scene
46 // input, after every INPUTS port: a Camera wired there fills that block.
47 static bool hasCameraInput(const isf::descriptor& desc) noexcept;
48 int cameraInput() const noexcept { return m_cameraInput; }
49 void process(Message&& msg) override;
52 void process(int32_t port, const ossia::value& v) override;
53 using ProcessNode::process;
54 friend SinglePassISFNode;
55 friend RenderedISFNode;
56 friend isf_input_port_vis;
57
58 isf::descriptor m_descriptor;
59
60 // Texture format: 1 row = 1 channel of N samples
61 std::list<AudioTexture> m_audio_textures;
62 std::unique_ptr<char[]> m_material_data;
63
64 QString m_vertexS;
65 QString m_fragmentS;
66 QString m_computeS;
67
68 int m_cameraInput{-1};
69 int m_materialSize{};
70 // Bytes of m_material_data the shader's material UBO actually covers. USER
71 // dispatch ports are appended past this: their values are read on the CPU to
72 // size the dispatch, and no generated shader declares them.
73 int m_materialUBOSize{};
74};
75}
Data model for Interactive Shader Format filters.
Definition ISFNode.hpp:31
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:216
List of nodes to be rendered to an output.
Definition RenderList.hpp:33
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
bool is_texture_dimension(double v) noexcept
Definition ISFNode.hpp:17
Definition score-plugin-gfx/Gfx/Graph/Node.hpp:51
Definition RenderedISFNode.hpp:22
Definition ISFNode.cpp:18