2#include <Gfx/Graph/RenderList.hpp>
3#include <Gfx/Graph/RenderState.hpp>
4#include <Gfx/Graph/decoders/GPUVideoDecoder.hpp>
42 QRhi& rhi,
const RenderState& state, QRhiTexture* inputRGBA,
int width,
int height,
43 const QString& colorConversion = colorMatrixOut())
48 virtual void exec(QRhi& rhi, QRhiCommandBuffer& cb) = 0;
54 virtual const QRhiReadbackResult&
readback(
int plane)
const = 0;
64 layout(location = 0) out vec2 v_texcoord;
65 out gl_PerVertex { vec4 gl_Position; };
68 float((gl_VertexIndex & 1) * 4 - 1),
69 float((gl_VertexIndex & 2) * 2 - 1)
71 v_texcoord = pos * 0.5 + 0.5;
72 gl_Position = vec4(pos, 0.0, 1.0);
81 const vec3 yuv_offset = vec3(0.0, 0.5, 0.5);
82 vec3 rgb_to_yuv(vec3 rgb) {
84 dot(rgb, vec3( 0.2126, 0.7152, 0.0722)),
85 dot(rgb, vec3(-0.1146, -0.3854, 0.5 )),
86 dot(rgb, vec3( 0.5, -0.4542, -0.0458))
93 vec2 flip_y(vec2 tc) {
94 #if defined(QSHADER_MSL) || defined(QSHADER_HLSL)
97 return vec2(tc.x, 1.0 - tc.y);
GPU shader generation for RGB->YUV color space conversion (output/encoding).
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:12
Base class for GPU-side video format conversion (RGBA to YUV).
Definition GPUVideoEncoder.hpp:30
static constexpr const char * y_flip_glsl
Fragment shader Y-flip: on GL, flip v_texcoord.y. On Metal/HLSL, no flip.
Definition GPUVideoEncoder.hpp:92
static constexpr const char * vertex_shader
Definition GPUVideoEncoder.hpp:63
static constexpr const char * rgb_to_yuv_glsl
Definition GPUVideoEncoder.hpp:80
virtual const QRhiReadbackResult & readback(int plane) const =0
Get the readback result for a given plane. Valid after endOffscreenFrame.
virtual void exec(QRhi &rhi, QRhiCommandBuffer &cb)=0
virtual int planeCount() const =0
Number of readback planes (1 for UYVY, 2 for NV12, 3 for I420).
virtual void init(QRhi &rhi, const RenderState &state, QRhiTexture *inputRGBA, int width, int height, const QString &colorConversion=colorMatrixOut())=0
virtual void release()=0
Release all GPU resources.
Global state associated to a rendering context.
Definition RenderState.hpp:37