Skip to content

Commit

Permalink
[client] egl: fix post processing failure when converting pixel formats
Browse files Browse the repository at this point in the history
  • Loading branch information
gnif committed Jan 25, 2024
1 parent c2237f2 commit 7247fad
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions client/renderers/EGL/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion client/renderers/EGL/filter_24bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion client/renderers/EGL/filter_downscale.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion client/renderers/EGL/filter_ffx_cas.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion client/renderers/EGL/filter_ffx_fsr1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion client/renderers/EGL/postprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7247fad

Please sign in to comment.