diff options
author | Dudemanguy <random342@airmail.cc> | 2023-02-28 22:54:14 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-03-02 02:08:39 +0000 |
commit | cd02b5ccf6426645796b18c0692a5c4ca1f83174 (patch) | |
tree | 56b8649e4a7d2dc163780b557425f68782c9fd05 /video | |
parent | 779d4f99a74cce2089f0bf7dc5ed10c7a7ff00a3 (diff) | |
download | mpv-cd02b5ccf6426645796b18c0692a5c4ca1f83174.tar.bz2 mpv-cd02b5ccf6426645796b18c0692a5c4ca1f83174.tar.xz |
ra: assert when using params with dimensions
This came up in #9828. According to the header comments, creating a 1D
ra_tex requires height and depth to be set to 1. For a 2D texture, it
requires depth be set to 1. There were a couple of spots in mpv's code
where this wasn't being followed. Although there was no known bug from
this, the rest of the code works like this so it was a good idea to go
ahead and sync it up. As a followup, let's just add some simple asserts
to ra.c to enforce this so it doesn't go unnoticed in the future.
Diffstat (limited to 'video')
-rw-r--r-- | video/out/gpu/ra.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/video/out/gpu/ra.c b/video/out/gpu/ra.c index 2874cf1ad2..855f9b6bb2 100644 --- a/video/out/gpu/ra.c +++ b/video/out/gpu/ra.c @@ -26,6 +26,16 @@ void *ra_get_native_resource(struct ra *ra, const char *name) struct ra_tex *ra_tex_create(struct ra *ra, const struct ra_tex_params *params) { + switch (params->dimensions) { + case 1: + assert(params->h == 1 && params->d == 1); + break; + case 2: + assert(params->d == 1); + break; + default: + assert(params->dimensions >= 1 && params->dimensions <= 3); + } return ra->fns->tex_create(ra, params); } |