From d9f31f16c059a900e4c28bbd8692fb44b7c1b0b3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Mar 2006 17:47:05 +0000 Subject: [PATCH] sync with trunk --- src/mesa/main/fbobject.c | 58 +++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9b1f9b67624..8c428f8a259 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2,7 +2,7 @@ * Mesa 3-D graphics library * Version: 6.5 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -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: * @@ -1386,6 +1380,11 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, assert(ctx->Driver.FramebufferRenderbuffer); ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb); + + /* Some subsequent GL commands may depend on the framebuffer's visual + * after the binding is updated. Update visual info now. + */ + _mesa_update_framebuffer_visual(fb); } @@ -1534,6 +1533,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) { @@ -1542,6 +1549,18 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, return; } + if (filter != GL_NEAREST && filter != GL_LINEAR) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(filter)"); + return; + } + + if (mask & ~(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT)) { + _mesa_error( ctx, GL_INVALID_VALUE, "glBlitFramebufferEXT(mask)"); + return; + } + /* depth/stencil must be blitted with nearest filtering */ if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) && filter != GL_NEAREST) { @@ -1550,11 +1569,24 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, return; } - if (mask & ~(GL_COLOR_BUFFER_BIT | - GL_DEPTH_BUFFER_BIT | - GL_STENCIL_BUFFER_BIT)) { - _mesa_error( ctx, GL_INVALID_VALUE, "glBlitFramebufferEXT(mask)"); - 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) {