summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-01-09 17:56:55 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-01-09 17:56:55 +0000
commitc2901e4f4c7a626a99526ccbb70f89253805cbb4 (patch)
tree92a423cee6f2ca1cd2978a3a1c67f946c3cbcce6 /src/mesa/drivers
parent41b9756e9a2da55859581278e46da0e631866bc0 (diff)
only call xmesa_set_renderbuffer_funcs() when really necessary
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/x11/xm_dd.c88
-rw-r--r--src/mesa/drivers/x11/xmesaP.h6
2 files changed, 50 insertions, 44 deletions
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 931cdd28ab..e6f90d35bb 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;
}
}
}
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 5b9311ff87..afba40ae03 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -513,7 +513,7 @@ extern void xmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer,
extern void xmesa_init_driver_functions( XMesaVisual xmvisual,
struct dd_function_table *driver );
-extern void xmesa_update_state( GLcontext *ctx, GLuint new_state );
+extern void xmesa_update_state( GLcontext *ctx, GLbitfield new_state );
extern void
xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,