summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-10-27 16:54:27 +0200
committerNiklas Haas <git@haasn.xyz>2017-10-27 16:56:23 +0200
commit4701c5ba4f87ca35f66d574e89eba8c7d4514783 (patch)
tree2cfd4577626328e95d71c0cac585ceb61096fdb9
parentd6f33e0b0da8004bc89469bbd43ac21b00de83de (diff)
downloadmpv-4701c5ba4f87ca35f66d574e89eba8c7d4514783.tar.bz2
mpv-4701c5ba4f87ca35f66d574e89eba8c7d4514783.tar.xz
vo_gpu: fix ra_tex_upload_pbo for 2D textures
params->rc was ignored in the calculation for the buffer size. I fucking hate this stupid ra_tex_upload signature where *rc is randomly relevant or not.
-rw-r--r--video/out/gpu/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/out/gpu/utils.c b/video/out/gpu/utils.c
index daf570cba5..6a2abae1b2 100644
--- a/video/out/gpu/utils.c
+++ b/video/out/gpu/utils.c
@@ -106,9 +106,13 @@ bool ra_tex_upload_pbo(struct ra *ra, struct ra_buf_pool *pbo,
size_t row_size = tex->params.dimensions == 2 ? params->stride :
tex->params.w * tex->params.format->pixel_size;
+ int height = tex->params.h;
+ if (tex->params.dimensions == 2 && params->rc)
+ height = mp_rect_h(*params->rc);
+
struct ra_buf_params bufparams = {
.type = RA_BUF_TYPE_TEX_UPLOAD,
- .size = row_size * tex->params.h * tex->params.d,
+ .size = row_size * height * tex->params.d,
.host_mutable = true,
};