mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 19:40:10 +01:00
swrast: be a bit smarter in clip_span()
If no pixels pass the clip test, return false.
This commit is contained in:
parent
bc4ef33108
commit
718cbe4ba9
1 changed files with 4 additions and 1 deletions
|
|
@ -707,11 +707,13 @@ clip_span( struct gl_context *ctx, SWspan *span )
|
|||
const GLint n = span->end;
|
||||
GLubyte *mask = span->array->mask;
|
||||
GLint i;
|
||||
GLuint passed = 0;
|
||||
if (span->arrayMask & SPAN_MASK) {
|
||||
/* note: using & intead of && to reduce branches */
|
||||
for (i = 0; i < n; i++) {
|
||||
mask[i] &= (x[i] >= xmin) & (x[i] < xmax)
|
||||
& (y[i] >= ymin) & (y[i] < ymax);
|
||||
passed += mask[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -719,9 +721,10 @@ clip_span( struct gl_context *ctx, SWspan *span )
|
|||
for (i = 0; i < n; i++) {
|
||||
mask[i] = (x[i] >= xmin) & (x[i] < xmax)
|
||||
& (y[i] >= ymin) & (y[i] < ymax);
|
||||
passed += mask[i];
|
||||
}
|
||||
}
|
||||
return GL_TRUE; /* some pixels visible */
|
||||
return passed > 0;
|
||||
}
|
||||
else {
|
||||
/* horizontal span of pixels */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue