summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-02-18 09:40:38 -0700
committerBrian Paul <brianp@vmware.com>2010-02-18 09:40:38 -0700
commita61dce363929bbc3520f91cefa3ba15bbe31c5bd (patch)
treeaa27eae4b092d3e9d00e86a8b1ac11b90410dfb0 /src/mesa/swrast
parent196214bf2b677a83653d49f79d03752f29df44ec (diff)
swrast: fix left side clipping
Fixes bug 26623. Original patch was submitted by Mathias Frohlich and modified by Brian. (cherry picked from commit 7c34c237a2f6732b2c013543523617e375c1f534)
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_span.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 905cf3d550..85d30cc929 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -784,14 +784,47 @@ clip_span( GLcontext *ctx, SWspan *span )
* For arrays of values, shift them left.
*/
for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ if (span->interpMask & (1 << i)) {
+ GLuint j;
+ for (j = 0; j < 4; j++) {
+ span->attrStart[i][j] += leftClip * span->attrStepX[i][j];
+ }
+ }
+ }
+
+ span->red += leftClip * span->redStep;
+ span->green += leftClip * span->greenStep;
+ span->blue += leftClip * span->blueStep;
+ span->alpha += leftClip * span->alphaStep;
+ span->index += leftClip * span->indexStep;
+ span->z += leftClip * span->zStep;
+ span->intTex[0] += leftClip * span->intTexStep[0];
+ span->intTex[1] += leftClip * span->intTexStep[1];
+
+#define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \
+ memcpy(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
+
+ for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
if (span->arrayAttribs & (1 << i)) {
/* shift array elements left by 'leftClip' */
- _mesa_memcpy(span->array->attribs[i],
- span->array->attribs[i] + leftClip,
- (n - leftClip) * 4 * sizeof(GLfloat));
+ SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
}
}
+ SHIFT_ARRAY(span->array->mask, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba8, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba16, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->x, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->y, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->z, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->index, leftClip, n - leftClip);
+ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+ SHIFT_ARRAY(span->array->lambda[i], leftClip, n - leftClip);
+ }
+ SHIFT_ARRAY(span->array->coverage, leftClip, n - leftClip);
+
+#undef SHIFT_ARRAY
+
span->leftClip = leftClip;
span->x = xmin;
span->end -= leftClip;