diff options
Diffstat (limited to 'video/out/opengl/utils.c')
-rw-r--r-- | video/out/opengl/utils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c index 199895e4ec..f8ed6eebaf 100644 --- a/video/out/opengl/utils.c +++ b/video/out/opengl/utils.c @@ -293,6 +293,7 @@ bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h, if (fbo->rw == cw && fbo->rh == ch && fbo->iformat == iformat) { fbo->lw = w; fbo->lh = h; + fbotex_invalidate(fbo); return true; } @@ -378,6 +379,20 @@ void fbotex_uninit(struct fbotex *fbo) } } +// Mark framebuffer contents as unneeded. +void fbotex_invalidate(struct fbotex *fbo) +{ + GL *gl = fbo->gl; + + if (!fbo->fbo || !gl->InvalidateFramebuffer) + return; + + gl->BindFramebuffer(GL_FRAMEBUFFER, fbo->fbo); + gl->InvalidateFramebuffer(GL_FRAMEBUFFER, 1, + (GLenum[]){GL_COLOR_ATTACHMENT0}); + gl->BindFramebuffer(GL_FRAMEBUFFER, 0); +} + // Standard parallel 2D projection, except y1 < y0 means that the coordinate // system is flipped, not the projection. void gl_transform_ortho(struct gl_transform *t, float x0, float x1, |