[client] egl/filters: bypass setup/prepare logic if disabled/inactive

filters are now not run if `egl_filterSetup` returns false, as such we
do not need additional `enable` checks in `prepare` or `run` and we can
bypass the filters even earlier if they are not enabled reducing load.
This commit is contained in:
Geoffrey McRae 2021-10-20 10:57:53 +11:00
parent fc037ccc95
commit 70a751b58d
3 changed files with 12 additions and 8 deletions

View File

@ -365,9 +365,6 @@ static bool egl_filterDownscalePrepare(EGL_Filter * filter)
{
EGL_FilterDownscale * this = UPCAST(EGL_FilterDownscale, filter);
if (!this->enable)
return false;
if (this->prepared)
return true;

View File

@ -224,6 +224,9 @@ static bool egl_filterFFXCASSetup(EGL_Filter * filter,
{
EGL_FilterFFXCAS * this = UPCAST(EGL_FilterFFXCAS, filter);
if (!this->enable)
return false;
if (pixFmt == this->pixFmt && this->width == width && this->height == height)
return true;
@ -251,9 +254,6 @@ static bool egl_filterFFXCASPrepare(EGL_Filter * filter)
{
EGL_FilterFFXCAS * this = UPCAST(EGL_FilterFFXCAS, filter);
if (!this->enable)
return false;
if (this->prepared)
return true;

View File

@ -339,6 +339,13 @@ static bool egl_filterFFXFSR1Setup(EGL_Filter * filter,
{
EGL_FilterFFXFSR1 * this = UPCAST(EGL_FilterFFXFSR1, filter);
if (!this->enable)
return false;
this->active = this->width > width && this->height > height;
if (!this->active)
return false;
if (pixFmt == this->pixFmt && !this->sizeChanged &&
width == this->inWidth && height == this->inHeight)
return true;
@ -351,7 +358,6 @@ static bool egl_filterFFXFSR1Setup(EGL_Filter * filter,
this->inWidth = width;
this->inHeight = height;
this->active = this->width > width && this->height > height;
this->sizeChanged = false;
this->pixFmt = pixFmt;
this->prepared = false;
@ -360,6 +366,7 @@ static bool egl_filterFFXFSR1Setup(EGL_Filter * filter,
this->easuUniform[1].f[1] = this->height;
ffxFsrEasuConst((uint32_t *)this->consts->data, this->inWidth, this->inHeight,
this->inWidth, this->inHeight, this->width, this->height);
return true;
}
@ -375,7 +382,7 @@ static bool egl_filterFFXFSR1Prepare(EGL_Filter * filter)
{
EGL_FilterFFXFSR1 * this = UPCAST(EGL_FilterFFXFSR1, filter);
if (!this->enable || !this->active)
if (!this->active)
return false;
if (this->prepared)