2#include <Gfx/Graph/NodeRenderer.hpp>
3#include <Gfx/Graph/VideoNode.hpp>
4#include <Gfx/Graph/decoders/GPUVideoDecoder.hpp>
5#include <Video/VideoInterface.hpp>
25 AVPixelFormat fmt,
int w,
int h)
noexcept
33 const int pictureH = (src.interlacing == Video::Interlacing::Fields) ? h * 2 : h;
35 return fmt != built.pixel_format || w != built.width || pictureH != built.height
36 || src.output_format != built.output_format || src.tonemap != built.tonemap
41 || src.color_space != built.color_space || src.color_range != built.color_range
42 || src.color_trc != built.color_trc
43 || src.color_primaries != built.color_primaries
46 || src.interlacing != built.interlacing;
61 QRhiTexture* texture()
const noexcept {
return m_rt.texture; }
66 RenderList& renderer, QRhiResourceUpdateBatch& res,
const Port& output,
68 const QShader& vertex,
const QShader& fragment, QRhiBuffer* processUBO,
69 std::span<const Sampler> samplers);
73 RenderList& renderer, QRhiCommandBuffer& cb, QRhiResourceUpdateBatch*& res,
83 QRhiBuffer* m_material{};
84 int64_t m_renderedFrame{-1};
102 void createGpuDecoder();
104 void checkFormat(
RenderList& r, AVPixelFormat fmt,
int w,
int h);
106 void init(
RenderList& renderer, QRhiResourceUpdateBatch& res)
override;
107 void runRenderPass(
RenderList&, QRhiCommandBuffer& commands,
Edge& edge)
override;
109 void update(
RenderList& renderer, QRhiResourceUpdateBatch& res,
Edge* edge)
override;
110 void runInitialPasses(
111 RenderList&, QRhiCommandBuffer& commands, QRhiResourceUpdateBatch*& res,
112 Edge& edge)
override;
119 RenderList& renderer,
Edge& edge, QRhiResourceUpdateBatch& res)
override;
125 void displayFrame(AVFrame& frame,
RenderList& renderer, QRhiResourceUpdateBatch& res);
130 return static_cast<const VideoNodeBase&
>(NodeRenderer::node);
136 QRhiBuffer* m_processUBO{};
137 QRhiBuffer* m_materialUBO{};
141 std::unique_ptr<GPUVideoDecoder> m_gpu;
142 std::pair<QShader, QShader> m_shaders;
148 float m_fieldParity{};
152 bool m_fieldPartnerValid{};
155 QSize m_scaleRenderSize{};
157 std::shared_ptr<RefcountedFrame> m_currentFrame{};
158 int64_t m_currentFrameIdx{-1};
159 bool m_recomputeScale{};
Renderer for a given node.
Definition NodeRenderer.hpp:11
List of nodes to be rendered to an output.
Definition RenderList.hpp:33
Definition VideoNode.hpp:82
Definition VideoNodeRenderer.hpp:88
QRhiTexture * textureForOutput(const Port &output) override
Definition VideoNodeRenderer.cpp:393
bool hasOutputPassForEdge(Edge &edge) const override
Check if this renderer already has an output pass for the given edge.
Definition VideoNodeRenderer.cpp:264
void removeOutputPass(RenderList &renderer, Edge &edge) override
Definition VideoNodeRenderer.cpp:253
void releaseState(RenderList &renderer) override
Definition VideoNodeRenderer.cpp:270
void addOutputPass(RenderList &renderer, Edge &edge, QRhiResourceUpdateBatch &res) override
Create a pass for a new output edge (pipeline, SRB, processUBO).
Definition VideoNodeRenderer.cpp:234
void initState(RenderList &renderer, QRhiResourceUpdateBatch &res) override
Definition VideoNodeRenderer.cpp:203
The decoded frame, converted to RGBA into a texture of the renderer's own.
Definition VideoNodeRenderer.hpp:59
void update(RenderList &renderer, QRhiResourceUpdateBatch &res, const Port &output, const Video::ImageFormat &format, const VideoMaterialUBO &material, const QShader &vertex, const QShader &fragment, QRhiBuffer *processUBO, std::span< const Sampler > samplers)
Definition VideoNodeRenderer.cpp:24
void render(RenderList &renderer, QRhiCommandBuffer &cb, QRhiResourceUpdateBatch *&res, const MeshBuffers &mesh)
Draws the frame into the texture, once per frame.
Definition VideoNodeRenderer.cpp:66
void releasePipeline()
The decoder's samplers were rebuilt.
Definition VideoNodeRenderer.cpp:84
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
bool videoDecoderNeedsRebuild(bool hasDecoder, const Video::ImageFormat &built, const Video::ImageFormat &src, AVPixelFormat fmt, int w, int h) noexcept
Whether the GPU decoder has to be rebuilt for this frame.
Definition VideoNodeRenderer.hpp:23
ScaleMode
How to resize a texture to adapt it to a viewport.
Definition Scale.hpp:10
Connection between two score::gfx::Port.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:220
Useful abstraction for storing a graphics pipeline and associated resource bindings.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:262
Port of a score::gfx::Node.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:199
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:291
Definition VideoNode.hpp:31
UBO shared across all video objects.
Definition CommonUBOs.hpp:108