From 7ec6f58bf7836641004ba5368cfa78df416f7e18 Mon Sep 17 00:00:00 2001 From: Niklas Haas <git@haasn.xyz> Date: Mon, 25 May 2020 12:03:33 +0200 Subject: [PATCH] Revert "shaders: make sh_subpass slightly stricter" This reverts commit 001271309c18c37babd6934fbd3875890d1a312d. This commit is a regression in performance since it breaks merging of chroma scalers. --- src/shaders.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/shaders.c b/src/shaders.c index 6a4137179..6ec5052c8 100644 --- a/src/shaders.c +++ b/src/shaders.c @@ -370,11 +370,13 @@ ident_t sh_subpass(struct pl_shader *sh, const struct pl_shader *sub) return NULL; } - int sub_w = PL_DEF(sub->output_w, sh->output_w), - sub_h = PL_DEF(sub->output_h, sh->output_h); - // Check for shader compatibility - if (sh->output_w != sub_w || sh->output_h != sub_h) { + int res_w = PL_DEF(sh->output_w, sub->output_w), + res_h = PL_DEF(sh->output_h, sub->output_h); + + if ((sub->output_w && res_w != sub->output_w) || + (sub->output_h && res_h != sub->output_h)) + { PL_TRACE(sh, "Can't merge shaders: incompatible sizes: %dx%d and %dx%d", sh->output_w, sh->output_h, sub->output_w, sub->output_h); return NULL; @@ -392,6 +394,9 @@ ident_t sh_subpass(struct pl_shader *sh, const struct pl_shader *sub) } } + sh->output_w = res_w; + sh->output_h = res_h; + // Append the prelude and header bstr_xappend(sh, &sh->buffers[SH_BUF_PRELUDE], sub->buffers[SH_BUF_PRELUDE]); bstr_xappend(sh, &sh->buffers[SH_BUF_HEADER], sub->buffers[SH_BUF_HEADER]); -- GitLab