mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[client] egl: add loadState and saveState for filters
This commit is contained in:
parent
4adb425337
commit
084837b936
@ -50,6 +50,12 @@ typedef struct EGL_FilterOps
|
||||
* Returns true if a redraw is required */
|
||||
bool (*imguiConfig)(EGL_Filter * filter);
|
||||
|
||||
/* writes filter state to options */
|
||||
void (*saveState)(EGL_Filter * filter);
|
||||
|
||||
/* reads filter state from options */
|
||||
void (*loadState)(EGL_Filter * filter);
|
||||
|
||||
/* set the input format of the filter */
|
||||
bool (*setup)(EGL_Filter * filter, enum EGL_PixelFormat pixFmt,
|
||||
unsigned int width, unsigned int height);
|
||||
@ -103,6 +109,16 @@ static inline bool egl_filterImguiConfig(EGL_Filter * filter)
|
||||
return filter->ops.imguiConfig(filter);
|
||||
}
|
||||
|
||||
static inline void egl_filterSaveState(EGL_Filter * filter)
|
||||
{
|
||||
filter->ops.saveState(filter);
|
||||
}
|
||||
|
||||
static inline void egl_filterLoadState(EGL_Filter * filter)
|
||||
{
|
||||
filter->ops.loadState(filter);
|
||||
}
|
||||
|
||||
static inline bool egl_filterSetup(EGL_Filter * filter,
|
||||
enum EGL_PixelFormat pixFmt, unsigned int width, unsigned int height)
|
||||
{
|
||||
|
@ -83,6 +83,16 @@ static void egl_filterDownscaleEarlyInit(void)
|
||||
option_register(options);
|
||||
}
|
||||
|
||||
static void egl_filterDownscaleSaveState(EGL_Filter * filter)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
static void egl_filterDownscaleLoadState(EGL_Filter * filter)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
static bool egl_filterDownscaleInit(EGL_Filter ** filter)
|
||||
{
|
||||
EGL_FilterDownscale * this = calloc(1, sizeof(*this));
|
||||
@ -364,6 +374,8 @@ EGL_FilterOps egl_filterDownscaleOps =
|
||||
.init = egl_filterDownscaleInit,
|
||||
.free = egl_filterDownscaleFree,
|
||||
.imguiConfig = egl_filterDownscaleImguiConfig,
|
||||
.saveState = egl_filterDownscaleSaveState,
|
||||
.loadState = egl_filterDownscaleLoadState,
|
||||
.setup = egl_filterDownscaleSetup,
|
||||
.getOutputRes = egl_filterDownscaleGetOutputRes,
|
||||
.prepare = egl_filterDownscalePrepare,
|
||||
|
@ -79,6 +79,22 @@ static void casUpdateConsts(EGL_FilterFFXCAS * this)
|
||||
this->width, this->height);
|
||||
}
|
||||
|
||||
static void egl_filterFFXCASSaveState(EGL_Filter * filter)
|
||||
{
|
||||
EGL_FilterFFXCAS * this = UPCAST(EGL_FilterFFXCAS, filter);
|
||||
|
||||
option_set_bool ("eglFilter", "ffxCAS", this->enable);
|
||||
option_set_float("eglFilter", "ffxCASSharpness", this->sharpness);
|
||||
}
|
||||
|
||||
static void egl_filterFFXCASLoadState(EGL_Filter * filter)
|
||||
{
|
||||
EGL_FilterFFXCAS * this = UPCAST(EGL_FilterFFXCAS, filter);
|
||||
|
||||
this->enable = option_get_bool ("eglFilter", "ffxCAS");
|
||||
this->sharpness = option_get_float("eglFilter", "ffxCASSharpness");
|
||||
}
|
||||
|
||||
static bool egl_filterFFXCASInit(EGL_Filter ** filter)
|
||||
{
|
||||
EGL_FilterFFXCAS * this = calloc(1, sizeof(*this));
|
||||
@ -116,8 +132,7 @@ static bool egl_filterFFXCASInit(EGL_Filter ** filter)
|
||||
.v = this->consts,
|
||||
}, 1);
|
||||
|
||||
this->enable = option_get_bool("eglFilter", "ffxCAS");
|
||||
this->sharpness = option_get_float("eglFilter", "ffxCASSharpness");
|
||||
egl_filterFFXCASLoadState(&this->base);
|
||||
|
||||
if (!egl_framebufferInit(&this->fb))
|
||||
{
|
||||
@ -270,6 +285,8 @@ EGL_FilterOps egl_filterFFXCASOps =
|
||||
.init = egl_filterFFXCASInit,
|
||||
.free = egl_filterFFXCASFree,
|
||||
.imguiConfig = egl_filterFFXCASImguiConfig,
|
||||
.saveState = egl_filterFFXCASSaveState,
|
||||
.loadState = egl_filterFFXCASLoadState,
|
||||
.setup = egl_filterFFXCASSetup,
|
||||
.getOutputRes = egl_filterFFXCASGetOutputRes,
|
||||
.prepare = egl_filterFFXCASPrepare,
|
||||
|
@ -82,6 +82,22 @@ static void rcasUpdateUniform(EGL_FilterFFXFSR1 * this)
|
||||
ffxFsrRcasConst(this->rcasUniform.ui, 2.0f - this->sharpness * 2.0f);
|
||||
}
|
||||
|
||||
static void egl_filterFFXFSR1SaveState(EGL_Filter * filter)
|
||||
{
|
||||
EGL_FilterFFXFSR1 * this = UPCAST(EGL_FilterFFXFSR1, filter);
|
||||
|
||||
option_set_bool ("eglFilter", "ffxFSR", this->enable);
|
||||
option_set_float("eglFilter", "ffxFSRSharpness", this->sharpness);
|
||||
}
|
||||
|
||||
static void egl_filterFFXFSR1LoadState(EGL_Filter * filter)
|
||||
{
|
||||
EGL_FilterFFXFSR1 * this = UPCAST(EGL_FilterFFXFSR1, filter);
|
||||
|
||||
this->enable = option_get_bool ("eglFilter", "ffxFSR");
|
||||
this->sharpness = option_get_float("eglFilter", "ffxFSRSharpness");
|
||||
}
|
||||
|
||||
static bool egl_filterFFXFSR1Init(EGL_Filter ** filter)
|
||||
{
|
||||
EGL_FilterFFXFSR1 * this = calloc(1, sizeof(*this));
|
||||
@ -128,8 +144,7 @@ static bool egl_filterFFXFSR1Init(EGL_Filter ** filter)
|
||||
goto error_rcas;
|
||||
}
|
||||
|
||||
|
||||
this->enable = option_get_bool("eglFilter", "ffxFSR");
|
||||
egl_filterFFXFSR1LoadState(&this->base);
|
||||
|
||||
this->easuUniform[0].type = EGL_UNIFORM_TYPE_4UIV;
|
||||
this->easuUniform[0].location =
|
||||
@ -141,7 +156,6 @@ static bool egl_filterFFXFSR1Init(EGL_Filter ** filter)
|
||||
|
||||
this->rcasUniform.type = EGL_UNIFORM_TYPE_4UI;
|
||||
this->rcasUniform.location = egl_shaderGetUniform(this->rcas, "uConsts");
|
||||
this->sharpness = option_get_float("eglFilter", "ffxFSRSharpness");
|
||||
rcasUpdateUniform(this);
|
||||
|
||||
if (!egl_framebufferInit(&this->easuFb))
|
||||
@ -406,6 +420,8 @@ EGL_FilterOps egl_filterFFXFSR1Ops =
|
||||
.init = egl_filterFFXFSR1Init,
|
||||
.free = egl_filterFFXFSR1Free,
|
||||
.imguiConfig = egl_filterFFXFSR1ImguiConfig,
|
||||
.saveState = egl_filterFFXFSR1SaveState,
|
||||
.loadState = egl_filterFFXFSR1LoadState,
|
||||
.setup = egl_filterFFXFSR1Setup,
|
||||
.setOutputResHint = egl_filterFFXFSR1SetOutputResHint,
|
||||
.getOutputRes = egl_filterFFXFSR1GetOutputRes,
|
||||
|
Loading…
Reference in New Issue
Block a user