[vlc-devel] [PATCH] opengl: fragment_shaders: fix TexSize0 usage

Alexandre Janniaux ajanni at videolabs.io
Wed Jun 3 15:23:50 CEST 2020


In the case we're using GL_TEXTURE_RECTANGLE, we need to convert the
normalized texture coordinates into pixel coordinates using TexSize0.
This was done in the case of yuv (cf. is_yuv) in general but not when
is_yuv == false, which leads to failure when fetching uniform
locations on MacOSX.

In particular, this can be tested by forcing the chroma through the
--videotoolbox-cvpx-chroma=BGRA option on MacOSX.
---
 modules/video_output/opengl/fragment_shaders.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index a779d7df5d..e63313cd61 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -680,6 +680,9 @@ opengl_fragment_shader_init(struct vlc_gl_sampler *sampler, GLenum tex_target,
     else
     {
         ADD(" tex_coords = (TexCoordsMap0 * pic_hcoords).st;\n");
+        if (tex_target == GL_TEXTURE_RECTANGLE)
+            ADD(" tex_coords *= TexSize0;\n");
+
         ADDF(" vec4 result = %s(Texture0, tex_coords);\n", lookup);
         color_count = 1;
     }
-- 
2.27.0



More information about the vlc-devel mailing list