nouveau: unbreak nv40
[mesa.git] / src / mesa / main / buffers.c
index 28fbc34ff7815e13c0a7748e98adc16f9ad0c906..0e3ed155841ecb68e1091fb7b54e9d5504e51186 100644 (file)
@@ -1,11 +1,6 @@
-/**
- * \file buffers.c
- * Frame buffer management.
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  6.5.2
  *
  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
  */
 
 
+/**
+ * \file buffers.c
+ * General framebuffer-related functions, like glClear, glScissor, etc.
+ */
+
+
+
 #include "glheader.h"
 #include "buffers.h"
 #include "colormac.h"
@@ -139,10 +141,6 @@ _mesa_Clear( GLbitfield mask )
    }
 
    if (ctx->RenderMode == GL_RENDER) {
-      const GLint x = ctx->DrawBuffer->_Xmin;
-      const GLint y = ctx->DrawBuffer->_Ymin;
-      const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
-      const GLint width  = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
       GLbitfield bufferMask;
 
       /* don't clear depth buffer if depth writing disabled */
@@ -175,8 +173,7 @@ _mesa_Clear( GLbitfield mask )
       }
 
       ASSERT(ctx->Driver.Clear);
-      ctx->Driver.Clear( ctx, bufferMask, (GLboolean) !ctx->Scissor.Enabled,
-                        x, y, width, height );
+      ctx->Driver.Clear(ctx, bufferMask);
    }
 }
 
@@ -460,16 +457,14 @@ set_color_output(GLcontext *ctx, GLuint output, GLenum buffer,
 
    ASSERT(output < ctx->Const.MaxDrawBuffers);
 
+   /* Set per-FBO state */
    fb->ColorDrawBuffer[output] = buffer;
    fb->_ColorDrawBufferMask[output] = destMask;
-
-   if (fb->Name == 0) {
-      /* Set traditional state var */
-      ctx->Color.DrawBuffer[output] = buffer;
-   }
-
    /* not really needed, will be set later */
    fb->_NumColorDrawBuffers[output] = 0;
+
+   /* Set traditional state var */
+   ctx->Color.DrawBuffer[output] = buffer;
 }
 
 
@@ -583,6 +578,9 @@ _mesa_ReadBuffer(GLenum buffer)
 #if _HAVE_FULL_GL
 
 /**
+ * XXX THIS IS OBSOLETE - drivers should take care of detecting window
+ * size changes and act accordingly, likely calling _mesa_resize_framebuffer().
+ *
  * GL_MESA_resize_buffers extension.
  *
  * When this function is called, we'll ask the window system how large
@@ -593,16 +591,18 @@ _mesa_ReadBuffer(GLenum buffer)
  * \note This function should only be called through the GL API, not
  * from device drivers (as was done in the past).
  */
-void GLAPIENTRY
-_mesa_ResizeBuffersMESA( void )
-{
-   GET_CURRENT_CONTEXT(ctx);
 
+void _mesa_resizebuffers( GLcontext *ctx )
+{
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
 
    if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glResizeBuffersMESA\n");
 
+   if (!ctx->Driver.GetBufferSize) {
+      return;
+   }
+
    if (ctx->WinSysDrawBuffer) {
       GLuint newWidth, newHeight;
       GLframebuffer *buffer = ctx->WinSysDrawBuffer;
@@ -640,6 +640,19 @@ _mesa_ResizeBuffersMESA( void )
 }
 
 
+/*
+ * XXX THIS IS OBSOLETE
+ */
+void GLAPIENTRY
+_mesa_ResizeBuffersMESA( void )
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (ctx->Extensions.MESA_resize_buffers)
+      _mesa_resizebuffers( ctx );
+}
+
+
 /*
  * XXX move somewhere else someday?
  */