From b7c646d1bcf4b6fa285996d1b9b660ce478190f6 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 20 Jun 2007 13:10:48 -0600 Subject: actually use new glClear code --- src/mesa/drivers/x11/xm_dd.c | 12 ++++++++++++ src/mesa/pipe/softpipe/sp_clear.c | 10 +++++----- src/mesa/state_tracker/st_draw.c | 14 ++++++++++++++ src/mesa/state_tracker/st_draw.h | 4 ++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index eb59d1d05e..5725414856 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -55,6 +55,8 @@ #include "pipe/softpipe/sp_context.h" #include "state_tracker/st_public.h" +#include "state_tracker/st_context.h" +#include "state_tracker/st_draw.h" /* @@ -393,6 +395,7 @@ clear_buffers(GLcontext *ctx, GLbitfield buffers) /* we can't handle color or index masking */ if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) { +#if 0 if (buffers & BUFFER_BIT_FRONT_LEFT) { /* clear front color buffer */ struct gl_renderbuffer *frontRb @@ -416,6 +419,15 @@ clear_buffers(GLcontext *ctx, GLbitfield buffers) buffers &= ~BUFFER_BIT_BACK_LEFT; } } +#else + /* Clear with state-tracker/pipe interface */ + struct st_context *st = st_context(ctx); + GLboolean color = (buffers & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) ? 1: 0; + GLboolean depth = (buffers & BUFFER_BIT_DEPTH) ? 1 : 0; + GLboolean stencil = (buffers & BUFFER_BIT_STENCIL) ? 1 : 0; + GLboolean accum = (buffers & BUFFER_BIT_ACCUM) ? 1 : 0; + st_clear(st, color, depth, stencil, accum); +#endif } } if (buffers) diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c index 536f0d3924..e83bc053ef 100644 --- a/src/mesa/pipe/softpipe/sp_clear.c +++ b/src/mesa/pipe/softpipe/sp_clear.c @@ -40,14 +40,14 @@ void softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, GLboolean stencil, GLboolean accum) { - struct softpipe_context *softpipe = softpipe_context(pipe); + const struct softpipe_context *softpipe = softpipe_context(pipe); + const GLint x = softpipe->scissor.minx; + const GLint y = softpipe->scissor.miny; + const GLint w = softpipe->scissor.maxx - x; + const GLint h = softpipe->scissor.maxy - y; if (color) { GLuint i; - const GLint x = softpipe->scissor.minx; - const GLint y = softpipe->scissor.miny; - const GLint w = softpipe->scissor.maxx - x; - const GLint h = softpipe->scissor.maxy - y; GLubyte clr[4]; UNCLAMPED_FLOAT_TO_UBYTE(clr[0], softpipe->clear_color.color[0]); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 1f6c261bc2..55b98629db 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -105,3 +105,17 @@ void st_destroy_draw( struct st_context *st ) /* Nothing to do. */ } + + +/** XXX temporary here */ +void +st_clear(struct st_context *st, GLboolean color, GLboolean depth, + GLboolean stencil, GLboolean accum) +{ + /* Validate driver and pipe state: + */ + st_validate_state( st ); + + st->pipe->clear(st->pipe, color, depth, stencil, accum); +} + diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h index f51059706a..7a3ba52130 100644 --- a/src/mesa/state_tracker/st_draw.h +++ b/src/mesa/state_tracker/st_draw.h @@ -37,4 +37,8 @@ void st_init_draw( struct st_context *st ); void st_destroy_draw( struct st_context *st ); +/** XXX temporary here */ +void st_clear(struct st_context *st, GLboolean color, GLboolean depth, + GLboolean stencil, GLboolean accum); + #endif -- cgit v1.2.3