From 6a31404aa0659cdbdf659de34a5af3031d4b3fd1 Mon Sep 17 00:00:00 2001 From: jojo61 Date: Mon, 22 Jun 2020 16:35:37 +0200 Subject: [PATCH] Optimize for hbbtv plugin --- openglosd.cpp | 7 ++++++- video.c | 14 ++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/openglosd.cpp b/openglosd.cpp index 8abfc1c..edd8f77 100644 --- a/openglosd.cpp +++ b/openglosd.cpp @@ -84,6 +84,8 @@ uniform sampler2D screenTexture; \ void main() \ { \ color = texture(screenTexture, TexCoords) * alphaValue; \ + if (color == vec4(0.0,0.0,0.0,1.0))\ + color.a = 0.0;\ } \ "; @@ -747,6 +749,9 @@ void cOglVb::SetShaderColor(GLint color) void cOglVb::SetShaderAlpha(GLint alpha) { + GLfloat a = (GLfloat) (alpha) / 255.0f; + if (a > 0.98) + a = 1.0; Shaders[shader]->SetVector4f("alpha", 1.0f, 1.0f, 1.0f, (GLfloat) (alpha) / 255.0f); } @@ -1272,7 +1277,7 @@ cOglCmdDrawText::cOglCmdDrawText(cOglFb * fb, GLint x, GLint y, unsigned int *sy this->x = x; this->y = y; this->limitX = limitX; - this->colorText = colorText; + this->colorText = colorText & 0xfeffffff; this->fontSize = fontSize; this->symbols = symbols; this->fontName = name; diff --git a/video.c b/video.c index 0605377..e55963f 100644 --- a/video.c +++ b/video.c @@ -1557,9 +1557,12 @@ static void CuvidDestroySurfaces(CuvidDecoder * decoder) #endif #endif -#if defined PLACEBO && API_VER >= 58 +#ifdef PLACEBO + pl_gpu_finish(p->gpu); +#if API_VER >= 58 p->num_shaders = 0; -#endif +#endif +#endif for (i = 0; i < decoder->SurfacesNeeded; i++) { if (decoder->frames[i]) { @@ -3875,7 +3878,10 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused)) } } render_params.hooks = &p->hook; - render_params.num_hooks = p->num_shaders; + if (ovl) + render_params.num_hooks = 0; // no shaders when OSD activ + else + render_params.num_hooks = p->num_shaders; #endif if (decoder->newchannel && current == 0) { @@ -5465,7 +5471,7 @@ void exit_display() if (osdoverlay.plane.texture) pl_tex_destroy(p->gpu, &osdoverlay.plane.texture); - pl_renderer_destroy(&p->renderer); + // pl_renderer_destroy(&p->renderer); if (p->renderertest) { pl_renderer_destroy(&p->renderertest); p->renderertest = NULL;