radeon: use _mesa_is_winsys/user_fbo() helpers

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Brian Paul 2012-04-20 07:58:59 -06:00
parent ff10dbf35f
commit 47941bfaea
4 changed files with 14 additions and 10 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;