summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/gl_video.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 610a8fdb25..cf9703de3c 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -641,7 +641,6 @@ static void pass_load_fbotex(struct gl_video *p, struct fbotex *src_fbo, int id,
static void pass_set_image_textures(struct gl_video *p, struct video_image *vimg,
struct gl_transform *chroma)
{
- GLuint imgtex[4] = {0};
*chroma = (struct gl_transform){{{0}}};
assert(vimg->mpi);
@@ -669,20 +668,10 @@ static void pass_set_image_textures(struct gl_video *p, struct video_image *vimg
chroma->m[1][1] = ls_h * (float)vimg->planes[0].tex_h
/ vimg->planes[1].tex_h;
- if (p->hwdec_active) {
- if (p->hwdec->driver->map_image(p->hwdec, vimg->mpi, imgtex) < 0) {
- for (int n = 0; n < p->plane_count; n++)
- imgtex[n] = -1;
- }
- } else {
- for (int n = 0; n < p->plane_count; n++)
- imgtex[n] = vimg->planes[n].gl_texture;
- }
-
for (int n = 0; n < p->plane_count; n++) {
struct texplane *t = &vimg->planes[n];
p->pass_tex[n] = (struct src_tex){
- .gl_tex = imgtex[n],
+ .gl_tex = vimg->planes[n].gl_texture,
.gl_target = t->gl_target,
.tex_w = t->tex_w,
.tex_h = t->tex_h,
@@ -772,7 +761,8 @@ static void uninit_video(struct gl_video *p)
for (int n = 0; n < p->plane_count; n++) {
struct texplane *plane = &vimg->planes[n];
- gl->DeleteTextures(1, &plane->gl_texture);
+ if (!p->hwdec_active)
+ gl->DeleteTextures(1, &plane->gl_texture);
plane->gl_texture = 0;
gl->DeleteBuffers(1, &plane->gl_buffer);
plane->gl_buffer = 0;
@@ -2343,8 +2333,13 @@ static void gl_video_upload_image(struct gl_video *p, struct mp_image *mpi)
p->osd_pts = mpi->pts;
p->frames_uploaded++;
- if (p->hwdec_active)
+ if (p->hwdec_active) {
+ GLuint imgtex[4] = {0};
+ bool ok = p->hwdec->driver->map_image(p->hwdec, vimg->mpi, imgtex) >= 0;
+ for (int n = 0; n < p->plane_count; n++)
+ vimg->planes[n].gl_texture = ok ? imgtex[n] : -1;
return;
+ }
assert(mpi->num_planes == p->plane_count);