mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] egl: switch postprocessing filters to use vectors
This will allow them to be reordered much more easily.
This commit is contained in:
parent
24e0343156
commit
99761b195f
@ -27,8 +27,7 @@
|
|||||||
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/array.h"
|
#include "common/array.h"
|
||||||
|
#include "common/vector.h"
|
||||||
#include "ll.h"
|
|
||||||
|
|
||||||
static const EGL_FilterOps * EGL_Filters[] =
|
static const EGL_FilterOps * EGL_Filters[] =
|
||||||
{
|
{
|
||||||
@ -39,7 +38,7 @@ static const EGL_FilterOps * EGL_Filters[] =
|
|||||||
|
|
||||||
struct EGL_PostProcess
|
struct EGL_PostProcess
|
||||||
{
|
{
|
||||||
struct ll * filters;
|
Vector * filters;
|
||||||
GLuint output;
|
GLuint output;
|
||||||
unsigned int outputX, outputY;
|
unsigned int outputX, outputY;
|
||||||
_Atomic(bool) modified;
|
_Atomic(bool) modified;
|
||||||
@ -58,8 +57,9 @@ static void configUI(void * opaque, int * id)
|
|||||||
struct EGL_PostProcess * this = opaque;
|
struct EGL_PostProcess * this = opaque;
|
||||||
|
|
||||||
bool redraw = false;
|
bool redraw = false;
|
||||||
|
|
||||||
EGL_Filter * filter;
|
EGL_Filter * filter;
|
||||||
for(ll_reset(this->filters); ll_walk(this->filters, (void **)&filter); )
|
vector_forEach(filter, this->filters)
|
||||||
{
|
{
|
||||||
igPushIDInt(++*id);
|
igPushIDInt(++*id);
|
||||||
if (igCollapsingHeaderBoolPtr(filter->ops.name, NULL, 0))
|
if (igCollapsingHeaderBoolPtr(filter->ops.name, NULL, 0))
|
||||||
@ -83,7 +83,7 @@ bool egl_postProcessInit(EGL_PostProcess ** pp)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->filters = ll_new(sizeof(EGL_Filter *));
|
this->filters = vector_create(sizeof(EGL_Filter *), ARRAY_LENGTH(EGL_Filters));
|
||||||
if (!this->filters)
|
if (!this->filters)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to allocate the filter list");
|
DEBUG_ERROR("Failed to allocate the filter list");
|
||||||
@ -103,7 +103,7 @@ bool egl_postProcessInit(EGL_PostProcess ** pp)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
error_filters:
|
error_filters:
|
||||||
ll_free(this->filters);
|
vector_free(this->filters);
|
||||||
|
|
||||||
error_this:
|
error_this:
|
||||||
free(this);
|
free(this);
|
||||||
@ -119,10 +119,10 @@ void egl_postProcessFree(EGL_PostProcess ** pp)
|
|||||||
|
|
||||||
if (this->filters)
|
if (this->filters)
|
||||||
{
|
{
|
||||||
EGL_Filter * filter;
|
EGL_Filter ** filter;
|
||||||
while(ll_shift(this->filters, (void **)&filter))
|
vector_forEachRef(filter, this->filters)
|
||||||
egl_filterFree(&filter);
|
egl_filterFree(filter);
|
||||||
ll_free(this->filters);
|
vector_free(this->filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
egl_modelFree(&this->model);
|
egl_modelFree(&this->model);
|
||||||
@ -136,7 +136,7 @@ bool egl_postProcessAdd(EGL_PostProcess * this, const EGL_FilterOps * ops)
|
|||||||
if (!egl_filterInit(ops, &filter))
|
if (!egl_filterInit(ops, &filter))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ll_push(this->filters, filter);
|
vector_push(this->filters, &filter);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ bool egl_postProcessConfigModified(EGL_PostProcess * this)
|
|||||||
bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
|
bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
|
||||||
unsigned int targetX, unsigned int targetY)
|
unsigned int targetX, unsigned int targetY)
|
||||||
{
|
{
|
||||||
EGL_Filter * lastFilter = NULL, * filter;
|
EGL_Filter * lastFilter = NULL;
|
||||||
unsigned int sizeX, sizeY;
|
unsigned int sizeX, sizeY;
|
||||||
|
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
@ -156,7 +156,9 @@ bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
atomic_store(&this->modified, false);
|
atomic_store(&this->modified, false);
|
||||||
for(ll_reset(this->filters); ll_walk(this->filters, (void **)&filter); )
|
|
||||||
|
EGL_Filter * filter;
|
||||||
|
vector_forEach(filter, this->filters)
|
||||||
{
|
{
|
||||||
egl_filterSetOutputResHint(filter, targetX, targetY);
|
egl_filterSetOutputResHint(filter, targetX, targetY);
|
||||||
egl_filterSetup(filter, tex->format.pixFmt, sizeX, sizeY);
|
egl_filterSetup(filter, tex->format.pixFmt, sizeX, sizeY);
|
||||||
|
Loading…
Reference in New Issue
Block a user