aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2012-07-18 12:54:48 -0700
committerPaul Berry <[email protected]>2012-07-26 10:38:05 -0700
commit284ad9c3b29a6d6f0bade050ea9e949d67967983 (patch)
tree7c50cc152a6be64a4e31fb5545a51ce41fd33873 /src/mesa/main
parente72f20641a6ea7875b6021aac13e778ada3b3d50 (diff)
mesa: Make more consistent use of _mesa_is_{user,winsys}_fbo()
A lot of code was still differentiating between between winsys and user fbos by testing the fbo's name against zero. This converts everything in core mesa, the state tracker, and src/mesa/program over to use _mesa_is_user_fbo() and _mesa_is_winsys_fbo(). Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.c8
-rw-r--r--src/mesa/main/drawpix.c4
-rw-r--r--src/mesa/main/framebuffer.c6
-rw-r--r--src/mesa/main/readpix.c4
4 files changed, 13 insertions, 9 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 41550f990a4..243053eeb29 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1456,8 +1456,8 @@ _mesa_make_current( struct gl_context *newCtx,
_glapi_set_dispatch(newCtx->CurrentDispatch);
if (drawBuffer && readBuffer) {
- ASSERT(drawBuffer->Name == 0);
- ASSERT(readBuffer->Name == 0);
+ ASSERT(_mesa_is_winsys_fbo(drawBuffer));
+ ASSERT(_mesa_is_winsys_fbo(readBuffer));
_mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer);
_mesa_reference_framebuffer(&newCtx->WinSysReadBuffer, readBuffer);
@@ -1465,7 +1465,7 @@ _mesa_make_current( struct gl_context *newCtx,
* Only set the context's Draw/ReadBuffer fields if they're NULL
* or not bound to a user-created FBO.
*/
- if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
+ if (!newCtx->DrawBuffer || _mesa_is_winsys_fbo(newCtx->DrawBuffer)) {
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
/* Update the FBO's list of drawbuffers/renderbuffers.
* For winsys FBOs this comes from the GL state (which may have
@@ -1473,7 +1473,7 @@ _mesa_make_current( struct gl_context *newCtx,
*/
_mesa_update_draw_buffers(newCtx);
}
- if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
+ if (!newCtx->ReadBuffer || _mesa_is_winsys_fbo(newCtx->ReadBuffer)) {
_mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
}
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 49b078289c8..bd9837fdd9a 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -36,6 +36,7 @@
#include "state.h"
#include "dispatch.h"
#include "glformats.h"
+#include "fbobject.h"
#if FEATURE_drawpix
@@ -240,7 +241,8 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
goto end;
}
- if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
+ if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
+ ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyPixels(multisample FBO)");
goto end;
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index f45ece6168b..13887f8f54b 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -347,7 +347,7 @@ _mesa_resizebuffers( struct gl_context *ctx )
GLuint newWidth, newHeight;
struct gl_framebuffer *buffer = ctx->WinSysDrawBuffer;
- assert(buffer->Name == 0);
+ assert(_mesa_is_winsys_fbo(buffer));
/* ask device driver for size of output buffer */
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
@@ -364,7 +364,7 @@ _mesa_resizebuffers( struct gl_context *ctx )
GLuint newWidth, newHeight;
struct gl_framebuffer *buffer = ctx->WinSysReadBuffer;
- assert(buffer->Name == 0);
+ assert(_mesa_is_winsys_fbo(buffer));
/* ask device driver for size of read buffer */
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
@@ -444,7 +444,7 @@ _mesa_update_draw_buffer_bounds(struct gl_context *ctx)
if (!buffer)
return;
- if (buffer->Name) {
+ if (_mesa_is_user_fbo(buffer)) {
/* user-created framebuffer size depends on the renderbuffers */
update_framebuffer_size(ctx, buffer);
}
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 82d99fd21c9..7ac87749738 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -37,6 +37,7 @@
#include "pbo.h"
#include "state.h"
#include "glformats.h"
+#include "fbobject.h"
/**
@@ -722,7 +723,8 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
+ if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
+ ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
return;
}