Return as soon as we find an existing color channel that's enabled for
writing. Typically, this allows us to return true on the first loop
iteration intead of doing four iterations.
No piglit regressions.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
{
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[idx];
GLuint c;
- GLubyte colorMask = 0;
if (rb) {
for (c = 0; c < 4; c++) {
- if (_mesa_format_has_color_component(rb->Format, c))
- colorMask |= ctx->Color.ColorMask[idx][c];
+ if (ctx->Color.ColorMask[idx][c] &&
+ _mesa_format_has_color_component(rb->Format, c)) {
+ return true;
+ }
}
}
- return colorMask != 0;
+ return false;
}