summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/drawpix.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 6682b5e725c..ec8a45cb94e 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -27,6 +27,7 @@
#include "bufferobj.h"
#include "context.h"
#include "drawpix.h"
+#include "enums.h"
#include "feedback.h"
#include "framebuffer.h"
#include "image.h"
@@ -62,7 +63,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
}
if (_mesa_error_check_format_type(ctx, format, type, GL_TRUE)) {
- /* found an error */
+ /* the error was already recorded */
return;
}
@@ -73,7 +74,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
}
if (!ctx->Current.RasterPosValid) {
- return;
+ return; /* no-op, not an error */
}
if (ctx->RenderMode == GL_RENDER) {
@@ -126,6 +127,17 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ if (width < 0 || height < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glCopyPixels(width or height < 0)");
+ return;
+ }
+
+ if (type != GL_COLOR && type != GL_DEPTH && type != GL_STENCIL) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCopyPixels(type=%s)",
+ _mesa_lookup_enum_by_nr(type));
+ return;
+ }
+
if (ctx->NewState) {
_mesa_update_state(ctx);
}
@@ -136,11 +148,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
return;
}
- if (width < 0 || height < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glCopyPixels(width or height < 0)");
- return;
- }
-
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT ||
ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
@@ -156,7 +163,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
}
if (!ctx->Current.RasterPosValid || width ==0 || height == 0) {
- return;
+ return; /* no-op, not an error */
}
if (ctx->RenderMode == GL_RENDER) {