diff options
author | Niklas Haas <git@haasn.xyz> | 2017-07-25 06:31:34 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-07-25 06:32:29 +0200 |
commit | 62de84cbe3b060792a7d19cf747a8ba5a697e894 (patch) | |
tree | 0d385ad7e84df2d5f2dce7294421095961d1ee87 | |
parent | d099e037efa2ceaff96c775f5c6f8d1e74650b76 (diff) |
vo_opengl: kill off FBOTEX_COMPUTE again
The textures not having an FBO actually caused regressions when trying
to render the subtitles on top of this texture (--blend-subtitles),
which still relied on an FBO.
So just kill off the logic entirely. Why worry about a single FBO wasted
when we're allocating like 10 anyway.
Fixes #4657.
-rw-r--r-- | video/out/opengl/utils.c | 35 | ||||
-rw-r--r-- | video/out/opengl/utils.h | 1 | ||||
-rw-r--r-- | video/out/opengl/video.c | 6 |
3 files changed, 16 insertions, 26 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c index 451010fffa..d6dac42195 100644 --- a/video/out/opengl/utils.c +++ b/video/out/opengl/utils.c @@ -265,11 +265,8 @@ bool fbotex_init(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h, // Like fbotex_init(), except it can be called on an already initialized FBO; // and if the parameters are the same as the previous call, do not touch it. -// flags can be 0, or a combination of FBOTEX_FUZZY_W, FBOTEX_FUZZY_H and -// FBOTEX_COMPUTE. +// flags can be 0, or a combination of FBOTEX_FUZZY_W and FBOTEX_FUZZY_H. // Enabling FUZZY for W or H means the w or h does not need to be exact. -// FBOTEX_COMPUTE means that the texture will be written to by a compute shader -// instead of actually being attached to an FBO. bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h, GLenum iformat, int flags) { @@ -318,6 +315,7 @@ bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h, .iformat = iformat, }; + 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->rw, fbo->rh, 0, @@ -330,24 +328,21 @@ bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h, gl_check_error(gl, log, "after creating framebuffer texture"); - bool skip_fbo = flags & FBOTEX_COMPUTE; - if (!skip_fbo) { - gl->GenFramebuffers(1, &fbo->fbo); - gl->BindFramebuffer(GL_FRAMEBUFFER, fbo->fbo); - gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, fbo->texture, 0); - - GLenum err = gl->CheckFramebufferStatus(GL_FRAMEBUFFER); - if (err != GL_FRAMEBUFFER_COMPLETE) { - mp_err(log, "Error: framebuffer completeness check failed (error=%d).\n", - (int)err); - res = false; - } - - gl->BindFramebuffer(GL_FRAMEBUFFER, 0); - gl_check_error(gl, log, "after creating framebuffer"); + gl->BindFramebuffer(GL_FRAMEBUFFER, fbo->fbo); + gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, fbo->texture, 0); + + GLenum err = gl->CheckFramebufferStatus(GL_FRAMEBUFFER); + if (err != GL_FRAMEBUFFER_COMPLETE) { + mp_err(log, "Error: framebuffer completeness check failed (error=%d).\n", + (int)err); + res = false; } + gl->BindFramebuffer(GL_FRAMEBUFFER, 0); + + gl_check_error(gl, log, "after creating framebuffer"); + return res; } diff --git a/video/out/opengl/utils.h b/video/out/opengl/utils.h index f2c405fa9a..d91907fe9f 100644 --- a/video/out/opengl/utils.h +++ b/video/out/opengl/utils.h @@ -66,7 +66,6 @@ bool fbotex_change(struct fbotex *fbo, GL *gl, struct mp_log *log, int w, int h, #define FBOTEX_FUZZY_W 1 #define FBOTEX_FUZZY_H 2 #define FBOTEX_FUZZY (FBOTEX_FUZZY_W | FBOTEX_FUZZY_H) -#define FBOTEX_COMPUTE 4 void fbotex_set_filter(struct fbotex *fbo, GLenum gl_filter); void fbotex_invalidate(struct fbotex *fbo); diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index d1edfa02fb..949c74b0fe 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -1263,13 +1263,9 @@ static void finish_pass_direct(struct gl_video *p, GLint fbo, int vp_w, int vp_h static void finish_pass_fbo(struct gl_video *p, struct fbotex *dst_fbo, int w, int h, int flags) { - bool use_compute = p->compute_w > 0 && p->compute_h > 0; - if (use_compute) - flags |= FBOTEX_COMPUTE; - fbotex_change(dst_fbo, p->gl, p->log, w, h, p->opts.fbo_format, flags); - if (use_compute) { + if (p->compute_w > 0 && p->compute_h > 0) { gl_sc_uniform_image2D(p->sc, "out_image", dst_fbo->texture, dst_fbo->iformat, GL_WRITE_ONLY); GLSL(imageStore(out_image, ivec2(gl_GlobalInvocationID), color);) |