summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@opencompositing.org>2008-08-18 15:32:31 +0200
committerDennis kasprzyk <onestone@opencompositing.org>2008-08-18 15:32:31 +0200
commit79d78d3f60e683411a075fe44fe4ab862d0fadc6 (patch)
treed970c542e2a67264ac6ca61ba814f6b44408b255 /src
parentfa7e9361989282eddfc3012ffc392fadebf2b3c5 (diff)
downloadcompiz-with-glib-mainloop-79d78d3f60e683411a075fe44fe4ab862d0fadc6.tar.gz
compiz-with-glib-mainloop-79d78d3f60e683411a075fe44fe4ab862d0fadc6.tar.bz2
Fragment interface C++ port (not tested).
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/fragment.cpp1979
-rw-r--r--src/paint.cpp93
-rw-r--r--src/privatefragment.h25
-rw-r--r--src/privatescreen.h9
-rw-r--r--src/screen.cpp36
-rw-r--r--src/string.cpp56
-rw-r--r--src/window.cpp12
8 files changed, 973 insertions, 1240 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e13cadd..f3367ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,8 @@ bin_PROGRAMS = compiz
compiz_LDADD = @COMPIZ_LIBS@ @GL_LIBS@ -lm
compiz_LDFLAGS = -export-dynamic
compiz_SOURCES = \
+ string.cpp \
+ fragment.cpp \
match.cpp \
main.cpp \
object.cpp \
@@ -25,7 +27,6 @@ compiz_SOURCES = \
option.cpp \
plugin.cpp \
session.cpp \
- fragment.cpp \
matrix.cpp \
metadata.cpp \
output.cpp \
diff --git a/src/fragment.cpp b/src/fragment.cpp
index a63124b..963d5f5 100644
--- a/src/fragment.cpp
+++ b/src/fragment.cpp
@@ -23,8 +23,15 @@
* Author: David Reveman <davidr@novell.com>
*/
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/foreach.hpp>
+#define foreach BOOST_FOREACH
+
#include <compiz-core.h>
#include <comptexture.h>
+#include <compfragment.h>
+#include "privatefragment.h"
#include <string.h>
#include <stdlib.h>
@@ -35,1369 +42,1043 @@
#define COMP_FUNCTION_ARB_MASK (1 << 0)
#define COMP_FUNCTION_MASK (COMP_FUNCTION_ARB_MASK)
-struct _CompProgram {
- struct _CompProgram *next;
+namespace CompFragment {
+
+ class Program {
+ public:
+ Program (CompScreen *s) :
+ s (s),
+ signature (0),
+ blending (false),
+ name (0),
+ type (GL_FRAGMENT_PROGRAM_ARB)
+ {};
+ ~Program ()
+ {
+ if (name)
+ (*s->deletePrograms) (1, &name);
+ };
- int *signature;
- int nSignature;
+ public:
+ CompScreen *s;
- Bool blending;
+ std::list<FunctionId> signature;
- GLuint name;
- GLenum type;
-};
+ bool blending;
-typedef enum {
- CompOpTypeData,
- CompOpTypeDataStore,
- CompOpTypeDataOffset,
- CompOpTypeDataBlend,
- CompOpTypeHeaderTemp,
- CompOpTypeHeaderParam,
- CompOpTypeHeaderAttrib,
- CompOpTypeColor,
- CompOpTypeFetch,
- CompOpTypeLoad
-} CompOpType;
+ GLuint name;
+ GLenum type;
+ };
-typedef struct _CompDataOp {
- CompOpType type;
+ typedef enum {
+ OpTypeData,
+ OpTypeDataStore,
+ OpTypeDataOffset,
+ OpTypeDataBlend,
+ OpTypeHeaderTemp,
+ OpTypeHeaderParam,
+ OpTypeHeaderAttrib,
+ OpTypeColor,
+ OpTypeFetch,
+ OpTypeLoad
+ } OpType;
+
+ class HeaderOp {
+ public:
+ HeaderOp () : type(OpTypeHeaderTemp), name ("") {};
+ public:
+ OpType type;
+ CompString name;
+ };
- char *data;
-} CompDataOp;
+ class BodyOp {
+ public:
+ BodyOp () :
+ type(OpTypeData),
+ data (""),
+ dst (""),
+ src (""),
+ target (0)
+ {
+ foreach (CompString &str, noOffset)
+ str = "";
+ foreach (CompString &str, offset)
+ str = "";
+ };
+
+ public:
+ OpType type;
+ CompString data;
+ CompString dst;
+ CompString src;
+ unsigned int target;
+ CompString noOffset[COMP_FETCH_TARGET_NUM];
+ CompString offset[COMP_FETCH_TARGET_NUM];
-typedef struct _CompHeaderOp {
- CompOpType type;
+ };
- char *name;
-} CompHeaderOp;
+ class PrivateFunctionData {
+ public:
+ PrivateFunctionData () : header (0), body (0), status (true) {};
+ PrivateFunctionData (const PrivateFunctionData&, CompString);
-typedef struct _CompFetchOp {
- CompOpType type;
+ public:
+ std::vector<HeaderOp> header;
+ std::vector<BodyOp> body;
+ bool status;
+ };
- char *dst;
- char *offset;
- int target;
-} CompFetchOp;
+ class Function {
+ public:
+ Function ():
+ id (0),
+ name (""),
+ mask (0)
+ {};
+
+ public:
+ FunctionId id;
+ CompString name;
+ PrivateFunctionData data[COMP_FUNCTION_TYPE_NUM];
+ unsigned int mask;
+ };
-typedef struct _CompLoadOp {
- CompOpType type;
+ class PrivateAttrib {
+ public:
+ PrivateAttrib () :
+ opacity (0xffff),
+ brightness (0xffff),
+ saturation (0xffff),
+ nTexture (0),
+ nFunction (0),
+ nParam (0)
+ {};
+
+ public:
+ GLushort opacity;
+ GLushort brightness;
+ GLushort saturation;
+ int nTexture;
+ FunctionId function[MAX_FRAGMENT_FUNCTIONS];
+ int nFunction;
+ int nParam;
+ };
- char *noOffset[COMP_FETCH_TARGET_NUM];
- char *offset[COMP_FETCH_TARGET_NUM];
-} CompLoadOp;
+ typedef boost::function<void (BodyOp *, int)> DataOpCallBack;
-typedef struct _CompColorOp {
- CompOpType type;
+ class InitialLoadFunction : public Function {
+ public:
+ InitialLoadFunction ()
+ {
+ id = 0;
+ name = "__core_load";
+ mask = COMP_FUNCTION_MASK;
+
+ BodyOp b;
+ b.type = OpTypeLoad;
+ b.noOffset[0] = "TEX output, fragment.texcoord[0], texture[0], 2D;";
+ b.noOffset[1] = "TEX output, fragment.texcoord[0], texture[0], RECT;";
+ b.offset[0] = "TEX output, __tmp_texcoord0, texture[0], 2D;";
+ b.offset[1] = "TEX output, __tmp_texcoord0, texture[0], 2D;";
+ data[0].body.push_back (b);
+ };
+ };
- char *dst;
- char *src;
-} CompColorOp;
+ static InitialLoadFunction initialLoadFunction;
+
+ static Function *
+ findFragmentFunction (CompScreen *s,
+ FunctionId id)
+ {
+ foreach (Function *f, s->fragmentStorage ()->functions)
+ if (f->id == id)
+ return f;
+ return NULL;
+ }
-typedef union _CompBodyOp {
- CompOpType type;
+ static Function *
+ findFragmentFunctionWithName (CompScreen *s,
+ CompString name)
+ {
+ foreach (Function *f, s->fragmentStorage ()->functions)
+ if (f->name.compare (name) == 0)
+ return f;
+ return NULL;
+ }
- CompDataOp data;
- CompFetchOp fetch;
- CompLoadOp load;
- CompColorOp color;
-} CompBodyOp;
+ static Program *
+ findFragmentProgram (CompScreen *s,
+ FunctionId *signature,
+ unsigned int nSignature)
+ {
+ unsigned int i;
-struct _CompFunctionData {
- CompHeaderOp *header;
- int nHeader;
+ foreach (Program *p, s->fragmentStorage ()->programs)
+ {
+ if (p->signature.size () != nSignature)
+ continue;
- CompBodyOp *body;
- int nBody;
-};
+ i = 0;
+ foreach (FunctionId id, p->signature)
+ if (i == nSignature || signature[i++] != id)
+ break;
-struct _CompFunction {
- struct _CompFunction *next;
+ if (i == nSignature)
+ return p;
+ }
+ return NULL;
+ }
- int id;
- char *name;
- CompFunctionData data[COMP_FUNCTION_TYPE_NUM];
- int mask;
-};
+ static unsigned int
+ functionMaskToType (int mask)
+ {
+ static struct {
+ unsigned int type;
+ unsigned int mask;
+ } maskToType[] = {
+ { COMP_FUNCTION_TYPE_ARB, COMP_FUNCTION_ARB_MASK }
+ };
-typedef struct _FetchInfo {
- int indices[MAX_FRAGMENT_FUNCTIONS];
- char *data;
-} FetchInfo;
+ unsigned int i;
-typedef void (*DataOpCallBackProc) (CompDataOp *op,
- int index,
- void *closure);
+ for (i = 0; i < sizeof (maskToType) / sizeof (maskToType[0]); i++)
+ if (mask & maskToType[i].mask)
+ return maskToType[i].type;
-static CompLoadOp loadArbFpData = {
- CompOpTypeLoad,
- {
- "TEX output, fragment.texcoord[0], texture[0], 2D;",
- "TEX output, fragment.texcoord[0], texture[0], RECT;"
- }, {
- "TEX output, __tmp_texcoord0, texture[0], 2D;",
- "TEX output, __tmp_texcoord0, texture[0], RECT;"
+ return 0;
}
-};
-static CompFunction initialLoadFunction = {
- NULL,
- 0,
- "__core_load",
+ static void
+ forEachDataOpInFunction (std::vector<Function *> list,
+ int index,
+ int type,
+ int loadTarget,
+ CompString loadOffset,
+ bool *color,
+ bool *blend,
+ DataOpCallBack callBack)
{
+ Function *f = list[index];
+ BodyOp dataOp;
+ bool colorDone = false;
+ bool blendDone = false;
+
+ *color = false;
+ *blend = false;
+
+ foreach (BodyOp &bodyOp, f->data[type].body)
{
- NULL,
- 0,
- (CompBodyOp *) &loadArbFpData,
- 1
+ switch (bodyOp.type) {
+ case OpTypeFetch: {
+ CompString offset = loadOffset;
+
+ /* add offset */
+ if (bodyOp.data.size ())
+ {
+ if (loadOffset.size ())
+ {
+ dataOp.type = OpTypeDataOffset;
+ dataOp.data =
+ compPrintf ("ADD __tmp_texcoord%d, %s, %s;",
+ index, loadOffset.c_str (),
+ bodyOp.data.c_str ());
+
+ callBack (&dataOp, index);
+
+ offset = compPrintf ("__tmp_texcoord%d", index);
+ }
+ else
+ {
+ offset = bodyOp.data;
+ }
+ }
+
+ forEachDataOpInFunction (list, index - 1, type,
+ bodyOp.target,
+ offset, &colorDone, &blendDone,
+ callBack);
+
+ if (bodyOp.dst.compare("output"))
+ {
+ dataOp.type = OpTypeDataStore;
+ dataOp.data =
+ compPrintf ("MOV %s, output;", bodyOp.dst.c_str ());
+
+ /* move to destination */
+ callBack (&dataOp, index);
+ }
+ } break;
+ case OpTypeLoad:
+ if (loadOffset.size ())
+ {
+ dataOp.type = OpTypeDataOffset;
+ dataOp.data =
+ compPrintf ("ADD __tmp_texcoord0, fragment.texcoord[0], %s;",
+ loadOffset.c_str ());
+
+ callBack (&dataOp, index);
+
+ dataOp.data = bodyOp.offset[loadTarget];
+ }
+ else
+ {
+ dataOp.data = bodyOp.noOffset[loadTarget];
+ }
+
+ dataOp.type = OpTypeData;
+
+ callBack (&dataOp, index);
+
+ break;
+ case OpTypeColor:
+ if (!colorDone)
+ {
+ dataOp.type = OpTypeData;
+ dataOp.data =
+ compPrintf ("MUL %s, fragment.color, %s;",
+ bodyOp.dst.c_str (),
+ bodyOp.src.c_str ());
+
+ callBack (&dataOp, index);
+ }
+ else if (bodyOp.dst.compare (bodyOp.src))
+ {
+ dataOp.type = OpTypeData;
+ dataOp.data =
+ compPrintf ("MOV %s, %s;",
+ bodyOp.dst.c_str (),
+ bodyOp.src.c_str ());
+
+ callBack (&dataOp, index);
+ }
+ *color = true;
+ break;
+ case OpTypeDataBlend:
+ *blend = true;
+ /* fall-through */
+ case OpTypeData:
+ callBack (&bodyOp, index);
+ break;
+ case OpTypeDataStore:
+ case OpTypeDataOffset:
+ case OpTypeHeaderTemp:
+ case OpTypeHeaderParam:
+ case OpTypeHeaderAttrib:
+ break;
+ }
}
- },
- COMP_FUNCTION_MASK
-};
-static CompFunction *
-findFragmentFunction (CompScreen *s,
- int id)
-{
- CompFunction *function;
+ if (colorDone)
+ *color = true;
- for (function = s->fragmentFunctions (); function; function = function->next)
- {
- if (function->id == id)
- return function;
+ if (blendDone)
+ *blend = true;
}
- return NULL;
-}
-
-static CompFunction *
-findFragmentFunctionWithName (CompScreen *s,
- const char *name)
-{
- CompFunction *function;
-
- for (function = s->fragmentFunctions (); function; function = function->next)
+ static int
+ forEachHeaderOpWithType (std::vector<HeaderOp> list,
+ int index,
+ OpType type,
+ CompString prefix,
+ CompString functionPrefix,
+ int count,
+ DataOpCallBack callBack)
{
- if (strcmp (function->name, name) == 0)
- return function;
- }
+ BodyOp dataOp;
- return NULL;
-}
+ dataOp.type = OpTypeData;
-static CompProgram *
-findFragmentProgram (CompScreen *s,
- int *signature,
- int nSignature)
-{
- CompProgram *program;
- int i;
+ foreach (HeaderOp &header, list)
+ {
+ if (header.type == type)
+ {
+ if (count)
+ {
+ dataOp.data = ", ";
+ }
+ else
+ {
+ dataOp.data = prefix;
+ }
- for (program = s->fragmentPrograms (); program; program = program->next)
- {
- if (nSignature != program->nSignature)
- continue;
+ dataOp.data += functionPrefix;
+ dataOp.data += "_";
+ dataOp.data += header.name;
+ callBack (&dataOp, index);
- for (i = 0; i < nSignature; i++)
- {
- if (program->signature[i] != signature[i])
- break;
+ count++;
+ }
}
- if (i == nSignature)
- return program;
+ return count;
}
- return NULL;
-}
-
-static int
-functionMaskToType (int mask)
-{
- static struct {
- int type;
- int mask;
- } maskToType[] = {
- { COMP_FUNCTION_TYPE_ARB, COMP_FUNCTION_ARB_MASK }
- };
- int i;
-
- for (i = 0; i < sizeof (maskToType) / sizeof (maskToType[0]); i++)
- if (mask & maskToType[i].mask)
- return maskToType[i].type;
-
- return 0;
-}
-
-static void
-forEachDataOpInFunction (CompFunction **list,
- int index,
- int type,
- int loadTarget,
- char *loadOffset,
- Bool *color,
- Bool *blend,
- DataOpCallBackProc callBack,
- void *closure)
-{
- CompFunction *f = list[index];
- CompDataOp dataOp;
- char data[256];
- Bool colorDone = FALSE;
- Bool blendDone = FALSE;
- int i;
-
- *color = FALSE;
- *blend = FALSE;
-
- for (i = 0; i < f->data[type].nBody; i++)
+ static bool
+ forEachDataOp (std::vector<Function *> list,
+ int type,
+ DataOpCallBack callBack)
{
- switch (f->data[type].body[i].type) {
- case CompOpTypeFetch: {
- char *offset = loadOffset;
+ BodyOp dataOp;
+ bool colorDone;
+ bool blendDone;
+ int count, nList = list.size ();
- /* add offset */
- if (f->data[type].body[i].fetch.offset)
- {
- if (loadOffset)
- {
- snprintf (data, 256,
- "ADD __tmp_texcoord%d, %s, %s;",
- index, loadOffset,
- f->data[type].body[i].fetch.offset);
+ dataOp.type = OpTypeData;
- dataOp.type = CompOpTypeDataOffset;
- dataOp.data = data;
+ count = 1;
- (*callBack) (&dataOp, index, closure);
+ dataOp.data = "TEMP output";
- snprintf (data, 256, "__tmp_texcoord%d", index);
+ callBack (&dataOp, nList);
- offset = data;
- }
- else
- {
- offset = f->data[type].body[i].fetch.offset;
- }
- }
+ foreach (Function *f, list)
+ count = forEachHeaderOpWithType (f->data[type].header,
+ nList, OpTypeHeaderTemp,
+ "", f->name, count, callBack);
- forEachDataOpInFunction (list, index - 1, type,
- f->data[type].body[i].fetch.target,
- offset, &colorDone, &blendDone,
- callBack, closure);
+ dataOp.data = ";";
- if (strcmp (f->data[type].body[i].fetch.dst, "output"))
- {
- snprintf (data, 256,
- "MOV %s, output;",
- f->data[type].body[i].fetch.dst);
+ callBack (&dataOp, nList);
- dataOp.type = CompOpTypeDataStore;
- dataOp.data = data;
+ count = 0;
- /* move to destination */
- (*callBack) (&dataOp, index, closure);
- }
- } break;
- case CompOpTypeLoad:
- if (loadOffset)
- {
- snprintf (data, 256,
- "ADD __tmp_texcoord0, fragment.texcoord[0], %s;",
- loadOffset);
+ foreach (Function *f, list)
+ count = forEachHeaderOpWithType (f->data[type].header,
+ nList, OpTypeHeaderParam,
+ "PARAM ", f->name, count,
+ callBack);
- dataOp.type = CompOpTypeDataOffset;
- dataOp.data = data;
+ if (count)
+ {
+ dataOp.data = ";";
- (*callBack) (&dataOp, index, closure);
+ callBack (&dataOp, nList);
+ }
- dataOp.data = f->data[type].body[i].load.offset[loadTarget];
- }
- else
- {
- dataOp.data = f->data[type].body[i].load.noOffset[loadTarget];
- }
+ count = 0;
- dataOp.type = CompOpTypeData;
+ foreach (Function *f, list)
+ count = forEachHeaderOpWithType (f->data[type].header,
+ nList, OpTypeHeaderAttrib,
+ "ATTRIB ", f->name, count,
+ callBack);
- (*callBack) (&dataOp, index, closure);
+ if (count)
+ {
+ dataOp.data = ";";
- break;
- case CompOpTypeColor:
- if (!colorDone)
- {
- snprintf (data, 256,
- "MUL %s, fragment.color, %s;",
- f->data[type].body[i].color.dst,
- f->data[type].body[i].color.src);
+ callBack (&dataOp, nList);
+ }
- dataOp.type = CompOpTypeData;
- dataOp.data = data;
+ forEachDataOpInFunction (list, nList - 1, type, 0, NULL,
+ &colorDone, &blendDone,
+ callBack);
- (*callBack) (&dataOp, index, closure);
- }
- else if (strcmp (f->data[type].body[i].color.dst,
- f->data[type].body[i].color.src))
- {
- snprintf (data, 256,
- "MOV %s, %s;",
- f->data[type].body[i].color.dst,
- f->data[type].body[i].color.src);
+ if (colorDone)
+ dataOp.data = "MOV result.color, output;END";
+ else
+ dataOp.data = "MUL result.color, fragment.color, output;END";
- dataOp.type = CompOpTypeData;
- dataOp.data = data;
+ callBack (&dataOp, nList);
- (*callBack) (&dataOp, index, closure);
- }
- *color = TRUE;
- break;
- case CompOpTypeDataBlend:
- *blend = TRUE;
- /* fall-through */
- case CompOpTypeData:
- (*callBack) (&f->data[type].body[i].data, index, closure);
- break;
- case CompOpTypeDataStore:
- case CompOpTypeDataOffset:
- case CompOpTypeHeaderTemp:
- case CompOpTypeHeaderParam:
- case CompOpTypeHeaderAttrib:
- break;
- }
+ return blendDone;
}
- if (colorDone)
- *color = TRUE;
-
- if (blendDone)
- *blend = TRUE;
-}
-
-static int
-forEachHeaderOpWithType (CompHeaderOp *header,
- int nHeader,
- int index,
- CompOpType type,
- char *prefix,
- char *functionPrefix,
- int count,
- DataOpCallBackProc callBack,
- void *closure)
-{
- CompDataOp dataOp;
- int i;
-
- dataOp.type = CompOpTypeData;
-
- for (i = 0; i < nHeader; i++)
+ static void
+ addFetchOffsetVariables (BodyOp *op,
+ int index,
+ bool *indices,
+ CompString *data)
{
- if (header[i].type == type)
+ if (op->type == OpTypeDataOffset)
{
- if (count)
+ if (!indices[index])
{
- dataOp.data = ", ";
- (*callBack) (&dataOp, index, closure);
+ data->append (compPrintf ("TEMP __tmp_texcoord%d;", index));
+ indices[index] = true;
}
- else
- {
- dataOp.data = prefix;
- (*callBack) (&dataOp, index, closure);
- }
-
- dataOp.data = functionPrefix;
- (*callBack) (&dataOp, index, closure);
+ }
+ }
- dataOp.data = "_";
- (*callBack) (&dataOp, index, closure);
+ static void
+ addData (BodyOp *op,
+ CompString *data)
+ {
+ data->append (op->data);
+ }
- dataOp.data = header[i].name;
- (*callBack) (&dataOp, index, closure);
+ static Program *
+ buildFragmentProgram (CompScreen *s,
+ PrivateAttrib *attrib)
+ {
+ Program *program;
+ std::vector<Function *> functionList (1);
+ int mask = COMP_FUNCTION_MASK;
+ int type;
+ GLint errorPos;
+ CompString fetchData;
+ bool indices[MAX_FRAGMENT_FUNCTIONS];
+ int i;
+
+ program = new Program (s);
+ if (!program)
+ return NULL;
+
+ functionList[0] = &initialLoadFunction;
+
+ for (i = 0; i < attrib->nFunction; i++)
+ {
+ Function *f = findFragmentFunction (s, attrib->function[i]);
- count++;
+ if (f)
+ functionList.push_back (f);
}
- }
-
- return count;
-}
-static Bool
-forEachDataOp (CompFunction **list,
- int nList,
- int type,
- DataOpCallBackProc callBack,
- void *closure)
-{
- CompDataOp dataOp;
- Bool colorDone;
- Bool blendDone;
- int i, count;
+ foreach (Function *f, functionList)
+ mask &= f->mask;
- dataOp.type = CompOpTypeData;
+ if (!mask)
+ {
+ compLogMessage (NULL, "core", CompLogLevelWarn,
+ "fragment functions can't be linked together "
+ "because a common type doesn't exist");
+ }
- count = 1;
+ if (!mask || functionList.size () == 1)
+ {
+ delete program;
+ return NULL;
+ }
- dataOp.data = "TEMP output";
+ for (i = 0; i < attrib->nFunction; i++)
+ program->signature.push_back (attrib->function[i]);
- (*callBack) (&dataOp, nList, closure);
+ type = functionMaskToType (mask);
- for (i = 0; i < nList; i++)
- count = forEachHeaderOpWithType (list[i]->data[type].header,
- list[i]->data[type].nHeader,
- nList, CompOpTypeHeaderTemp,
- NULL, list[i]->name, count,
- callBack, closure);
+ fetchData = "!!ARBfp1.0";
- dataOp.data = ";";
+ foreach (bool &val, indices)
+ val = false;
- (*callBack) (&dataOp, nList, closure);
+ forEachDataOp (functionList, type,
+ boost::bind (addFetchOffsetVariables, _1, _2, indices, &fetchData));
- count = 0;
+ program->blending = forEachDataOp (functionList, type,
+ boost::bind (addData, _1, &fetchData));
- for (i = 0; i < nList; i++)
- count = forEachHeaderOpWithType (list[i]->data[type].header,
- list[i]->data[type].nHeader,
- nList, CompOpTypeHeaderParam,
- "PARAM ", list[i]->name, count,
- callBack, closure);
+ program->type = GL_FRAGMENT_PROGRAM_ARB;
- if (count)
- {
- dataOp.data = ";";
+ glGetError ();
- (*callBack) (&dataOp, nList, closure);
- }
+ (*s->genPrograms) (1, &program->name);
+ (*s->bindProgram) (GL_FRAGMENT_PROGRAM_ARB, program->name);
+ (*s->programString) (GL_FRAGMENT_PROGRAM_ARB,
+ GL_PROGRAM_FORMAT_ASCII_ARB,
+ fetchData.size (), fetchData.c_str ());
- count = 0;
+ glGetIntegerv (GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
+ if (glGetError () != GL_NO_ERROR || errorPos != -1)
+ {
+ compLogMessage (NULL, "core", CompLogLevelError,
+ "failed to load fragment program");
- for (i = 0; i < nList; i++)
- count = forEachHeaderOpWithType (list[i]->data[type].header,
- list[i]->data[type].nHeader,
- nList, CompOpTypeHeaderAttrib,
- "ATTRIB ", list[i]->name, count,
- callBack, closure);
+ (*s->deletePrograms) (1, &program->name);
- if (count)
- {
- dataOp.data = ";";
+ program->name = 0;
+ program->type = 0;
+ }
- (*callBack) (&dataOp, nList, closure);
+ return program;
}
- forEachDataOpInFunction (list, nList - 1, type, 0, NULL,
- &colorDone, &blendDone,
- callBack, closure);
+ static GLuint
+ getFragmentProgram (CompScreen *s,
+ PrivateAttrib *attrib,
+ GLenum *type,
+ bool *blending)
+ {
+ Program *program;
- if (colorDone)
- dataOp.data = "MOV result.color, output;END";
- else
- dataOp.data = "MUL result.color, fragment.color, output;END";
+ if (!attrib->nFunction)
+ return 0;
- (*callBack) (&dataOp, nList, closure);
+ program = findFragmentProgram (s, attrib->function, attrib->nFunction);
+ if (!program)
+ {
+ program = buildFragmentProgram (s, attrib);
+ if (program)
+ {
+ s->fragmentStorage ()->programs.push_back (program);
+ }
+ }
- return blendDone;
-}
+ if (program)
+ {
+ *type = program->type;
+ *blending = program->blending;
-static void
-addFetchOffsetVariables (CompDataOp *op,
- int index,
- void *closure)
-{
- if (op->type == CompOpTypeDataOffset)
- {
- FetchInfo *info = (FetchInfo *) closure;
+ return program->name;
+ }
- if (!info->indices[index])
- {
- char *str;
- int oldSize = strlen (info->data);
- int newSize;
- char data[256];
+ return 0;
+ }
- snprintf (data, 256, "TEMP __tmp_texcoord%d;", index);
- newSize = oldSize + strlen (data);
+ /* performs simple variable substitution */
+ static CompString
+ copyData (std::vector<HeaderOp> header,
+ const CompString prefix,
+ CompString data)
+ {
+ CompString inPrefix = "_";
+ inPrefix += prefix;
- str = (char *) realloc (info->data, newSize + 1);
- if (str)
+ CompString copy;
+
+ foreach (HeaderOp &h, header)
+ {
+ unsigned int pos = data.find (h.name);
+ while (pos != std::string::npos)
{
- strcpy (str + oldSize, data);
- info->data = str;
+ data.insert (pos,inPrefix);
+ pos += inPrefix.size () + h.name.size ();
+ pos = data.find (h.name, pos);
}
-
- info->indices[index] = TRUE;
}
+ return copy;
}
-}
-
-static void
-addData (CompDataOp *op,
- int index,
- void *closure)
-{
- FetchInfo *info = (FetchInfo *) closure;
- char *str;
- int oldSize = strlen (info->data);
- int newSize = oldSize + strlen (op->data);
-
- str = (char *) realloc (info->data, newSize + 1);
- if (str)
+
+ PrivateFunctionData::PrivateFunctionData (const PrivateFunctionData& src,
+ CompString dstPrefix) :
+ header (src.header),
+ body (0)
{
- strcpy (str + oldSize, op->data);
- info->data = str;
+
+ foreach (BodyOp b, src.body)
+ {
+ BodyOp dst;
+ dst.type = b.type;
+
+ switch (b.type) {
+ case OpTypeFetch:
+ dst.dst = copyData (header, dstPrefix, b.dst);
+ if (b.data.size ())
+ dst.data = copyData (header, dstPrefix, b.data);
+ else
+ dst.data = "";
+
+ dst.target = b.target;
+ break;
+ case OpTypeLoad:
+ case OpTypeHeaderTemp:
+ case OpTypeHeaderParam:
+ case OpTypeHeaderAttrib:
+ break;
+ case OpTypeData:
+ case OpTypeDataBlend:
+ case OpTypeDataStore:
+ case OpTypeDataOffset:
+ dst.data = copyData (header, dstPrefix, b.data);
+ break;
+ case OpTypeColor:
+ dst.dst = copyData (header, dstPrefix, b.dst);
+ dst.src = copyData (header, dstPrefix, b.src);
+ break;
+ }
+ body.push_back (dst);
+ }
}
-}
-
-static CompProgram *
-buildFragmentProgram (CompScreen *s,
- FragmentAttrib *attrib)
-{
- CompProgram *program;
- CompFunction **functionList;
- int nFunctionList;
- int mask = COMP_FUNCTION_MASK;
- int type;
- GLint errorPos;
- FetchInfo info;
- int i;
-
- program = (CompProgram *) malloc (sizeof (CompProgram));
- if (!program)
- return NULL;
- functionList = (CompFunction **) malloc ((attrib->nFunction + 1) * sizeof (void *));
- if (!functionList)
+ static bool
+ addHeaderOpToFunctionData (PrivateFunctionData *data,
+ const char *name,
+ OpType type)
{
- free (program);
+ static const char *reserved[] = {
+ "output",
+ "__tmp_texcoord",
+ "fragment",
+ "program",
+ "result",
+ "state",
+ "texture"
+ };
+ HeaderOp header;
+ CompString n (name);
+
+ foreach (const char *word, reserved)
+ {
+ if (n.find (word) != std::string::npos)
+ {
+ compLogMessage (NULL, "core", CompLogLevelWarn,
+ "%s is a reserved word", word);
+ return false;
+ }
+ }
- return NULL;
- }
- functionList[0] = &initialLoadFunction;
- nFunctionList = 1;
+ header.type = type;
+ header.name = n;
+ data->header.push_back (header);
- for (i = 0; i < attrib->nFunction; i++)
- {
- functionList[nFunctionList] =
- findFragmentFunction (s, attrib->function[i]);
- if (functionList[nFunctionList])
- nFunctionList++;
+ return true;
}
- for (i = 0; i < nFunctionList; i++)
- mask &= functionList[i]->mask;
-
- if (!mask)
+ FunctionData::FunctionData () :
+ priv (new PrivateFunctionData ())
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
- "fragment functions can't be linked together "
- "because a common type doesn't exist");
}
- if (!mask || nFunctionList == 1)
+ FunctionData::~FunctionData ()
{
- free (program);
- free (functionList);
-
- return NULL;
+ delete priv;
}
- program->signature = (int *) malloc (attrib->nFunction * sizeof (int));
- if (!program->signature)
+ bool
+ FunctionData::status ()
{
- free (program);
- free (functionList);
-
- return NULL;
+ return priv->status;
}
- for (i = 0; i < attrib->nFunction; i++)
- program->signature[i] = attrib->function[i];
-
- program->nSignature = attrib->nFunction;
-
- type = functionMaskToType (mask);
-
- info.data = strdup ("!!ARBfp1.0");
-
- memset (info.indices, 0, sizeof (info.indices));
-
- forEachDataOp (functionList, nFunctionList, type,
- addFetchOffsetVariables, (void *) &info);
-
- program->blending = forEachDataOp (functionList, nFunctionList, type,
- addData, (void *) &info);
-
- program->type = GL_FRAGMENT_PROGRAM_ARB;
-
- glGetError ();
-
- (*s->genPrograms) (1, &program->name);
- (*s->bindProgram) (GL_FRAGMENT_PROGRAM_ARB, program->name);
- (*s->programString) (GL_FRAGMENT_PROGRAM_ARB,
- GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen (info.data), info.data);
-
- glGetIntegerv (GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
- if (glGetError () != GL_NO_ERROR || errorPos != -1)
+ void
+ FunctionData::addTempHeaderOp (const char *name)
{
- compLogMessage (NULL, "core", CompLogLevelError,
- "failed to load fragment program");
-
- (*s->deletePrograms) (1, &program->name);
-
- program->name = 0;
- program->type = 0;
+ priv->status &=
+ addHeaderOpToFunctionData (priv, name, OpTypeHeaderTemp);
}
- free (info.data);
- free (functionList);
-
- return program;
-}
-
-static GLuint
-getFragmentProgram (CompScreen *s,
- FragmentAttrib *attrib,
- GLenum *type,
- Bool *blending)
-{
- CompProgram *program;
-
- if (!attrib->nFunction)
- return 0;
-
- program = findFragmentProgram (s, attrib->function, attrib->nFunction);
- if (!program)
+ void
+ FunctionData::addParamHeaderOp (const char *name)
{
- program = buildFragmentProgram (s, attrib);
- if (program)
- {
- program->next = s->fragmentPrograms ();
- s->fragmentPrograms () = program;
- }
+ priv->status &=
+ addHeaderOpToFunctionData (priv, name, OpTypeHeaderParam);
}
- if (program)
+ void
+ FunctionData::addAttribHeaderOp (const char *name)
{
- *type = program->type;
- *blending = program->blending;
-
- return program->name;
+ priv->status &=
+ addHeaderOpToFunctionData (priv, name, OpTypeHeaderAttrib);
}
- return 0;
-}
-
-CompFunctionData *
-createFunctionData (void)
-{
- CompFunctionData *data;
-
- data = (CompFunctionData *) malloc (sizeof (CompFunctionData));
- if (!data)
- return NULL;
- data->header = NULL;
- data->nHeader = 0;
+ void
+ FunctionData::addFetchOp (const char *dst, const char *offset, int target)
+ {
+ BodyOp b;
- data->body = NULL;
- data->nBody = 0;
+ b.type = OpTypeFetch;
+ b.dst = CompString (dst);
+ b.target = target;
- return data;
-}
+ if (offset)
+ b.data = CompString (offset);
+ else
+ b.data = CompString ("");
-static void
-finiFunctionData (CompFunctionData *data)
-{
- int i;
+ priv->body.push_back (b);
+ }
- for (i = 0; i < data->nHeader; i++)
- free (data->header[i].name);
+ void
+ FunctionData::addColorOp (const char *dst, const char *src)
+ {
+ BodyOp b;
+
+ b.type = OpTypeColor;
+ b.dst = CompString (dst);
+ b.src = CompString (src);
- if (data->header)
- free (data->header);
+ priv->body.push_back (b);
+ }
- for (i = 0; i < data->nBody; i++)
+ void
+ FunctionData::addDataOp (const char *str, ...)
{
- switch (data->body[i].type) {
- case CompOpTypeFetch:
- free (data->body[i].fetch.dst);
- if (data->body[i].fetch.offset)
- free (data->body[i].fetch.offset);
- break;
- case CompOpTypeLoad:
- case CompOpTypeHeaderTemp:
- case CompOpTypeHeaderParam:
- case CompOpTypeHeaderAttrib:
- break;
- case CompOpTypeData:
- case CompOpTypeDataBlend:
- case CompOpTypeDataStore:
- case CompOpTypeDataOffset:
- free (data->body[i].data.data);
- break;
- case CompOpTypeColor:
- free (data->body[i].color.dst);
- free (data->body[i].color.src);
- break;
- }
+ BodyOp b;
+ va_list ap;
+
+ b.type = OpTypeData;
+ va_start (ap, str);
+ b.data = compPrintf(str, ap);
+ va_end (ap);
+
+ priv->body.push_back (b);
}
- if (data->body)
- free (data->body);
-}
-
-void
-destroyFunctionData (CompFunctionData *data)
-{
- finiFunctionData (data);
- free (data);
-}
-
-/* performs simple variable substitution */
-static char *
-copyData (CompHeaderOp *header,
- int nHeader,
- const char *prefix,
- char *data)
-{
- char *copy, *needle, *haystack, *dst, *first;
- int i, index, length, prefixLength, count = 0;
-
- prefixLength = strlen (prefix);
-
- for (i = 0; i < nHeader; i++)
+ void
+ FunctionData::addBlendOp (const char *str, ...)
{
- length = strlen (header[i].name);
- haystack = data;
-
- do {
- needle = strstr (haystack, header[i].name);
- if (needle)
- {
- haystack = needle + length;
- count++;
- }
- } while (needle);
+ BodyOp b;
+ va_list ap;
+
+ b.type = OpTypeDataBlend;
+ va_start (ap, str);
+ b.data = compPrintf(str, ap);
+ va_end (ap);
+
+ priv->body.push_back (b);
}
- /* allocate new memory that will fit all substitutions */
- copy = (char *) malloc (strlen (data) + count * (strlen (prefix) + 1) + 1);
- if (!copy)
- return NULL;
-
- haystack = data;
- dst = copy;
-
- for (;;)
+ FunctionId
+ FunctionData::createFragmentFunction (CompScreen *s, const char *name)
{
- first = NULL;
- index = 0;
+ Function *function = new Function ();
+ CompString validName = name;
+ unsigned int i = 0;
- for (i = 0; i < nHeader; i++)
+
+ while (findFragmentFunctionWithName (s, validName))
{
- needle = strstr (haystack, header[i].name);
- if (needle && (!first || needle < first))
- {
- first = needle;
- index = i;
- }
+ validName = compPrintf ("%s%d", name, i++);
}
- if (first)
- {
- int length;
+ function->data[COMP_FUNCTION_TYPE_ARB] =
+ PrivateFunctionData (*priv, validName);
- if (first > haystack)
- {
- strncpy (dst, haystack, first - haystack);
- dst += first - haystack;
- }
-
- length = strlen (header[index].name);
+ function->name = validName;
+ function->mask = COMP_FUNCTION_ARB_MASK;
+ function->id = s->fragmentStorage ()->lastFunctionId++;
- strcpy (dst, prefix);
- dst += prefixLength;
- *dst++ = '_';
- strcpy (dst, header[index].name);
- dst += length;
+ s->fragmentStorage ()->functions.push_back (function);
- haystack = first + length;
- }
- else
- {
- strcpy (dst, haystack);
- break;
- }
+ return function->id;
}
- return copy;
-}
-
-static Bool
-copyFunctionData (CompFunctionData *dst,
- const CompFunctionData *src,
- const char *dstPrefix)
-{
- int i;
-
- dst->header = (CompHeaderOp *) malloc (src->nHeader * sizeof (CompHeaderOp));
- if (!dst->header)
- return FALSE;
+ Attrib::Attrib (const WindowPaintAttrib *paint) :
+ priv (new PrivateAttrib ())
+ {
+ priv->opacity = paint->opacity;
+ priv->brightness = paint->brightness;
+ priv->saturation = paint->saturation;
+ priv->nTexture = 0;
+ priv->nFunction = 0;
+ priv->nParam = 0;
+
+ foreach (FunctionId &f, priv->function)
+ f = 0;
+ };
- dst->body = (CompBodyOp *) malloc (src->nBody * sizeof (CompBodyOp));
- if (!dst->body)
+ Attrib::Attrib (const Attrib &fa) :
+ priv (new PrivateAttrib ())
{
- free (dst->header);
- return FALSE;
+ priv->opacity = fa.priv->opacity;
+ priv->brightness = fa.priv->brightness;
+ priv->saturation = fa.priv->saturation;
+ priv->nTexture = fa.priv->nTexture;
+ priv->nFunction = fa.priv->nFunction;
+ priv->nParam = fa.priv->nParam;
+
+ for (int i = 0; i < MAX_FRAGMENT_FUNCTIONS; i++)
+ priv->function[i] = fa.priv->function[i];
}
- dst->nHeader = src->nHeader;
-
- for (i = 0; i < src->nHeader; i++)
+ Attrib::~Attrib ()
{
- dst->header[i].type = src->header[i].type;
- dst->header[i].name = strdup (src->header[i].name);
+ delete priv;
}
- dst->nBody = src->nBody;
-
- for (i = 0; i < src->nBody; i++)
+ unsigned int
+ Attrib::allocTextureUnits (unsigned int nTexture)
{
- dst->body[i].type = src->body[i].type;
-
- switch (src->body[i].type) {
- case CompOpTypeFetch:
- dst->body[i].fetch.dst = copyData (dst->header,
- dst->nHeader,
- dstPrefix,
- src->body[i].fetch.dst);
- if (src->body[i].fetch.offset)
- dst->body[i].fetch.offset =
- copyData (dst->header,
- dst->nHeader,
- dstPrefix,
- src->body[i].fetch.offset);
- else
- dst->body[i].fetch.offset = NULL;
-
- dst->body[i].fetch.target = src->body[i].fetch.target;
- break;
- case CompOpTypeLoad:
- case CompOpTypeHeaderTemp:
- case CompOpTypeHeaderParam:
- case CompOpTypeHeaderAttrib:
- break;
- case CompOpTypeData:
- case CompOpTypeDataBlend:
- case CompOpTypeDataStore:
- case CompOpTypeDataOffset:
- dst->body[i].data.data = copyData (dst->header,
- dst->nHeader,
- dstPrefix,
- src->body[i].data.data);
- break;
- case CompOpTypeColor:
- dst->body[i].color.dst = copyData (dst->header,
- dst->nHeader,
- dstPrefix,
- src->body[i].color.dst);
- dst->body[i].color.src = copyData (dst->header,
- dst->nHeader,
- dstPrefix,
- src->body[i].color.src);
- break;
- }
- }
+ unsigned int first = priv->nTexture;
- return TRUE;
-}
-
-static Bool
-addHeaderOpToFunctionData (CompFunctionData *data,
- const char *name,
- CompOpType type)
-{
- static char *reserved[] = {
- "output",
- "__tmp_texcoord",
- "fragment",
- "program",
- "result",
- "state",
- "texture"
- };
- CompHeaderOp *header;
- int i;
+ priv->nTexture += nTexture;
- for (i = 0; i < sizeof (reserved) / sizeof (reserved[0]); i++)
- {
- if (strncmp (name, reserved[i], strlen (reserved[i])) == 0)
- {
- compLogMessage (NULL, "core", CompLogLevelWarn,
- "%s is a reserved word", name);
- return FALSE;
- }
+ /* 0 is reserved for source texture */
+ return 1 + first;
}
- header = (CompHeaderOp *) realloc (data->header,
- (data->nHeader + 1) * sizeof (CompHeaderOp));
- if (!header)
- return FALSE;
-
- header[data->nHeader].type = type;
- header[data->nHeader].name = strdup (name);
-
- data->header = header;
- data->nHeader++;
-
- return TRUE;
-}
-
-Bool
-addTempHeaderOpToFunctionData (CompFunctionData *data,
- const char *name)
-{
- return addHeaderOpToFunctionData (data, name, CompOpTypeHeaderTemp);
-}
-
-Bool
-addParamHeaderOpToFunctionData (CompFunctionData *data,
- const char *name)
-{
- return addHeaderOpToFunctionData (data, name, CompOpTypeHeaderParam);
-}
-
-Bool
-addAttribHeaderOpToFunctionData (CompFunctionData *data,
- const char *name)
-{
- return addHeaderOpToFunctionData (data, name, CompOpTypeHeaderAttrib);
-}
-
-static Bool
-allocBodyOpInFunctionData (CompFunctionData *data)
-{
- CompBodyOp *body;
-
- body = (CompBodyOp *) realloc (data->body, (data->nBody + 1) * sizeof (CompBodyOp));
- if (!body)
- return FALSE;
-
- data->body = body;
- data->nBody++;
-
- return TRUE;
-}
-
-Bool
-addFetchOpToFunctionData (CompFunctionData *data,
- const char *dst,
- const char *offset,
- int target)
-{
- int index = data->nBody;
-
- if (!allocBodyOpInFunctionData (data))
- return FALSE;
-
- data->body[index].type = CompOpTypeFetch;
- data->body[index].fetch.dst = strdup (dst);
- data->body[index].fetch.target = target;
-
- if (offset)
- data->body[index].fetch.offset = strdup (offset);
- else
- data->body[index].fetch.offset = NULL;
-
- return TRUE;
-}
-
-Bool
-addColorOpToFunctionData (CompFunctionData *data,
- const char *dst,
- const char *src)
-{
- int index = data->nBody;
-
- if (!allocBodyOpInFunctionData (data))
- return FALSE;
-
- data->body[index].type = CompOpTypeColor;
- data->body[index].color.dst = strdup (dst);
- data->body[index].color.src = strdup (src);
-
- return TRUE;
-}
-
-Bool
-addDataOpToFunctionData (CompFunctionData *data,
- const char *str,
- ...)
-{
- int index = data->nBody;
- int size = strlen (str) + 1;
- int n;
- char *fStr;
- char *tmp;
- va_list ap;
-
- if (!allocBodyOpInFunctionData (data))
- return FALSE;
-
- fStr = (char *) malloc (size);
- if (!fStr)
- return FALSE;
-
- while (1)
+ unsigned int
+ Attrib::allocParameters (unsigned int nParam)
{
- /* Try to print in the allocated space. */
- va_start (ap, str);
- n = vsnprintf (fStr, size, str, ap);
- va_end (ap);
-
- /* If that worked, leave the loop. */
- if (n > -1 && n < size)
- break;
+ unsigned int first = priv->nParam;
- /* Else try again with more space. */
- if (n > -1) /* glibc 2.1 */
- size = n + 1; /* precisely what is needed */
- else /* glibc 2.0 */
- size++; /* one more than the old size */
+ priv->nParam += nParam;
- tmp = (char *) realloc (fStr, size);
- if (!tmp)
- {
- free (fStr);
- return FALSE;
- }
- else
- {
- fStr = tmp;
- }
+ return first;
}
- data->body[index].type = CompOpTypeData;
- data->body[index].data.data = fStr;
-
- return TRUE;
-}
+ void
+ Attrib::addFunction (FunctionId function)
+ {
+ if (priv->nFunction < MAX_FRAGMENT_FUNCTIONS)
+ priv->function[priv->nFunction++] = function;
+ }
-Bool
-addBlendOpToFunctionData (CompFunctionData *data,
- const char *str,
- ...)
-{
- int index = data->nBody;
- int size = strlen (str) + 1;
- int n;
- char *fStr;
- char *tmp;
- va_list ap;
+ bool
+ Attrib::enable (CompScreen *s, bool *blending)
+ {
+ GLuint name;
+ GLenum type;
+ bool programBlending;
- if (!allocBodyOpInFunctionData (data))
- return FALSE;
+ if (!s->fragmentProgram ())
+ return false;
- fStr = (char *) malloc (size);
- if (!fStr)
- return FALSE;
+ name = getFragmentProgram (s, priv, &type, &programBlending);
+ if (!name)
+ return false;
- while (1)
- {
- /* Try to print in the allocated space. */
- va_start (ap, str);
- n = vsnprintf (fStr, size, str, ap);
- va_end (ap);
+ *blending = !programBlending;
- /* If that worked, leave the loop. */
- if (n > -1 && n < size)
- break;
+ glEnable (GL_FRAGMENT_PROGRAM_ARB);
- /* Else try again with more space. */
- if (n > -1) /* glibc 2.1 */
- size = n + 1; /* precisely what is needed */
- else /* glibc 2.0 */
- size++; /* one more than the old size */
+ (*s->bindProgram) (type, name);
- tmp = (char *) realloc (fStr, size);
- if (!tmp)
- {
- free (fStr);
- return FALSE;
- }
- else
- {
- fStr = tmp;
- }
+ return true;
}
- data->body[index].type = CompOpTypeDataBlend;
- data->body[index].data.data = fStr;
-
- return TRUE;
-}
-
-static int
-allocFunctionId (CompScreen *s)
-{
- return ++s->lastFunctionId ();
-}
-
-int
-createFragmentFunction (CompScreen *s,
- const char *name,
- CompFunctionData *data)
-{
- CompFunction *function;
- const char *validName = name;
- char *nameBuffer = NULL;
- int i = 0;
-
- while (findFragmentFunctionWithName (s, validName))
+ void
+ Attrib::disable (CompScreen *s)
{
- if (!nameBuffer)
- {
- nameBuffer = (char *) malloc (strlen (name) + 64);
- if (!nameBuffer)
- return 0;
-
- validName = nameBuffer;
- }
-
- sprintf (nameBuffer, "%s%d", name, i++);
+ glDisable (GL_FRAGMENT_PROGRAM_ARB);
}
- function = (CompFunction *) malloc (sizeof (CompFunction));
- if (!function)
+ unsigned short
+ Attrib::getSaturation ()
{
- if (nameBuffer)
- free (nameBuffer);
-
- return 0;
+ return priv->saturation;
}
- if (!copyFunctionData (&function->data[COMP_FUNCTION_TYPE_ARB], data,
- validName))
+ unsigned short
+ Attrib::getBrightness ()
{
- free (function);
- if (nameBuffer)
- free (nameBuffer);
-
- return 0;
+ return priv->brightness;
}
- function->name = strdup (validName);
- function->mask = COMP_FUNCTION_ARB_MASK;
- function->id = allocFunctionId (s);
-
- function->next = s->fragmentFunctions ();
- s->fragmentFunctions () = function;
+ unsigned short
+ Attrib::getOpacity ()
+ {
+ return priv->opacity;
+ }
- if (nameBuffer)
- free (nameBuffer);
+ void
+ Attrib::setSaturation (unsigned short value)
+ {
+ priv->saturation = value;
+ }
- return function->id;
-}
+ void
+ Attrib::setBrightness (unsigned short value)
+ {
+ priv->brightness = value;
+ }
-void
-destroyFragmentFunction (CompScreen *s,
- int id)
-{
- CompFunction *function, *prevFunction = NULL;
- CompProgram *program, *prevProgram = NULL;
- int i;
- for (function = s->fragmentFunctions (); function; function = function->next)
+ void
+ Attrib::setOpacity (unsigned short value)
{
- if (function->id == id)
- break;
-
- prevFunction = function;
+ priv->opacity = value;
}
- if (!function)
- return;
-
- program = s->fragmentPrograms ();
- while (program)
+ bool
+ Attrib::hasFunctions ()
{
- for (i = 0; i < program->nSignature; i++)
- {
- if (program->signature[i] == id)
- break;
- }
+ return priv->nFunction > 0;
+ }
- if (i < program->nSignature)
- {
- CompProgram *tmp = program;
+ void destroyFragmentFunction (CompScreen *s, FunctionId id)
+ {
+ Function *function;
+ Program *program;
- if (prevProgram)
- prevProgram->next = program->next;
- else
- s->fragmentPrograms () = program->next;
+ function = findFragmentFunction (s, id);
- program = program->next;
+ if (!function)
+ return;
- (*s->deletePrograms) (1, &tmp->name);
+ std::vector<Program *>::iterator it;
- free (tmp->signature);
- free (tmp);
- }
- else
- {
- prevProgram = program;
- program = program->next;
- }
- }
+ do {
+ it = s->fragmentStorage ()->programs.begin ();
+ for (; it != s->fragmentStorage ()->programs.end (); it++)
+ {
+ program = (*it);
+ foreach (FunctionId i, program->signature)
+ if (i == id)
+ break;
+ program = NULL;
+ }
- if (prevFunction)
- prevFunction->next = function->next;
- else
- s->fragmentFunctions () = function->next;
+ if (program)
+ {
+ delete program;
+ s->fragmentStorage ()->programs.erase (it);
+ }
- finiFunctionData (&function->data[COMP_FUNCTION_TYPE_ARB]);
- free (function->name);
- free (function);
-}
+ } while (program);
+
+
+ std::vector<Function *>::iterator fi =
+ std::find (s->fragmentStorage ()->functions.begin (),
+ s->fragmentStorage ()->functions.end (),
+ function);
+ if (fi != s->fragmentStorage ()->functions.end ())
+ s->fragmentStorage ()->functions.erase (fi);
+
+ delete (function);
+ }
-int
-getSaturateFragmentFunction (CompScreen *s,
- CompTexture *texture,
- int param)
-{
- int target;
+ FunctionId
+ getSaturateFragmentFunction (CompScreen *s,
+ CompTexture *texture,
+ int param)
+ {
+ int target;
- if (param >= 64)
- return 0;
+ if (param >= 64)
+ return 0;
- if (texture->target () == GL_TEXTURE_2D)
- target = COMP_FETCH_TARGET_2D;
- else
- target = COMP_FETCH_TARGET_RECT;
+ if (texture->target () == GL_TEXTURE_2D)
+ target = COMP_FETCH_TARGET_2D;
+ else
+ target = COMP_FETCH_TARGET_RECT;
- if (!s->getSaturateFunction (target, param))
- {
- static const char *saturateData =
- "MUL temp, output, { 1.0, 1.0, 1.0, 0.0 };"
- "DP3 temp, temp, program.env[%d];"
- "LRP output.xyz, program.env[%d].w, output, temp;";
- CompFunctionData *data;
-
- data = createFunctionData ();
- if (data)
+ if (!s->fragmentStorage ()->saturateFunction [target][param])
{
- char str[1024];
+ static const char *saturateData =
+ "MUL temp, output, { 1.0, 1.0, 1.0, 0.0 };"
+ "DP3 temp, temp, program.env[%d];"
+ "LRP output.xyz, program.env[%d].w, output, temp;";
+ FunctionData data;
- if (!addTempHeaderOpToFunctionData (data, "temp"))
- {
- destroyFunctionData (data);
- return 0;
- }
+ data.addTempHeaderOp ("temp");
+ data.addFetchOp ("output", NULL, target);
+ data.addColorOp ("output", "output");
- if (!addFetchOpToFunctionData (data, "output", NULL, target))
- {
- destroyFunctionData (data);
- return 0;
- }
+ data.addDataOp (saturateData, param, param);
- if (!addColorOpToFunctionData (data, "output", "output"))
- {
- destroyFunctionData (data);
+ if (!data.status ())
return 0;
- }
- snprintf (str, 1024, saturateData, param, param);
+ s->fragmentStorage ()->saturateFunction [target][param] =
+ data.createFragmentFunction (s, "__core_saturate");
- if (!addDataOpToFunctionData (data, str))
- {
- destroyFunctionData (data);
- return 0;
- }
+ }
- s->getSaturateFunction (target, param) =
- createFragmentFunction (s, "__core_saturate", data);
+ return s->fragmentStorage ()->saturateFunction [target][param];
+ }
- destroyFunctionData (data);
+ Storage::Storage () :
+ lastFunctionId (0),
+ functions (0),
+ programs (0)
+ {
+ for (int i = 0; i < 64; i++)
+ {
+ saturateFunction[0][i] = 0;
+ saturateFunction[1][i] = 0;
}
}
- return s->getSaturateFunction (target, param);
-}
-
-int
-allocFragmentTextureUnits (FragmentAttrib *attrib,
- int nTexture)
-{
- int first = attrib->nTexture;
-
- attrib->nTexture += nTexture;
-
- /* 0 is reserved for source texture */
- return 1 + first;
-}
-
-int
-allocFragmentParameters (FragmentAttrib *attrib,
- int nParam)
-{
- int first = attrib->nParam;
-
- attrib->nParam += nParam;
-
- return first;
-}
-
-void
-addFragmentFunction (FragmentAttrib *attrib,
- int function)
-{
- if (attrib->nFunction < MAX_FRAGMENT_FUNCTIONS)
- attrib->function[attrib->nFunction++] = function;
-}
-
-void
-initFragmentAttrib (FragmentAttrib *attrib,
- const WindowPaintAttrib *paint)
-{
- attrib->opacity = paint->opacity;
- attrib->brightness = paint->brightness;
- attrib->saturation = paint->saturation;
- attrib->nTexture = 0;
- attrib->nFunction = 0;
- attrib->nParam = 0;
-
- memset (attrib->function, 0, sizeof (attrib->function));
-}
-
-bool
-enableFragmentAttrib (CompScreen *s,
- FragmentAttrib *attrib,
- Bool *blending)
-{
- GLuint name;
- GLenum type;
- Bool programBlending;
-
- if (!s->fragmentProgram ())
- return false;
-
- name = getFragmentProgram (s, attrib, &type, &programBlending);
- if (!name)
- return false;
-
- *blending = !programBlending;
-
- glEnable (GL_FRAGMENT_PROGRAM_ARB);
-
- (*s->bindProgram) (type, name);
-
- return true;
-}
-
-void
-disableFragmentAttrib (CompScreen *s,
- FragmentAttrib *attrib)
-{
- glDisable (GL_FRAGMENT_PROGRAM_ARB);
-}
+ Storage::~Storage ()
+ {
+ foreach (Program *p, programs)
+ delete p;
+ programs.clear ();
+ foreach (Function *f, functions)
+ delete f;
+ functions.clear ();
+ }
+
+}; \ No newline at end of file
diff --git a/src/paint.cpp b/src/paint.cpp
index d4820c4..8c6d531 100644
--- a/src/paint.cpp
+++ b/src/paint.cpp
@@ -814,33 +814,34 @@ CompWindow::addGeometry (CompTexture::Matrix *matrix,
}
static bool
-enableFragmentProgramAndDrawGeometry (CompWindow *w,
- CompTexture *texture,
- const FragmentAttrib *attrib,
+enableFragmentProgramAndDrawGeometry (CompWindow *w,
+ CompTexture *texture,
+ CompFragment::Attrib &attrib,
CompTexture::Filter filter,
- unsigned int mask)
+ unsigned int mask)
{
- FragmentAttrib fa = *attrib;
- CompScreen *s = w->screen ();
- Bool blending;
+ CompFragment::Attrib fa (attrib);
+ CompScreen *s = w->screen ();
+ bool blending;
- if (s->canDoSaturated () && attrib->saturation != COLOR)
+ if (s->canDoSaturated () && attrib.getSaturation () != COLOR)
{
int param, function;
- param = allocFragmentParameters (&fa, 1);
- function = getSaturateFragmentFunction (s, texture, param);
+ param = fa.allocParameters (1);
+ function =
+ CompFragment::getSaturateFragmentFunction (s, texture, param);
- addFragmentFunction (&fa, function);
+ fa.addFunction (function);
(*s->programEnvParameter4f) (GL_FRAGMENT_PROGRAM_ARB, param,
RED_SATURATION_WEIGHT,
GREEN_SATURATION_WEIGHT,
BLUE_SATURATION_WEIGHT,
- attrib->saturation / 65535.0f);
+ attrib.getSaturation () / 65535.0f);
}
- if (!enableFragmentAttrib (s, &fa, &blending))
+ if (!fa.enable (s, &blending))
return false;
texture->enable (filter);
@@ -850,14 +851,14 @@ enableFragmentProgramAndDrawGeometry (CompWindow *w,
if (blending)
glEnable (GL_BLEND);
- if (attrib->opacity != OPAQUE || attrib->brightness != BRIGHT)
+ if (attrib.getOpacity () != OPAQUE || attrib.getBrightness () != BRIGHT)
{
GLushort color;
- color = (attrib->opacity * attrib->brightness) >> 16;
+ color = (attrib.getOpacity () * attrib.getBrightness ()) >> 16;
s->setTexEnvMode (GL_MODULATE);
- glColor4us (color, color, color, attrib->opacity);
+ glColor4us (color, color, color, attrib.getOpacity ());
w->drawGeometry ();
@@ -872,11 +873,11 @@ enableFragmentProgramAndDrawGeometry (CompWindow *w,
if (blending)
glDisable (GL_BLEND);
}
- else if (attrib->brightness != BRIGHT)
+ else if (attrib.getBrightness () != BRIGHT)
{
s->setTexEnvMode (GL_MODULATE);
- glColor4us (attrib->brightness, attrib->brightness,
- attrib->brightness, BRIGHT);
+ glColor4us (attrib.getBrightness (), attrib.getBrightness (),
+ attrib.getBrightness (), BRIGHT);
w->drawGeometry ();
@@ -890,7 +891,7 @@ enableFragmentProgramAndDrawGeometry (CompWindow *w,
texture->disable ();
- disableFragmentAttrib (s, &fa);
+ fa.disable (s);
return true;
}
@@ -898,13 +899,13 @@ enableFragmentProgramAndDrawGeometry (CompWindow *w,
static void
enableFragmentOperationsAndDrawGeometry (CompWindow *w,
CompTexture *texture,
- const FragmentAttrib *attrib,
+ CompFragment::Attrib &attrib,
CompTexture::Filter filter,
unsigned int mask)
{
CompScreen *s = w->screen ();
- if (s->canDoSaturated () && attrib->saturation != COLOR)
+ if (s->canDoSaturated () && attrib.getSaturation () != COLOR)
{
GLfloat constant[4];
@@ -941,7 +942,7 @@ enableFragmentOperationsAndDrawGeometry (CompWindow *w,
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
- if (s->canDoSlightlySaturated () && attrib->saturation > 0)
+ if (s->canDoSlightlySaturated () && attrib.getSaturation () > 0)
{
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
@@ -972,19 +973,20 @@ enableFragmentOperationsAndDrawGeometry (CompWindow *w,
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
- constant[3] = attrib->saturation / 65535.0f;
+ constant[3] = attrib.getSaturation () / 65535.0f;
glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
- if (attrib->opacity < OPAQUE || attrib->brightness != BRIGHT)
+ if (attrib.getOpacity () < OPAQUE ||
+ attrib.getBrightness () != BRIGHT)
{
s->activeTexture (GL_TEXTURE3_ARB);
texture->enable (filter);
- constant[3] = attrib->opacity / 65535.0f;
+ constant[3] = attrib.getOpacity () / 65535.0f;
constant[0] = constant[1] = constant[2] = constant[3] *
- attrib->brightness / 65535.0f;
+ attrib.getBrightness () / 65535.0f;
glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
@@ -1029,9 +1031,9 @@ enableFragmentOperationsAndDrawGeometry (CompWindow *w,
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
- constant[3] = attrib->opacity / 65535.0f;
+ constant[3] = attrib.getOpacity () / 65535.0f;
constant[0] = constant[1] = constant[2] = constant[3] *
- attrib->brightness / 65535.0f;
+ attrib.getBrightness ()/ 65535.0f;
constant[0] = 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0];
constant[1] = 0.5f + 0.5f * GREEN_SATURATION_WEIGHT * constant[1];
@@ -1063,14 +1065,15 @@ enableFragmentOperationsAndDrawGeometry (CompWindow *w,
if (mask & PAINT_WINDOW_BLEND_MASK)
{
glEnable (GL_BLEND);
- if (attrib->opacity != OPAQUE || attrib->brightness != BRIGHT)
+ if (attrib.getOpacity ()!= OPAQUE ||
+ attrib.getBrightness () != BRIGHT)
{
GLushort color;
- color = (attrib->opacity * attrib->brightness) >> 16;
+ color = (attrib.getOpacity () * attrib.getBrightness ()) >> 16;
s->setTexEnvMode (GL_MODULATE);
- glColor4us (color, color, color, attrib->opacity);
+ glColor4us (color, color, color, attrib.getOpacity ());
w->drawGeometry ();
@@ -1084,11 +1087,11 @@ enableFragmentOperationsAndDrawGeometry (CompWindow *w,
glDisable (GL_BLEND);
}
- else if (attrib->brightness != BRIGHT)
+ else if (attrib.getBrightness () != BRIGHT)
{
s->setTexEnvMode (GL_MODULATE);
- glColor4us (attrib->brightness, attrib->brightness,
- attrib->brightness, BRIGHT);
+ glColor4us (attrib.getBrightness (), attrib.getBrightness (),
+ attrib.getBrightness (), BRIGHT);
w->drawGeometry ();
@@ -1105,9 +1108,9 @@ enableFragmentOperationsAndDrawGeometry (CompWindow *w,
}
void
-CompWindow::drawTexture (CompTexture *texture,
- const FragmentAttrib *attrib,
- unsigned int mask)
+CompWindow::drawTexture (CompTexture *texture,
+ CompFragment::Attrib &attrib,
+ unsigned int mask)
{
WRAPABLE_HND_FUNC(drawTexture, texture, attrib, mask)
@@ -1119,8 +1122,8 @@ CompWindow::drawTexture (CompTexture *texture,
else
filter = priv->screen->filter (NOTHING_TRANS_FILTER);
- if ((!attrib->nFunction && (!priv->screen->lighting () ||
- attrib->saturation == COLOR || attrib->saturation == 0)) ||
+ if ((!attrib.hasFunctions () && (!priv->screen->lighting () ||
+ attrib.getSaturation () == COLOR || attrib.getSaturation () == 0)) ||
!enableFragmentProgramAndDrawGeometry (this,
texture,
attrib,
@@ -1137,7 +1140,7 @@ CompWindow::drawTexture (CompTexture *texture,
bool
CompWindow::draw (const CompTransform *transform,
- const FragmentAttrib *fragment,
+ CompFragment::Attrib &fragment,
Region region,
unsigned int mask)
{
@@ -1174,8 +1177,8 @@ CompWindow::paint (const WindowPaintAttrib *attrib,
{
WRAPABLE_HND_FUNC_RETURN(bool, paint, attrib, transform, region, mask)
- FragmentAttrib fragment;
- Bool status;
+ CompFragment::Attrib fragment (attrib);
+ bool status;
priv->lastPaint = *attrib;
@@ -1204,8 +1207,6 @@ CompWindow::paint (const WindowPaintAttrib *attrib,
if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
return true;
- initFragmentAttrib (&fragment, attrib);
-
if (mask & PAINT_WINDOW_TRANSFORMED_MASK ||
mask & PAINT_WINDOW_WITH_OFFSET_MASK)
{
@@ -1213,7 +1214,7 @@ CompWindow::paint (const WindowPaintAttrib *attrib,
glLoadMatrixf (transform->m);
}
- status = draw (transform, &fragment, region, mask);
+ status = draw (transform, fragment, region, mask);
if (mask & PAINT_WINDOW_TRANSFORMED_MASK ||
mask & PAINT_WINDOW_WITH_OFFSET_MASK)
diff --git a/src/privatefragment.h b/src/privatefragment.h
new file mode 100644
index 0000000..bab11bc
--- /dev/null
+++ b/src/privatefragment.h
@@ -0,0 +1,25 @@
+#ifndef _PRIVATEFRAGMENT_H
+#define _PRIVATEFRAGMENT_H
+
+#include <compfragment.h>
+
+namespace CompFragment {
+
+ class Function;
+ class Program;
+
+ class Storage {
+ public:
+ Storage ();
+ ~Storage ();
+
+ public:
+ int lastFunctionId;
+ std::vector<Function *> functions;
+ std::vector<Program *> programs;
+
+ FunctionId saturateFunction[2][64];
+ };
+};
+
+#endif
diff --git a/src/privatescreen.h b/src/privatescreen.h
index cc2b2d8..cab3277 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -6,6 +6,8 @@
#include <compsize.h>
#include <comppoint.h>
#include <comptexture.h>
+#include <compfragment.h>
+#include "privatefragment.h"
#define COMP_SCREEN_OPTION_DETECT_REFRESH_RATE 0
#define COMP_SCREEN_OPTION_LIGHTING 1
@@ -264,12 +266,7 @@ class PrivateScreen {
int timeLeft;
Bool pendingCommands;
- int lastFunctionId;
-
- CompFunction *fragmentFunctions;
- CompProgram *fragmentPrograms;
-
- int saturateFunction[2][64];
+ CompFragment::Storage fragmentStorage;
GLfloat projection[16];
diff --git a/src/screen.cpp b/src/screen.cpp
index a4a786c..e12b344 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -1479,9 +1479,7 @@ PrivateScreen::PrivateScreen (CompScreen *screen) :
idle (true),
timeLeft (0),
pendingCommands (true),
- lastFunctionId (0),
- fragmentFunctions (0),
- fragmentPrograms (0),
+ fragmentStorage (),
clearBuffers (true),
lighting (false),
slowAnimations (false),
@@ -1491,7 +1489,6 @@ PrivateScreen::PrivateScreen (CompScreen *screen) :
paintTimer (),
getProcAddress (0)
{
- memset (saturateFunction, 0, sizeof (saturateFunction));
memset (history, 0, sizeof (history));
gettimeofday (&lastRedraw, 0);
}
@@ -2325,13 +2322,6 @@ CompScreen::~CompScreen ()
if (priv->damage)
XDestroyRegion (priv->damage);
- /* XXX: Maybe we should free all fragment functions here? But
- the definition of CompFunction is private to fragment.c ... */
- for (i = 0; i < 2; i++)
- for (j = 0; j < 64; j++)
- if (priv->saturateFunction[i][j])
- destroyFragmentFunction (this, priv->saturateFunction[i][j]);
-
compFiniScreenOptions (this, priv->opt, COMP_SCREEN_OPTION_NUM);
delete priv;
@@ -4688,28 +4678,10 @@ CompScreen::filter (int filter)
return priv->filter[filter];
}
-CompFunction *&
-CompScreen::fragmentFunctions ()
-{
- return priv->fragmentFunctions;
-}
-
-CompProgram *&
-CompScreen::fragmentPrograms ()
-{
- return priv->fragmentPrograms;
-}
-
-int &
-CompScreen::lastFunctionId ()
-{
- return priv->lastFunctionId;
-}
-
-int &
-CompScreen::getSaturateFunction (int target, int param)
+CompFragment::Storage *
+CompScreen::fragmentStorage ()
{
- return priv->saturateFunction[target][param];
+ return &priv->fragmentStorage;
}
bool
diff --git a/src/string.cpp b/src/string.cpp
new file mode 100644
index 0000000..fdf71b3
--- /dev/null
+++ b/src/string.cpp
@@ -0,0 +1,56 @@
+#include <compiz-core.h>
+
+CompString compPrintf (const char *format, ...)
+{
+ va_list ap;
+ CompString rv;
+
+ va_start (ap, format);
+ rv = compPrintf(format, ap);
+ va_end (ap);
+
+ return rv;
+}
+
+CompString compPrintf (const char *format, va_list ap)
+{
+ va_list aq;
+ unsigned int size = strlen (format) + 1;
+ int n;
+ char *str;
+
+ if (!format)
+ return CompString ("");
+
+ str = new char[size];
+
+ if (!str)
+ return CompString ("");
+
+ while (1)
+ {
+ /* Try to print in the allocated space. */
+ va_copy (aq, ap);
+ n = vsnprintf (str, size, format, aq);
+ va_end (aq);
+
+ /* If that worked, leave the loop. */
+ if (n > -1 && n < (int) size)
+ break;
+
+ /* Else try again with more space. */
+ if (n > -1) /* glibc 2.1 */
+ size = n + 1; /* precisely what is needed */
+ else /* glibc 2.0 */
+ size++; /* one more than the old size */
+
+ delete str;
+ str = new char[size];
+
+ if (str)
+ {
+ return CompString ("");
+ }
+ }
+ return CompString ("");
+}
diff --git a/src/window.cpp b/src/window.cpp
index 3c1d656..45eab70 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -4180,9 +4180,9 @@ WindowInterface::paint (const WindowPaintAttrib *attrib,
bool
WindowInterface::draw (const CompTransform *transform,
- const FragmentAttrib *fragment,
- Region region,
- unsigned int mask)
+ CompFragment::Attrib &fragment,
+ Region region,
+ unsigned int mask)
WRAPABLE_DEF_FUNC_RETURN(draw, transform, fragment, region, mask)
void
@@ -4193,9 +4193,9 @@ WindowInterface::addGeometry (CompTexture::Matrix *matrix,
WRAPABLE_DEF_FUNC(addGeometry, matrix, nMatrix, region, clip)
void
-WindowInterface::drawTexture (CompTexture *texture,
- const FragmentAttrib *fragment,
- unsigned int mask)
+WindowInterface::drawTexture (CompTexture *texture,
+ CompFragment::Attrib &fragment,
+ unsigned int mask)
WRAPABLE_DEF_FUNC(drawTexture, texture, fragment, mask)
void