summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/buffers.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2000-12-26 05:09:27 +0000
committerKeith Whitwell <[email protected]>2000-12-26 05:09:27 +0000
commitcab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290 (patch)
tree45385bd755d8e3876c54b2b0113636f5ceb7976a /src/mesa/main/buffers.c
parentd1ff1f6798b003a820f5de9fad835ff352f31afe (diff)
Major rework of tnl module
New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges.
Diffstat (limited to 'src/mesa/main/buffers.c')
-rw-r--r--src/mesa/main/buffers.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index dc802d9e111..da1e6125c98 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,4 +1,4 @@
-/* $Id: buffers.c,v 1.20 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: buffers.c,v 1.21 2000/12/26 05:09:27 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,9 +49,14 @@ void
_mesa_ClearIndex( GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Color.ClearIndex == (GLuint)c)
+ return;
+
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClearIndex = (GLuint) c;
- ctx->NewState |= _NEW_COLOR;
if (!ctx->Visual.RGBAflag) {
/* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
@@ -65,14 +70,20 @@ void
_mesa_ClearColor( GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha )
{
+ GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearColor");
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- ctx->Color.ClearColor[0] = CLAMP( red, 0.0F, 1.0F );
- ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F );
- ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F );
- ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );
- ctx->NewState |= _NEW_COLOR;
+ tmp[0] = CLAMP( red, 0.0, 1.0 );
+ tmp[1] = CLAMP( green, 0.0, 1.0 );
+ tmp[2] = CLAMP( blue, 0.0, 1.0 );
+ tmp[3] = CLAMP( alpha, 0.0, 1.0 );
+
+ if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ COPY_4FV( ctx->Color.ClearColor, tmp );
if (ctx->Visual.RGBAflag) {
GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
@@ -92,7 +103,7 @@ void
_mesa_Clear( GLbitfield mask )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClear");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glClear 0x%x\n", mask);
@@ -149,7 +160,8 @@ void
_mesa_DrawBuffer( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawBuffer");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */
+
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glDrawBuffer %s\n", gl_lookup_enum_by_nr(mode));
@@ -301,7 +313,7 @@ void
_mesa_ReadBuffer( GLenum mode )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glReadBuffer");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glReadBuffer %s\n", gl_lookup_enum_by_nr(mode));