mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
gstqsg6material: pass the texture-target from caps to shader
The Material has to select the correct Shader depending on the negotiated texture target. Pass the texture target from the caps to the shader creation as it is already done for the pixel format. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7319>
This commit is contained in:
parent
429042fb70
commit
5f6f755f5b
2 changed files with 16 additions and 3 deletions
|
@ -258,7 +258,7 @@ GstQSGTexture::rhiTexture() const
|
||||||
|
|
||||||
class GstQSGMaterialShader : public QSGMaterialShader {
|
class GstQSGMaterialShader : public QSGMaterialShader {
|
||||||
public:
|
public:
|
||||||
GstQSGMaterialShader(GstVideoFormat v_format);
|
GstQSGMaterialShader(GstVideoFormat v_format, GstGLTextureTarget target);
|
||||||
~GstQSGMaterialShader();
|
~GstQSGMaterialShader();
|
||||||
|
|
||||||
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
|
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
|
||||||
|
@ -269,7 +269,8 @@ private:
|
||||||
QSGTexture *m_textures[GST_VIDEO_MAX_PLANES];
|
QSGTexture *m_textures[GST_VIDEO_MAX_PLANES];
|
||||||
};
|
};
|
||||||
|
|
||||||
GstQSGMaterialShader::GstQSGMaterialShader(GstVideoFormat v_format)
|
GstQSGMaterialShader::GstQSGMaterialShader(GstVideoFormat v_format,
|
||||||
|
GstGLTextureTarget target)
|
||||||
: v_format(v_format)
|
: v_format(v_format)
|
||||||
{
|
{
|
||||||
const gchar *frag_shader;
|
const gchar *frag_shader;
|
||||||
|
@ -441,17 +442,28 @@ QSGMaterialShader *
|
||||||
GstQSGMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
|
GstQSGMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
|
||||||
{
|
{
|
||||||
GstVideoFormat v_format = GST_VIDEO_INFO_FORMAT (&this->v_info);
|
GstVideoFormat v_format = GST_VIDEO_INFO_FORMAT (&this->v_info);
|
||||||
|
GstGLTextureTarget target = this->tex_target;
|
||||||
|
|
||||||
return new GstQSGMaterialShader(v_format);
|
return new GstQSGMaterialShader(v_format, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only called from the streaming thread with scene graph thread blocked */
|
/* only called from the streaming thread with scene graph thread blocked */
|
||||||
void
|
void
|
||||||
GstQSGMaterial::setCaps (GstCaps * caps)
|
GstQSGMaterial::setCaps (GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
GstStructure *s;
|
||||||
|
const gchar *target_str;
|
||||||
|
|
||||||
GST_LOG ("%p setCaps %" GST_PTR_FORMAT, this, caps);
|
GST_LOG ("%p setCaps %" GST_PTR_FORMAT, this, caps);
|
||||||
|
|
||||||
gst_video_info_from_caps (&this->v_info, caps);
|
gst_video_info_from_caps (&this->v_info, caps);
|
||||||
|
|
||||||
|
s = gst_caps_get_structure (caps, 0);
|
||||||
|
target_str = gst_structure_get_string (s, "texture-target");
|
||||||
|
if (!target_str)
|
||||||
|
target_str = GST_GL_TEXTURE_TARGET_2D_STR;
|
||||||
|
|
||||||
|
this->tex_target = gst_gl_texture_target_from_string(target_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only called from the streaming thread with scene graph thread blocked */
|
/* only called from the streaming thread with scene graph thread blocked */
|
||||||
|
|
|
@ -68,6 +68,7 @@ private:
|
||||||
GstBuffer * sync_buffer_;
|
GstBuffer * sync_buffer_;
|
||||||
GstMemory * mem_;
|
GstMemory * mem_;
|
||||||
GstVideoInfo v_info;
|
GstVideoInfo v_info;
|
||||||
|
GstGLTextureTarget tex_target;
|
||||||
GstVideoFrame v_frame;
|
GstVideoFrame v_frame;
|
||||||
QSGTexture::Filtering m_filtering;
|
QSGTexture::Filtering m_filtering;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue