Loading...
Searching...
No Matches
RenderedRawRasterPipelineNode.hpp
1#pragma once
2
3#include <Gfx/Graph/ISFNode.hpp>
4#include <Gfx/Graph/NodeRenderer.hpp>
5#include <Gfx/Graph/RenderedISFUtils.hpp>
6
7namespace score::gfx
8{
9// Used for the simple case of a single, non-persistent pass (the most common case)
10
12{
13 explicit RenderedRawRasterPipelineNode(const ISFNode& node) noexcept;
14
16
17 void updateInputTexture(const Port& input, QRhiTexture* tex) override;
18
19 void init(RenderList& renderer, QRhiResourceUpdateBatch& res) override;
20 void update(RenderList& renderer, QRhiResourceUpdateBatch& res, Edge* edge) override;
21 bool updateMaterials(RenderList& renderer, QRhiResourceUpdateBatch& res, Edge* edge);
22 void release(RenderList& r) override;
23
24 void runInitialPasses(
25 RenderList&, QRhiCommandBuffer& commands, QRhiResourceUpdateBatch*& res,
26 Edge& edge) override;
27
28 void runRenderPass(RenderList&, QRhiCommandBuffer& commands, Edge& edge) override;
29
30 void process(int32_t port, const ossia::transform3d& v) override;
31
32private:
33 void initPass(const TextureRenderTarget& rt, RenderList& renderer, Edge& edge);
34
35 std::vector<Sampler> allSamplers() const noexcept;
36
37 ossia::small_vector<std::pair<Edge*, Pass>, 2> m_passes;
38
39 ISFNode& n;
40
41 std::vector<Sampler> m_inputSamplers;
42 std::vector<Sampler> m_audioSamplers;
43
44 int64_t meshChangedIndex{-1};
45 const Mesh* m_mesh{};
46 MeshBuffers m_meshbufs;
47
48 QRhiBuffer* m_materialUBO{};
49 int m_materialSize{};
50
51 QRhiBuffer* m_modelUBO{};
52
53 struct AuxiliarySSBO
54 {
55 QRhiBuffer* buffer{};
56 int64_t size{};
57 bool owned{true}; // false when adopted from upstream geometry
58 std::string name;
59 std::string access;
60 };
61 std::vector<AuxiliarySSBO> m_auxiliarySSBOs;
62
63 std::optional<AudioTextureUpload> m_audioTex;
64
65 // The part of the m_materialUBO for which changes
66 // trigger a pipeline recreation (blend status etc.)
67 static constexpr int size_of_pipeline_material = 32;
68 char m_prevPipelineChangingMaterial[size_of_pipeline_material]{0};
69 struct PipelineChangingMaterial
70 {
71 int32_t mode; // tri, point, line
72 int32_t enable_blend; // bool
73 QRhiGraphicsPipeline::BlendFactor src_color;
74 QRhiGraphicsPipeline::BlendFactor dst_color;
75 QRhiGraphicsPipeline::BlendOp op_color;
76 QRhiGraphicsPipeline::BlendFactor src_alpha;
77 QRhiGraphicsPipeline::BlendFactor dst_alpha;
78 QRhiGraphicsPipeline::BlendOp op_alpha;
79 };
80 static_assert(sizeof(PipelineChangingMaterial) == size_of_pipeline_material);
81
82 ossia::transform3d m_modelTransform;
83};
84}
Data model for Interactive Shader Format filters.
Definition ISFNode.hpp:20
Renderer for a given node.
Definition NodeRenderer.hpp:11
List of nodes to be rendered to an output.
Definition RenderList.hpp:19
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:12
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:75
Definition Mesh.hpp:33
Data model for meshes.
Definition Mesh.hpp:46
Port of a score::gfx::Node.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:54
Definition RenderedRawRasterPipelineNode.hpp:12
void updateInputTexture(const Port &input, QRhiTexture *tex) override
Definition RenderedRawRasterPipelineNode.cpp:19
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:122