summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-03-01 02:02:43 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-03-01 02:02:43 +0000
commit9974540c73e0c6e03f2da46483e38363d62a2e7b (patch)
tree6e22a09baf11767d3b0619aa76554da4c9c18999 /src/mesa/main
parent2c61fdafd664ed10355577a8f26350297aa49444 (diff)
remove temporary tokens, more error checks for blit function
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/fbobject.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 3e425bd672..6aeca7b721 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -34,17 +34,11 @@
#include "framebuffer.h"
#include "hash.h"
#include "renderbuffer.h"
+#include "state.h"
#include "teximage.h"
#include "texstore.h"
-/* XXX temporarily here */
-#define GL_READ_FRAMEBUFFER_EXT 0x90
-#define GL_DRAW_FRAMEBUFFER_EXT 0x9a
-#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT
-#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x9b
-
-
/**
* Notes:
*
@@ -1527,6 +1521,14 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ if (!ctx->ReadBuffer) {
+ /* XXX */
+ }
+
/* check for complete framebuffers */
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT ||
ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -1535,11 +1537,8 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
return;
}
- /* depth/stencil must be blitted with nearest filtering */
- if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT))
- && filter != GL_NEAREST) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBlitFramebufferEXT(depth/stencil requires GL_NEAREST filter");
+ if (filter != GL_NEAREST && filter != GL_LINEAR) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(filter)");
return;
}
@@ -1550,6 +1549,34 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
return;
}
+ /* depth/stencil must be blitted with nearest filtering */
+ if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT))
+ && filter != GL_NEAREST) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebufferEXT(depth/stencil requires GL_NEAREST filter");
+ return;
+ }
+
+ if (mask & GL_STENCIL_BUFFER_BIT) {
+ struct gl_renderbuffer *readRb = ctx->ReadBuffer->_StencilBuffer;
+ struct gl_renderbuffer *drawRb = ctx->DrawBuffer->_StencilBuffer;
+ if (readRb->StencilBits != drawRb->StencilBits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebufferEXT(stencil buffer size mismatch");
+ return;
+ }
+ }
+
+ if (mask & GL_DEPTH_BUFFER_BIT) {
+ struct gl_renderbuffer *readRb = ctx->ReadBuffer->_DepthBuffer;
+ struct gl_renderbuffer *drawRb = ctx->DrawBuffer->_DepthBuffer;
+ if (readRb->DepthBits != drawRb->DepthBits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebufferEXT(depth buffer size mismatch");
+ return;
+ }
+ }
+
if (!ctx->Extensions.EXT_framebuffer_blit) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT");
return;