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 TextureRenderTarget renderTargetForInput(const Port& p) override;
18 void updateInputTexture(const Port& input, QRhiTexture* tex) override;
19
20 void init(RenderList& renderer, QRhiResourceUpdateBatch& res) override;
21 void update(RenderList& renderer, QRhiResourceUpdateBatch& res, Edge* edge) override;
22 bool updateMaterials(RenderList& renderer, QRhiResourceUpdateBatch& res, Edge* edge);
23 void release(RenderList& r) override;
24
25 void runInitialPasses(
26 RenderList&, QRhiCommandBuffer& commands, QRhiResourceUpdateBatch*& res,
27 Edge& edge) override;
28
29 void runRenderPass(RenderList&, QRhiCommandBuffer& commands, Edge& edge) override;
30
31 void process(int32_t port, const ossia::transform3d& v) override;
32
33private:
34 ossia::small_flat_map<const Port*, TextureRenderTarget, 2> m_rts;
35
36 void initPass(const TextureRenderTarget& rt, RenderList& renderer, Edge& edge);
37
38 std::vector<Sampler> allSamplers() const noexcept;
39
40 ossia::small_vector<std::pair<Edge*, Pass>, 2> m_passes;
41
42 ISFNode& n;
43
44 std::vector<Sampler> m_inputSamplers;
45 std::vector<Sampler> m_audioSamplers;
46
47 int64_t meshChangedIndex{-1};
48 const Mesh* m_mesh{};
49 MeshBuffers m_meshbufs;
50
51 QRhiBuffer* m_materialUBO{};
52 int m_materialSize{};
53
54 QRhiBuffer* m_modelUBO{};
55
56 std::optional<AudioTextureUpload> m_audioTex;
57
58 // The part of the m_materialUBO for which changes
59 // trigger a pipeline recreation (blend status etc.)
60 static constexpr int size_of_pipeline_material = 32;
61 char m_prevPipelineChangingMaterial[size_of_pipeline_material]{0};
62 struct PipelineChangingMaterial
63 {
64 int32_t mode; // tri, point, line
65 int32_t enable_blend; // bool
66 QRhiGraphicsPipeline::BlendFactor src_color;
67 QRhiGraphicsPipeline::BlendFactor dst_color;
68 QRhiGraphicsPipeline::BlendOp op_color;
69 QRhiGraphicsPipeline::BlendFactor src_alpha;
70 QRhiGraphicsPipeline::BlendFactor dst_alpha;
71 QRhiGraphicsPipeline::BlendOp op_alpha;
72 };
73 static_assert(sizeof(PipelineChangingMaterial) == size_of_pipeline_material);
74
75 ossia::transform3d m_modelTransform;
76};
77}
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:74
Definition Mesh.hpp:23
Data model for meshes.
Definition Mesh.hpp:30
Port of a score::gfx::Node.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:53
Definition RenderedRawRasterPipelineNode.hpp:12
void updateInputTexture(const Port &input, QRhiTexture *tex) override
Definition RenderedRawRasterPipelineNode.cpp:26
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:119