summaryrefslogtreecommitdiff
path: root/src/fragment.c
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2007-01-10 07:45:00 +0100
committerDavid Reveman <davidr@novell.com>2007-01-10 07:45:00 +0100
commit6d4650de3e5a874fd674d0c9199ee98da6519231 (patch)
tree5462728dbfec4de9acbd9f150a869022551a2558 /src/fragment.c
parent9001e1e2a6042cee0654e9780e85338b3e0d8413 (diff)
Keep track of temporary texcoord variables at all index levels to make
sure we don't add duplicate variable names. Pass the correct offset variable to next index level.
Diffstat (limited to 'src/fragment.c')
-rw-r--r--src/fragment.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/fragment.c b/src/fragment.c
index 11117278..29867c00 100644
--- a/src/fragment.c
+++ b/src/fragment.c
@@ -119,7 +119,7 @@ struct _CompFunction {
};
typedef struct _FetchInfo {
- int index;
+ int indices[MAX_FRAGMENT_FUNCTIONS];
char *data;
} FetchInfo;
@@ -268,9 +268,15 @@ forEachDataOpInFunction (CompFunction **list,
dataOp.data = data;
(*callBack) (&dataOp, index, closure);
- }
- offset = f->data[type].body[i].fetch.offset;
+ snprintf (data, 256, "__tmp_texcoord%d", index);
+
+ offset = data;
+ }
+ else
+ {
+ offset = f->data[type].body[i].fetch.offset;
+ }
}
forEachDataOpInFunction (list, index - 1, type,
@@ -495,7 +501,7 @@ addFetchOffsetVariables (CompDataOp *op,
{
FetchInfo *info = (FetchInfo *) closure;
- if (info->index != index)
+ if (!info->indices[index])
{
char *str;
int oldSize = strlen (info->data);
@@ -513,7 +519,7 @@ addFetchOffsetVariables (CompDataOp *op,
info->data = str;
}
- info->index = index;
+ info->indices[index] = TRUE;
}
}
}
@@ -606,8 +612,9 @@ buildFragmentProgram (CompScreen *s,
type = functionMaskToType (mask);
- info.data = strdup ("!!ARBfp1.0");
- info.index = -1;
+ info.data = strdup ("!!ARBfp1.0");
+
+ memset (info.indices, 0, sizeof (info.indices));
forEachDataOp (functionList, nFunctionList, type,
addFetchOffsetVariables, (void *) &info);