Go to the documentation of this file.
6 #define LOC QString("Tonemap: ")
8 #ifndef GL_SHADER_STORAGE_BUFFER
9 #define GL_SHADER_STORAGE_BUFFER 0x90D2
11 #ifndef GL_ALL_BARRIER_BITS
12 #define GL_ALL_BARRIER_BITS 0xFFFFFFFF
14 #ifndef GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
15 #define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
17 #ifndef GL_STREAM_COPY
18 #define GL_STREAM_COPY 0x88E2
21 #define GL_WRITE_ONLY 0x88B9
30 m_extra = Render->extraFunctions();
75 size_t size = Inputs.size();
90 if (!
CreateShader(size, Inputs[0]->m_frameFormat, Inputs[0]->m_size))
98 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to allocate storage buffer");
103 struct dummy {
float a[2] {0.0F}; uint32_t b {0}; uint32_t c {0}; uint32_t
d {0}; } buffer;
109 for (
size_t i = 0; i < size; ++i)
113 Inputs[i]->m_texture->bind();
115 m_render->glBindTexture(Inputs[i]->m_target, Inputs[i]->m_textureId);
134 QString source = (
m_render->isOpenGLES() ?
"#version 310 es\n" :
"#version 430\n");
136 source.append(
"#define YV12\n");
138 source.append(
"#define UNSIGNED\n");
147 for (
size_t i = 0; i < InputSize; ++i)
148 m_shader->setUniformValue(QString(
"texture%1").arg(i).toLatin1().constData(),
static_cast<GLuint
>(i));
149 LOG(VB_GENERAL, LOG_INFO, QString(
"Created tonemapping compute shader (%1 inputs)")
163 GLuint textureid = 0;
164 m_render->glGenTextures(1, &textureid);
180 static_cast<GLsizei
>(Size.width()),
static_cast<GLsizei
>(Size.height()));
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
MythOpenGLTonemap(MythRenderOpenGL *Render, MythVideoColourSpace *ColourSpace)
QOpenGLShaderProgram * CreateComputeShader(const QString &Source)
MythVideoTextureOpenGL * Map(std::vector< MythVideoTextureOpenGL * > &Inputs, QSize DisplaySize)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
VideoFrameType m_frameFormat
static bool FormatIs422(VideoFrameType Type)
#define GL_ALL_BARRIER_BITS
#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
static constexpr GLuint kVertexSize
void SetShaderProgramParams(QOpenGLShaderProgram *Program, const QMatrix4x4 &Value, const char *Uniform)
MythVideoTextureOpenGL * m_texture
bool CreateTexture(QSize Size)
~MythOpenGLTonemap() override
static int ColorDepth(int Format)
MythVideoColourSpace * m_colourSpace
QOpenGLBuffer * CreateVBO(int Size, bool Release=true)
void ActiveTexture(GLuint ActiveTex)
static bool FormatIs444(VideoFrameType Type)
static const QString GLSL430Tonemap
bool CreateShader(size_t InputSize, VideoFrameType Type, QSize Size)
static bool FormatIs420(VideoFrameType Type)
void Updated(bool PrimariesChanged)
void UpdateColourSpace(bool PrimariesChanged)
MythVideoTextureOpenGL * GetTexture()
void SetTextureFilters(MythGLTexture *Texture, QOpenGLTexture::Filter Filter, QOpenGLTexture::WrapMode Wrap=QOpenGLTexture::ClampToEdge)
VideoFrameType m_inputType
QMatrix4x4 GetPrimaryMatrix(void)
VideoFrameType m_frameType
static const iso6937table * d
QSize GetTextureSize(QSize Size, bool Normalised)
virtual int IncrRef(void)
Increments reference count.
#define GL_SHADER_STORAGE_BUFFER
QOpenGLShaderProgram * m_shader
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
MythRenderOpenGL * m_render
QOpenGLExtraFunctions * m_extra
bool EnableShaderProgram(QOpenGLShaderProgram *Program)