mesa: fix some minor texstore comments
[mesa.git] / src / mesa / main / drawpix.c
index df4712de894622416c442cd8913a9e7c4cc9addb..412cc15af4e85d2f1b1215b1278f3f6858b05d18 100644 (file)
@@ -31,6 +31,7 @@
 #include "feedback.h"
 #include "framebuffer.h"
 #include "mfeatures.h"
+#include "pbo.h"
 #include "readpix.h"
 #include "state.h"
 #include "dispatch.h"
@@ -61,7 +62,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
 
 
    if (width < 0 || height < 0) {
-      _mesa_error( ctx, GL_INVALID_VALUE, "glDrawPixels(width or height < 0" );
+      _mesa_error( ctx, GL_INVALID_VALUE, "glDrawPixels(width or height < 0)" );
       return;
    }
 
@@ -79,6 +80,10 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
       goto end;      /* the error code was recorded */
    }
 
+   if (ctx->TransformFeedback.RasterDiscard) {
+      goto end;
+   }
+
    if (!ctx->Current.RasterPosValid) {
       goto end;  /* no-op, not an error */
    }
@@ -89,10 +94,10 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
          GLint x = IROUND(ctx->Current.RasterPos[0]);
          GLint y = IROUND(ctx->Current.RasterPos[1]);
 
-         if (ctx->Unpack.BufferObj->Name) {
+         if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
             /* unpack from PBO */
-            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
-                                           format, type, pixels)) {
+            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height,
+                                           1, format, type, INT_MAX, pixels)) {
                _mesa_error(ctx, GL_INVALID_OPERATION,
                            "glDrawPixels(invalid PBO access)");
                goto end;
@@ -135,8 +140,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   _mesa_finish(ctx);
-
    if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx,
                   "glCopyPixels(%d, %d, %d, %d, %s) // from %s to %s at %d, %d\n",
@@ -189,7 +192,11 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
       goto end;
    }
 
-   if (!ctx->Current.RasterPosValid || width ==0 || height == 0) {
+   if (ctx->TransformFeedback.RasterDiscard) {
+      goto end;
+   }
+
+   if (!ctx->Current.RasterPosValid || width == 0 || height == 0) {
       goto end; /* no-op, not an error */
    }
 
@@ -243,6 +250,9 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
       return;
    }
 
+   if (ctx->TransformFeedback.RasterDiscard)
+      return;
+
    if (ctx->RenderMode == GL_RENDER) {
       /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */
       if (width > 0 && height > 0) {
@@ -250,11 +260,11 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
          GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig);
          GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig);
 
-         if (ctx->Unpack.BufferObj->Name) {
+         if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
             /* unpack from PBO */
-            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
-                                           GL_COLOR_INDEX, GL_BITMAP,
-                                           (GLvoid *) bitmap)) {
+            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height,
+                                           1, GL_COLOR_INDEX, GL_BITMAP,
+                                           INT_MAX, (const GLvoid *) bitmap)) {
                _mesa_error(ctx, GL_INVALID_OPERATION,
                            "glBitmap(invalid PBO access)");
                return;