[vlc-commits] opengl: remove alpha parameter from prepare_shader
Romain Vimont
git at videolan.org
Wed May 20 14:55:51 CEST 2020
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Wed Feb 5 15:07:40 2020 +0100| [9c0d5b584d00dea64c3989d089605da0500783d8] | committer: Alexandre Janniaux
opengl: remove alpha parameter from prepare_shader
The alpha value was used to render subpictures, which are now drawn by
the subpictures renderer using its own fragment shader.
Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c0d5b584d00dea64c3989d089605da0500783d8
---
modules/video_output/opengl/fragment_shaders.c | 17 +++++------------
modules/video_output/opengl/renderer.c | 2 +-
modules/video_output/opengl/sampler.h | 6 ++----
3 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index 9641ea0ad1..a15bca319c 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -254,10 +254,6 @@ sampler_base_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
}
}
- sampler->uloc.FillColor = vt->GetUniformLocation(program, "FillColor");
- if (sampler->uloc.FillColor == -1)
- return VLC_EGENERIC;
-
#ifdef HAVE_LIBPLACEBO
const struct pl_shader_res *res = sampler->pl_sh_res;
for (int i = 0; res && i < res->num_variables; i++) {
@@ -283,7 +279,7 @@ GetTransformMatrix(const struct vlc_gl_interop *interop)
static void
sampler_base_prepare_shader(const struct vlc_gl_sampler *sampler,
const GLsizei *tex_width,
- const GLsizei *tex_height, float alpha)
+ const GLsizei *tex_height)
{
(void) tex_width; (void) tex_height;
const struct vlc_gl_interop *interop = sampler->interop;
@@ -305,8 +301,6 @@ sampler_base_prepare_shader(const struct vlc_gl_sampler *sampler,
sampler->var.TexCoordsMap[i]);
}
- vt->Uniform4f(sampler->uloc.FillColor, 1.0f, 1.0f, 1.0f, alpha);
-
const GLfloat *tm = GetTransformMatrix(interop);
vt->UniformMatrix4fv(sampler->uloc.TransformMatrix, 1, GL_FALSE, tm);
@@ -384,9 +378,9 @@ sampler_xyz12_fetch_locations(struct vlc_gl_sampler *sampler, GLuint program)
static void
sampler_xyz12_prepare_shader(const struct vlc_gl_sampler *sampler,
const GLsizei *tex_width,
- const GLsizei *tex_height, float alpha)
+ const GLsizei *tex_height)
{
- (void) tex_width; (void) tex_height; (void) alpha;
+ (void) tex_width; (void) tex_height;
const struct vlc_gl_interop *interop = sampler->interop;
const opengl_vtable_t *vt = sampler->vt;
@@ -661,8 +655,7 @@ opengl_fragment_shader_init(struct vlc_gl_renderer *renderer, GLenum tex_target,
if (is_yuv)
ADD("uniform mat4 ConvMatrix;\n");
- ADD("uniform vec4 FillColor;\n"
- "vec4 vlc_texture(vec2 pic_coords) {\n"
+ ADD("vec4 vlc_texture(vec2 pic_coords) {\n"
/* Homogeneous (oriented) coordinates */
" vec3 pic_hcoords = vec3((TransformMatrix * OrientationMatrix * vec4(pic_coords, 0.0, 1.0)).st, 1.0);\n"
" vec2 tex_coords;\n");
@@ -712,7 +705,7 @@ opengl_fragment_shader_init(struct vlc_gl_renderer *renderer, GLenum tex_target,
}
#endif
- ADD(" return result * FillColor;\n"
+ ADD(" return result;\n"
"}\n");
#undef ADD
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index ba450e063c..f544198345 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -832,7 +832,7 @@ static void DrawWithShaders(struct vlc_gl_renderer *renderer)
struct vlc_gl_sampler *sampler = renderer->sampler;
const opengl_vtable_t *vt = renderer->vt;
sampler->pf_prepare_shader(sampler, sampler->tex_width,
- sampler->tex_height, 1.0f);
+ sampler->tex_height);
vt->BindBuffer(GL_ARRAY_BUFFER, renderer->texture_buffer_object);
assert(renderer->aloc.PicCoordsIn != -1);
diff --git a/modules/video_output/opengl/sampler.h b/modules/video_output/opengl/sampler.h
index c021ce8edf..c295083df2 100644
--- a/modules/video_output/opengl/sampler.h
+++ b/modules/video_output/opengl/sampler.h
@@ -61,7 +61,6 @@ struct vlc_gl_sampler {
GLint Texture[PICTURE_PLANE_MAX];
GLint TexSize[PICTURE_PLANE_MAX]; /* for GL_TEXTURE_RECTANGLE */
GLint ConvMatrix;
- GLint FillColor;
GLint *pl_vars; /* for pl_sh_res */
GLint TransformMatrix;
@@ -112,11 +111,10 @@ struct vlc_gl_sampler {
* \param sampler the sampler
* \param tex_width array of tex width (one per plane)
* \param tex_height array of tex height (one per plane)
- * \param alpha alpha value, used only for RGBA fragment shader
*/
void (*pf_prepare_shader)(const struct vlc_gl_sampler *sampler,
- const GLsizei *tex_width, const GLsizei *tex_height,
- float alpha);
+ const GLsizei *tex_width,
+ const GLsizei *tex_height);
};
/**
More information about the vlc-commits
mailing list