From 47941bfaea6e8a60e2c31f7a2c8c233f2a10ecb1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Apr 2012 07:58:59 -0600 Subject: [PATCH] radeon: use _mesa_is_winsys/user_fbo() helpers Reviewed-by: Alex Deucher --- src/mesa/drivers/dri/r200/r200_state.c | 5 +++-- src/mesa/drivers/dri/radeon/radeon_common.c | 11 ++++++----- src/mesa/drivers/dri/radeon/radeon_pixel_read.c | 3 ++- src/mesa/drivers/dri/radeon/radeon_state.c | 5 +++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 3131007517b..0f7b564024e 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/colormac.h" #include "main/light.h" #include "main/framebuffer.h" +#include "main/fbobject.h" #include "swrast/swrast.h" #include "vbo/vbo.h" @@ -536,7 +537,7 @@ static void r200FrontFace( struct gl_context *ctx, GLenum mode ) rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_CULL_FRONT_IS_CCW; /* Winding is inverted when rendering to FBO */ - if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer)) mode = (mode == GL_CW) ? GL_CCW : GL_CW; switch ( mode ) { @@ -1547,7 +1548,7 @@ void r200UpdateWindow( struct gl_context *ctx ) GLfloat xoffset = 0; GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0; const GLfloat *v = ctx->Viewport._WindowMap.m; - const GLboolean render_to_fbo = (ctx->DrawBuffer ? (ctx->DrawBuffer->Name != 0) : 0); + const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0); const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat y_scale, y_bias; diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index b64ff8160d0..a8dfae01923 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/context.h" #include "main/enums.h" +#include "main/fbobject.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "drivers/common/meta.h" @@ -168,7 +169,7 @@ void radeonUpdateScissor( struct gl_context *ctx ) max_x = ctx->DrawBuffer->Width - 1; max_y = ctx->DrawBuffer->Height - 1; - if ( !ctx->DrawBuffer->Name ) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { x1 = x; y1 = ctx->DrawBuffer->Height - (y + h); x2 = x + w - 1; @@ -407,7 +408,7 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr( mode )); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); const GLboolean was_front_buffer_rendering = @@ -430,7 +431,7 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) { - if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { + if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { struct radeon_context *const rmesa = RADEON_CONTEXT(ctx); const GLboolean was_front_buffer_reading = rmesa->is_front_buffer_reading; rmesa->is_front_buffer_reading = (mode == GL_FRONT_LEFT) @@ -465,7 +466,7 @@ void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GL void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { if (radeon->is_front_buffer_rendering) { ctx->Driver.Flush(ctx); } @@ -656,7 +657,7 @@ void radeonFlush(struct gl_context *ctx) rcommonFlushCmdBuf(radeon, __FUNCTION__); flush_front: - if ((ctx->DrawBuffer->Name == 0) && radeon->front_buffer_dirty) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer) && radeon->front_buffer_dirty) { __DRIscreen *const screen = radeon->radeonScreen->driScreen; if (screen->dri2.loader && (screen->dri2.loader->base.version >= 2) diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c index 3a14cc69af4..db5e01da49b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c +++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c @@ -28,6 +28,7 @@ #include "stdint.h" #include "main/bufferobj.h" #include "main/enums.h" +#include "main/fbobject.h" #include "main/image.h" #include "main/readpix.h" #include "main/state.h" @@ -148,7 +149,7 @@ do_blit_readpixels(struct gl_context * ctx, } /* Disable source Y flipping for FBOs */ - flip_y = (ctx->ReadBuffer->Name == 0); + flip_y = _mesa_is_winsys_fbo(ctx->ReadBuffer); if (pack->Invert) { y = rrb->base.Base.Height - height - y; flip_y = !flip_y; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index a3b4e54edc4..6e2bb5bce62 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/light.h" #include "main/context.h" #include "main/framebuffer.h" +#include "main/fbobject.h" #include "main/simple_list.h" #include "main/state.h" @@ -444,7 +445,7 @@ static void radeonFrontFace( struct gl_context *ctx, GLenum mode ) rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_CULL_FRONT_IS_CCW; /* Winding is inverted when rendering to FBO */ - if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer)) mode = (mode == GL_CW) ? GL_CCW : GL_CW; switch ( mode ) { @@ -1354,7 +1355,7 @@ void radeonUpdateWindow( struct gl_context *ctx ) GLfloat xoffset = 0.0; GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0; const GLfloat *v = ctx->Viewport._WindowMap.m; - const GLboolean render_to_fbo = (ctx->DrawBuffer ? (ctx->DrawBuffer->Name != 0) : 0); + const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0); const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat y_scale, y_bias; -- 2.11.0