vo_gpu: never pass flipped images to ra or ra backends

Seems like the last refactor to this code broke playing flipped images,
at least with --opengl-pbo --gpu-api=opengl.

Flipping is rather a shitmess. The main problem is that OpenGL does not
support flipped uploading. The original vo_gl implementation considered
it important to handle the flipped case efficiently, so instead of
uploading the image line by line backwards, it uploaded it flipped, and
then flipped it in the renderer (basically the upload path ignored the
flipping). The ra code and backends probably have an insane and
inconsistent mix of semantics, so fix this by never passing it flipped
images in the first place.

In the future, the backends should probably support flipped images
directly.

Fixes #5097.
This commit is contained in:
wm4 2017-11-10 10:06:33 +01:00
parent ed1af99727
commit 4a6b04bdb9
1 changed files with 7 additions and 2 deletions

View File

@ -3262,8 +3262,6 @@ static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t
for (int n = 0; n < p->plane_count; n++) {
struct texplane *plane = &vimg->planes[n];
plane->flipped = mpi->stride[0] < 0;
struct ra_tex_upload_params params = {
.tex = plane->tex,
.src = mpi->planes[n],
@ -3271,6 +3269,13 @@ static bool pass_upload_image(struct gl_video *p, struct mp_image *mpi, uint64_t
.stride = mpi->stride[n],
};
plane->flipped = params.stride < 0;
if (plane->flipped) {
int h = mp_image_plane_h(mpi, n);
params.src = (char *)params.src + (h - 1) * params.stride;
params.stride = -params.stride;
}
struct dr_buffer *mapped = gl_find_dr_buffer(p, mpi->planes[n]);
if (mapped) {
params.buf = mapped->buf;