From a9f84483a164c4090149ee610d35be0746808888 Mon Sep 17 00:00:00 2001
From: Niklas Haas <git@haasn.dev>
Date: Tue, 12 Sep 2023 13:27:46 +0200
Subject: [PATCH] renderer: allow non-complex scalers without FBOs

This is not quite a proper resolution to the linked issue, because we
still forcibly skip the main scaling pass without FBOs. But it allows
using fast bicubic (or oversample) for the chroma plane, which is an
improvement.

See-Also: https://code.videolan.org/videolan/libplacebo/-/issues/173
---
 src/renderer.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/renderer.c b/src/renderer.c
index 897857d04..34cd2ea53 100644
--- a/src/renderer.c
+++ b/src/renderer.c
@@ -628,9 +628,7 @@ static struct sampler_info sample_src_info(struct pass_state *pass,
         return info;
     }
 
-    if (!pass->fbofmt[4] || (rr->errors & PL_RENDER_ERR_SAMPLING) ||
-        !info.config)
-    {
+    if ((rr->errors & PL_RENDER_ERR_SAMPLING) || !info.config) {
         info.type = SAMPLER_DIRECT;
     } else if (info.config->kernel == &pl_filter_function_oversample) {
         info.type = SAMPLER_OVERSAMPLE;
@@ -652,6 +650,10 @@ static struct sampler_info sample_src_info(struct pass_state *pass,
         }
     }
 
+    // Disable advanced scaling without FBOs
+    if (!pass->fbofmt[4] && info.type == SAMPLER_COMPLEX)
+        info.type = SAMPLER_DIRECT;
+
     return info;
 }
 
-- 
GitLab