summaryrefslogtreecommitdiffstats
path: root/video/out/gpu
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2020-03-08 21:10:09 +0100
committerNiklas Haas <git@haasn.xyz>2020-03-08 21:41:16 +0100
commitc05e5d9d78af0c36bc8f54fe00ccf9248d69260a (patch)
tree4bb1cd6409310f843372ac424a71a856f2461267 /video/out/gpu
parentc145c8008580629bd12a009678be16759f125e04 (diff)
downloadmpv-c05e5d9d78af0c36bc8f54fe00ccf9248d69260a.tar.bz2
mpv-c05e5d9d78af0c36bc8f54fe00ccf9248d69260a.tar.xz
vo_gpu: generally allow non-storable FBOs
We have this cap now thanks to e2976e662, but we don't actually make sure our FBOs are storable before we blindly attempt using them with compute shaders. There's no more need to unconditionally set `storage_dst = true` as long as we make sure to include an extra condition on the `fbo_format` selection to prevent users from accidentally enabling compute-shader-only features with non-storable FBOs, alongside some other miscellaneous adjustments to eliminate instances of "assumed storability" from vo_gpu.
Diffstat (limited to 'video/out/gpu')
-rw-r--r--video/out/gpu/utils.c4
-rw-r--r--video/out/gpu/video.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/video/out/gpu/utils.c b/video/out/gpu/utils.c
index b59208776d..2c625dc26a 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 || !fmt->storable) {
+ if (!fmt || !fmt->renderable || !fmt->linear_filter) {
mp_err(log, "Format %s not supported.\n", fmt ? fmt->name : "(unset)");
return false;
}
@@ -200,7 +200,7 @@ bool ra_tex_resize(struct ra *ra, struct mp_log *log, struct ra_tex **tex,
.src_linear = true,
.render_src = true,
.render_dst = true,
- .storage_dst = true,
+ .storage_dst = fmt->storable,
.blit_src = true,
};
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 13b7d55877..3c06751959 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -1290,8 +1290,11 @@ static void finish_pass_tex(struct gl_video *p, struct ra_tex **dst_tex,
// If RA_CAP_PARALLEL_COMPUTE is set, try to prefer compute shaders
// over fragment shaders wherever possible.
- if (!p->pass_compute.active && (p->ra->caps & RA_CAP_PARALLEL_COMPUTE))
+ if (!p->pass_compute.active && (p->ra->caps & RA_CAP_PARALLEL_COMPUTE) &&
+ (*dst_tex)->params.storage_dst)
+ {
pass_is_compute(p, 16, 16, true);
+ }
if (p->pass_compute.active) {
gl_sc_uniform_image2D_wo(p->sc, "out_image", *dst_tex);
@@ -3709,6 +3712,12 @@ static void check_gl_features(struct gl_video *p)
"available! See your FBO format configuration!\n");
}
+ if (have_compute && have_fbo && !p->fbo_format->storable) {
+ have_compute = false;
+ MP_WARN(p, "Force-disabling compute shaders as the chosen FBO format "
+ "is not storable! See your FBO format configuration!\n");
+ }
+
if (!have_compute && p->opts.dither_algo == DITHER_ERROR_DIFFUSION) {
MP_WARN(p, "Disabling error diffusion dithering because compute shader "
"was not supported. Fallback to dither=fruit instead.\n");