diff options
Diffstat (limited to 'src/mesa/drivers/x11/xm_dd.c')
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 88 |
1 files changed, 47 insertions, 41 deletions
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 931cdd2..e6f90d3 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -968,14 +968,13 @@ clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) /** - * Called when the driver should update it's state, based on the new_state + * Called when the driver should update its state, based on the new_state * flags. */ void -xmesa_update_state( GLcontext *ctx, GLuint new_state ) +xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); - struct xmesa_renderbuffer *front_xrb, *back_xrb; /* Propagate statechange information to swrast and swrast_setup * modules. The X11 driver has no internal GL-dependent state. @@ -988,48 +987,55 @@ xmesa_update_state( GLcontext *ctx, GLuint new_state ) if (ctx->DrawBuffer->Name != 0) return; - front_xrb = XMESA_BUFFER(ctx->DrawBuffer)->frontxrb; - if (front_xrb) { - /* XXX check for relevant new_state flags */ - xmesa_set_renderbuffer_funcs(front_xrb, xmesa->pixelformat, - xmesa->xm_visual->BitsPerPixel); - /* setup pointers to front and back buffer clear functions */ - front_xrb->clearFunc = clear_pixmap; - } + /* + * GL_DITHER and GL_READ/DRAW_BUFFER state effect renderbuffer funcs + */ + if (new_state & (_NEW_COLOR | _NEW_PIXEL)) { + struct xmesa_renderbuffer *front_xrb, *back_xrb; + + front_xrb = XMESA_BUFFER(ctx->DrawBuffer)->frontxrb; + if (front_xrb) { + /* XXX check for relevant new_state flags */ + xmesa_set_renderbuffer_funcs(front_xrb, xmesa->pixelformat, + xmesa->xm_visual->BitsPerPixel); + /* setup pointers to front and back buffer clear functions */ + front_xrb->clearFunc = clear_pixmap; + } - back_xrb = XMESA_BUFFER(ctx->DrawBuffer)->backxrb; - if (back_xrb) { - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + back_xrb = XMESA_BUFFER(ctx->DrawBuffer)->backxrb; + if (back_xrb) { + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - /* XXX check for relevant new_state flags */ - xmesa_set_renderbuffer_funcs(back_xrb, xmesa->pixelformat, - xmesa->xm_visual->BitsPerPixel); + /* XXX check for relevant new_state flags */ + xmesa_set_renderbuffer_funcs(back_xrb, xmesa->pixelformat, + xmesa->xm_visual->BitsPerPixel); - if (xmbuf->backxrb->pixmap) { - back_xrb->clearFunc = clear_pixmap; - } - else { - switch (xmesa->xm_visual->BitsPerPixel) { - case 8: - if (xmesa->xm_visual->hpcr_clear_flag) { - back_xrb->clearFunc = clear_HPCR_ximage; - } - else { - back_xrb->clearFunc = clear_8bit_ximage; + if (xmbuf->backxrb->pixmap) { + back_xrb->clearFunc = clear_pixmap; + } + else { + switch (xmesa->xm_visual->BitsPerPixel) { + case 8: + if (xmesa->xm_visual->hpcr_clear_flag) { + back_xrb->clearFunc = clear_HPCR_ximage; + } + else { + back_xrb->clearFunc = clear_8bit_ximage; + } + break; + case 16: + back_xrb->clearFunc = clear_16bit_ximage; + break; + case 24: + back_xrb->clearFunc = clear_24bit_ximage; + break; + case 32: + back_xrb->clearFunc = clear_32bit_ximage; + break; + default: + back_xrb->clearFunc = clear_nbit_ximage; + break; } - break; - case 16: - back_xrb->clearFunc = clear_16bit_ximage; - break; - case 24: - back_xrb->clearFunc = clear_24bit_ximage; - break; - case 32: - back_xrb->clearFunc = clear_32bit_ximage; - break; - default: - back_xrb->clearFunc = clear_nbit_ximage; - break; } } } |