From 7247fadad8be36d256d7c45b3c7427a5cfd4d53b Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 25 Jan 2024 17:51:06 +1100 Subject: [PATCH] [client] egl: fix post processing failure when converting pixel formats --- client/renderers/EGL/filter.h | 8 ++++---- client/renderers/EGL/filter_24bit.c | 3 ++- client/renderers/EGL/filter_downscale.c | 3 ++- client/renderers/EGL/filter_ffx_cas.c | 3 ++- client/renderers/EGL/filter_ffx_fsr1.c | 3 ++- client/renderers/EGL/postprocess.c | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/client/renderers/EGL/filter.h b/client/renderers/EGL/filter.h index f46edb47b..963f79538 100644 --- a/client/renderers/EGL/filter.h +++ b/client/renderers/EGL/filter.h @@ -80,9 +80,9 @@ typedef struct EGL_FilterOps void (*setOutputResHint)(EGL_Filter * filter, unsigned int x, unsigned int y); - /* returns the output resolution of the filter */ + /* returns the output resolution and pixel format of the filter */ void (*getOutputRes)(EGL_Filter * filter, - unsigned int *x, unsigned int *y); + unsigned int *x, unsigned int *y, enum EGL_PixelFormat *pixFmt); /* prepare the shader for use * A filter can return false to bypass it */ @@ -162,9 +162,9 @@ static inline void egl_filterSetOutputResHint(EGL_Filter * filter, } static inline void egl_filterGetOutputRes(EGL_Filter * filter, - unsigned int *x, unsigned int *y) + unsigned int *x, unsigned int *y, enum EGL_PixelFormat *pixFmt) { - return filter->ops.getOutputRes(filter, x, y); + return filter->ops.getOutputRes(filter, x, y, pixFmt); } static inline bool egl_filterPrepare(EGL_Filter * filter) diff --git a/client/renderers/EGL/filter_24bit.c b/client/renderers/EGL/filter_24bit.c index 4d14d46f7..15250308c 100644 --- a/client/renderers/EGL/filter_24bit.c +++ b/client/renderers/EGL/filter_24bit.c @@ -162,11 +162,12 @@ static bool egl_filter24bitSetup(EGL_Filter * filter, } static void egl_filter24bitGetOutputRes(EGL_Filter * filter, - unsigned int *width, unsigned int *height) + unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt) { EGL_Filter24bit * this = UPCAST(EGL_Filter24bit, filter); *width = this->desktopWidth; *height = this->desktopHeight; + *pixFmt = EGL_PF_BGRA; } static bool egl_filter24bitPrepare(EGL_Filter * filter) diff --git a/client/renderers/EGL/filter_downscale.c b/client/renderers/EGL/filter_downscale.c index 57f68b145..e0aa30fec 100644 --- a/client/renderers/EGL/filter_downscale.c +++ b/client/renderers/EGL/filter_downscale.c @@ -370,11 +370,12 @@ static bool egl_filterDownscaleSetup(EGL_Filter * filter, } static void egl_filterDownscaleGetOutputRes(EGL_Filter * filter, - unsigned int *width, unsigned int *height) + unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt) { EGL_FilterDownscale * this = UPCAST(EGL_FilterDownscale, filter); *width = this->width; *height = this->height; + *pixFmt = this->pixFmt; } static bool egl_filterDownscalePrepare(EGL_Filter * filter) diff --git a/client/renderers/EGL/filter_ffx_cas.c b/client/renderers/EGL/filter_ffx_cas.c index 86580aef7..215704972 100644 --- a/client/renderers/EGL/filter_ffx_cas.c +++ b/client/renderers/EGL/filter_ffx_cas.c @@ -254,11 +254,12 @@ static bool egl_filterFFXCASSetup(EGL_Filter * filter, } static void egl_filterFFXCASGetOutputRes(EGL_Filter * filter, - unsigned int *width, unsigned int *height) + unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt) { EGL_FilterFFXCAS * this = UPCAST(EGL_FilterFFXCAS, filter); *width = this->width; *height = this->height; + *pixFmt = this->pixFmt; } static bool egl_filterFFXCASPrepare(EGL_Filter * filter) diff --git a/client/renderers/EGL/filter_ffx_fsr1.c b/client/renderers/EGL/filter_ffx_fsr1.c index 8f0758ca0..b4f4a7633 100644 --- a/client/renderers/EGL/filter_ffx_fsr1.c +++ b/client/renderers/EGL/filter_ffx_fsr1.c @@ -383,11 +383,12 @@ static bool egl_filterFFXFSR1Setup(EGL_Filter * filter, } static void egl_filterFFXFSR1GetOutputRes(EGL_Filter * filter, - unsigned int *width, unsigned int *height) + unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt) { EGL_FilterFFXFSR1 * this = UPCAST(EGL_FilterFFXFSR1, filter); *width = this->width; *height = this->height; + *pixFmt = this->pixFmt; } static bool egl_filterFFXFSR1Prepare(EGL_Filter * filter) diff --git a/client/renderers/EGL/postprocess.c b/client/renderers/EGL/postprocess.c index 29074b0a2..1c4185194 100644 --- a/client/renderers/EGL/postprocess.c +++ b/client/renderers/EGL/postprocess.c @@ -685,7 +685,7 @@ bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex, continue; texture = egl_filterRun(filter, &filterRects, texture); - egl_filterGetOutputRes(filter, &sizeX, &sizeY); + egl_filterGetOutputRes(filter, &sizeX, &sizeY, &pixFmt); if (lastFilter) egl_filterRelease(lastFilter);