diff options
author | Philip Langdale <philipl@cloudera.com> | 2019-06-13 12:30:18 -0700 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-07-08 00:59:28 +0200 |
commit | e2976e662d9215b5a466b108efc89e19fc718616 (patch) | |
tree | ad5b58e82af5477dfe640e775efad85f2b45de25 /video/out/gpu | |
parent | c379950ce08932dec839f18926183c7b05b57d00 (diff) | |
download | mpv-e2976e662d9215b5a466b108efc89e19fc718616.tar.bz2 mpv-e2976e662d9215b5a466b108efc89e19fc718616.tar.xz |
video/out/gpu: Add a `storable` flag to ra_format
While `ra` supports the concept of a texture as a storage
destination, it does not support the concept of a texture format
being usable for a storage texture. This can lead to us attempting
to create a texture from an incompatible format, with undefined
results.
So, let's introduce an explicit format flag for storage and use
it. In `ra_pl` we can simply reflect the `storable` flag. For
GL and D3D, we'll need to write some new code to do the compatibility
checks. I'm not going to do it here because it's not a regression;
we were already implicitly assuming all formats were storable.
Fixes #6657
Diffstat (limited to 'video/out/gpu')
-rw-r--r-- | video/out/gpu/ra.h | 1 | ||||
-rw-r--r-- | video/out/gpu/utils.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/video/out/gpu/ra.h b/video/out/gpu/ra.h index f35489e25d..58bf55357b 100644 --- a/video/out/gpu/ra.h +++ b/video/out/gpu/ra.h @@ -107,6 +107,7 @@ struct ra_format { // only applies to 2-component textures bool linear_filter; // linear filtering available from shader bool renderable; // can be used for render targets + bool storable; // can be used for storage images bool dummy_format; // is not a real ra_format but a fake one (e.g. FBO). // dummy formats cannot be used to create textures diff --git a/video/out/gpu/utils.c b/video/out/gpu/utils.c index 9234545a71..b59208776d 100644 --- a/video/out/gpu/utils.c +++ b/video/out/gpu/utils.c @@ -185,7 +185,7 @@ bool ra_tex_resize(struct ra *ra, struct mp_log *log, struct ra_tex **tex, mp_dbg(log, "Resizing texture: %dx%d\n", w, h); - if (!fmt || !fmt->renderable || !fmt->linear_filter) { + if (!fmt || !fmt->renderable || !fmt->linear_filter || !fmt->storable) { mp_err(log, "Format %s not supported.\n", fmt ? fmt->name : "(unset)"); return false; } |