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
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 ossia::small_flat_map<const Port*, TextureRenderTarget, 2> m_rts;
34
35 void initPass(const TextureRenderTarget& rt, RenderList& renderer, Edge& edge);
36
37 std::vector<Sampler> allSamplers() const noexcept;
38
39 ossia::small_vector<std::pair<Edge*, Pass>, 2> m_passes;
40
41 ISFNode& n;
42
43 std::vector<Sampler> m_inputSamplers;
44 std::vector<Sampler> m_audioSamplers;
45
46 int64_t meshChangedIndex{-1};
47 const Mesh* m_mesh{};
48 MeshBuffers m_meshbufs;
49
50 QRhiBuffer* m_materialUBO{};
51 int m_materialSize{};
52
53 QRhiBuffer* m_modelUBO{};
54
55 std::optional<AudioTextureUpload> m_audioTex;
56
57 // The part of the m_materialUBO for which changes
58 // trigger a pipeline recreation (blend status etc.)
59 static constexpr int size_of_pipeline_material = 32;
60 char m_prevPipelineChangingMaterial[size_of_pipeline_material]{0};
61 struct PipelineChangingMaterial
62 {
63 int32_t mode; // tri, point, line
64 int32_t enable_blend; // bool
65 QRhiGraphicsPipeline::BlendFactor src_color;
66 QRhiGraphicsPipeline::BlendFactor dst_color;
67 QRhiGraphicsPipeline::BlendOp op_color;
68 QRhiGraphicsPipeline::BlendFactor src_alpha;
69 QRhiGraphicsPipeline::BlendFactor dst_alpha;
70 QRhiGraphicsPipeline::BlendOp op_alpha;
71 };
72 static_assert(sizeof(PipelineChangingMaterial) == size_of_pipeline_material);
73
74 ossia::transform3d m_modelTransform;
75};
76}
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:71
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
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:116