summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/utils.c')
-rw-r--r--video/out/opengl/utils.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c
index 7329240593..02f1ea6584 100644
--- a/video/out/opengl/utils.c
+++ b/video/out/opengl/utils.c
@@ -355,13 +355,18 @@ bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h,
int cw = w, ch = h;
- if ((flags & FBOTEX_FUZZY_W) && cw < fbo->w)
- cw = fbo->w;
- if ((flags & FBOTEX_FUZZY_H) && ch < fbo->h)
- ch = fbo->h;
-
- if (fbo->w == cw && fbo->h == ch && fbo->iformat == iformat)
+ if ((flags & FBOTEX_FUZZY_W) && cw < fbo->rw)
+ cw = fbo->rw;
+ if ((flags & FBOTEX_FUZZY_H) && ch < fbo->rh)
+ ch = fbo->rh;
+
+ if (fbo->rw == cw && fbo->rh == ch && fbo->iformat == iformat) {
+ fbo->lw = w;
+ fbo->lh = h;
return true;
+ }
+
+ int lw = w, lh = h;
if (flags & FBOTEX_FUZZY_W)
w = MP_ALIGN_UP(w, 256);
@@ -384,12 +389,15 @@ bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h,
*fbo = (struct fbotex) {
.gl = gl,
- .w = w,
- .h = h,
+ .rw = w,
+ .rh = h,
+ .lw = lw,
+ .lh = lh,
.iformat = iformat,
};
- mp_verbose(log, "Create FBO: %dx%d\n", fbo->w, fbo->h);
+ mp_verbose(log, "Create FBO: %dx%d -> %dx%d\n", fbo->lw, fbo->lh,
+ fbo->rw, fbo->rh);
if (!(gl->mpgl_caps & MPGL_CAP_FB))
return false;
@@ -397,7 +405,7 @@ bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h,
gl->GenFramebuffers(1, &fbo->fbo);
gl->GenTextures(1, &fbo->texture);
gl->BindTexture(GL_TEXTURE_2D, fbo->texture);
- gl->TexImage2D(GL_TEXTURE_2D, 0, format.internal_format, fbo->w, fbo->h, 0,
+ gl->TexImage2D(GL_TEXTURE_2D, 0, format.internal_format, fbo->rw, fbo->rh, 0,
format.format, format.type, NULL);
gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
@@ -977,7 +985,7 @@ void gl_sc_gen_shader_and_reset(struct gl_shader_cache *sc)
}
ADD(frag, "void main() {\n");
// we require _all_ frag shaders to write to a "vec4 color"
- ADD(frag, "vec4 color;\n");
+ ADD(frag, "vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n");
ADD(frag, "%s", sc->text);
if (gl->glsl_version >= 130) {
ADD(frag, "out_color = color;\n");