mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-06 18:54:02 +00:00
[client] rework the configuration overlay to allow for tabs
This commit is contained in:
@@ -251,12 +251,6 @@ void egl_desktopConfigUI(EGL_Desktop * desktop)
|
||||
}
|
||||
igSliderInt("##nvgain", &desktop->nvGain, 0, desktop->nvMax, format, 0);
|
||||
igPopItemWidth();
|
||||
|
||||
if (egl_postProcessImgui(desktop->pp))
|
||||
{
|
||||
atomic_store(&desktop->processFrame, true);
|
||||
app_invalidateWindow(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format)
|
||||
@@ -366,7 +360,8 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
|
||||
|
||||
int scaleAlgo = EGL_SCALE_NEAREST;
|
||||
|
||||
if (atomic_exchange(&desktop->processFrame, false))
|
||||
if (atomic_exchange(&desktop->processFrame, false) ||
|
||||
egl_postProcessConfigModified(desktop->pp))
|
||||
egl_postProcessRun(desktop->pp, desktop->texture, outputWidth, outputHeight);
|
||||
|
||||
unsigned int finalSizeX, finalSizeY;
|
||||
|
@@ -626,7 +626,7 @@ static void debugCallback(GLenum source, GLenum type, GLuint id,
|
||||
DEBUG_PRINT(level, "GL message (source: %s, type: %s): %s", sourceName, typeName, message);
|
||||
}
|
||||
|
||||
static void egl_config_ui(void * opaque)
|
||||
static void egl_configUI(void * opaque, int * id)
|
||||
{
|
||||
struct Inst * this = opaque;
|
||||
egl_damageConfigUI(this->damage);
|
||||
@@ -822,7 +822,7 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA)
|
||||
return false;
|
||||
}
|
||||
|
||||
app_overlayConfigRegister("EGL", egl_config_ui, this);
|
||||
app_overlayConfigRegister("EGL", egl_configUI, this);
|
||||
|
||||
this->imgui = true;
|
||||
return true;
|
||||
|
@@ -164,7 +164,7 @@ static bool egl_filterFFXCASImguiConfig(EGL_Filter * filter)
|
||||
bool cas = this->enable;
|
||||
float casSharpness = this->sharpness;
|
||||
|
||||
igCheckbox("AMD FidelityFX CAS", &cas);
|
||||
igCheckbox("Enabled", &cas);
|
||||
if (cas != this->enable)
|
||||
{
|
||||
this->enable = cas;
|
||||
|
@@ -203,7 +203,7 @@ static bool egl_filterFFXFSR1ImguiConfig(EGL_Filter * filter)
|
||||
bool enable = this->enable;
|
||||
float sharpness = this->sharpness;
|
||||
|
||||
igCheckbox("AMD FidelityFX FSR", &enable);
|
||||
igCheckbox("Enabled", &enable);
|
||||
if (enable != this->enable)
|
||||
{
|
||||
this->enable = enable;
|
||||
|
@@ -20,6 +20,10 @@
|
||||
|
||||
#include "postprocess.h"
|
||||
#include "filters.h"
|
||||
#include "app.h"
|
||||
#include "cimgui.h"
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/array.h"
|
||||
@@ -37,6 +41,7 @@ struct EGL_PostProcess
|
||||
struct ll * filters;
|
||||
GLuint output;
|
||||
unsigned int outputX, outputY;
|
||||
_Atomic(bool) modified;
|
||||
|
||||
EGL_Model * model;
|
||||
};
|
||||
@@ -47,6 +52,27 @@ void egl_postProcessEarlyInit(void)
|
||||
EGL_Filters[i]->earlyInit();
|
||||
}
|
||||
|
||||
static void configUI(void * opaque, int * id)
|
||||
{
|
||||
struct EGL_PostProcess * this = opaque;
|
||||
|
||||
bool redraw = false;
|
||||
EGL_Filter * filter;
|
||||
for(ll_reset(this->filters); ll_walk(this->filters, (void **)&filter); )
|
||||
{
|
||||
igPushIDInt(++*id);
|
||||
if (igCollapsingHeaderBoolPtr(filter->ops.name, NULL, 0))
|
||||
redraw |= egl_filterImguiConfig(filter);
|
||||
igPopID();
|
||||
}
|
||||
|
||||
if (redraw)
|
||||
{
|
||||
atomic_store(&this->modified, true);
|
||||
app_invalidateWindow(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool egl_postProcessInit(EGL_PostProcess ** pp)
|
||||
{
|
||||
EGL_PostProcess * this = calloc(1, sizeof(*this));
|
||||
@@ -70,6 +96,8 @@ bool egl_postProcessInit(EGL_PostProcess ** pp)
|
||||
}
|
||||
egl_modelSetDefault(this->model, false);
|
||||
|
||||
app_overlayConfigRegisterTab("EGL Filters", configUI, this);
|
||||
|
||||
*pp = this;
|
||||
return true;
|
||||
|
||||
@@ -111,14 +139,9 @@ bool egl_postProcessAdd(EGL_PostProcess * this, const EGL_FilterOps * ops)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool egl_postProcessImgui(EGL_PostProcess * this)
|
||||
bool egl_postProcessConfigModified(EGL_PostProcess * this)
|
||||
{
|
||||
bool redraw = false;
|
||||
EGL_Filter * filter;
|
||||
for(ll_reset(this->filters); ll_walk(this->filters, (void **)&filter); )
|
||||
redraw |= egl_filterImguiConfig(filter);
|
||||
|
||||
return redraw;
|
||||
return atomic_load(&this->modified);
|
||||
}
|
||||
|
||||
bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
|
||||
@@ -131,6 +154,7 @@ bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
|
||||
if (egl_textureGet(tex, &texture, &sizeX, &sizeY) != EGL_TEX_STATUS_OK)
|
||||
return false;
|
||||
|
||||
atomic_store(&this->modified, false);
|
||||
for(ll_reset(this->filters); ll_walk(this->filters, (void **)&filter); )
|
||||
{
|
||||
egl_filterSetOutputResHint(filter, targetX, targetY);
|
||||
|
@@ -33,9 +33,8 @@ void egl_postProcessFree(EGL_PostProcess ** pp);
|
||||
/* create and add a filter to this processor */
|
||||
bool egl_postProcessAdd(EGL_PostProcess * this, const EGL_FilterOps * ops);
|
||||
|
||||
/* render the imgui options
|
||||
* returns true if the filter needs to be re-run */
|
||||
bool egl_postProcessImgui(EGL_PostProcess * this);
|
||||
/* returns true if the configuration was modified since the last run */
|
||||
bool egl_postProcessConfigModified(EGL_PostProcess * this);
|
||||
|
||||
/* apply the filters to the supplied texture
|
||||
* targetX/Y is the final target output dimension hint if scalers are present */
|
||||
|
Reference in New Issue
Block a user