mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
c145c80085
commit
c05e5d9d78
|
@ -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);
|
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)");
|
mp_err(log, "Format %s not supported.\n", fmt ? fmt->name : "(unset)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ bool ra_tex_resize(struct ra *ra, struct mp_log *log, struct ra_tex **tex,
|
||||||
.src_linear = true,
|
.src_linear = true,
|
||||||
.render_src = true,
|
.render_src = true,
|
||||||
.render_dst = true,
|
.render_dst = true,
|
||||||
.storage_dst = true,
|
.storage_dst = fmt->storable,
|
||||||
.blit_src = true,
|
.blit_src = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
// If RA_CAP_PARALLEL_COMPUTE is set, try to prefer compute shaders
|
||||||
// over fragment shaders wherever possible.
|
// 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);
|
pass_is_compute(p, 16, 16, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (p->pass_compute.active) {
|
if (p->pass_compute.active) {
|
||||||
gl_sc_uniform_image2D_wo(p->sc, "out_image", *dst_tex);
|
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");
|
"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) {
|
if (!have_compute && p->opts.dither_algo == DITHER_ERROR_DIFFUSION) {
|
||||||
MP_WARN(p, "Disabling error diffusion dithering because compute shader "
|
MP_WARN(p, "Disabling error diffusion dithering because compute shader "
|
||||||
"was not supported. Fallback to dither=fruit instead.\n");
|
"was not supported. Fallback to dither=fruit instead.\n");
|
||||||
|
|
Loading…
Reference in New Issue