intel: 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 the i915 and 965 drivers over to use _mesa_is_user_fbo()
and _mesa_is_winsys_fbo().

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Paul Berry
2012-07-18 12:54:48 -07:00
parent 284ad9c3b2
commit c738ea1191
9 changed files with 19 additions and 12 deletions

View File

@@ -39,6 +39,7 @@
#include "swrast_setup/swrast_setup.h"
#include "main/renderbuffer.h"
#include "main/framebuffer.h"
#include "main/fbobject.h"
#define FILE_DEBUG_FLAG DEBUG_STATE
@@ -769,7 +770,7 @@ i830_update_draw_buffer(struct intel_context *intel)
/* Get the intel_renderbuffer for the single colorbuffer we're drawing
* into.
*/
if (fb->Name == 0) {
if (_mesa_is_winsys_fbo(fb)) {
/* drawing to window system buffer */
if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);

View File

@@ -38,6 +38,7 @@
#include "main/texobj.h"
#include "main/state.h"
#include "main/dd.h"
#include "main/fbobject.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -503,7 +504,7 @@ intel_emit_fragcoord(struct intel_context *intel, intelVertexPtr v)
fragcoord[0] = vertex_position[0];
if (fb->Name)
if (_mesa_is_user_fbo(fb))
fragcoord[1] = vertex_position[1];
else
fragcoord[1] = fb->Height - vertex_position[1];

View File

@@ -22,6 +22,7 @@
*/
#include "main/teximage.h"
#include "main/fbobject.h"
#include "glsl/ralloc.h"
@@ -214,13 +215,13 @@ try_blorp_blit(struct intel_context *intel,
/* Account for the fact that in the system framebuffer, the origin is at
* the lower left.
*/
if (read_fb->Name == 0) {
if (_mesa_is_winsys_fbo(read_fb)) {
GLint tmp = read_fb->Height - srcY0;
srcY0 = read_fb->Height - srcY1;
srcY1 = tmp;
mirror_y = !mirror_y;
}
if (draw_fb->Name == 0) {
if (_mesa_is_winsys_fbo(draw_fb)) {
GLint tmp = draw_fb->Height - dstY0;
dstY0 = draw_fb->Height - dstY1;
dstY1 = tmp;

View File

@@ -30,6 +30,7 @@
#include "main/context.h"
#include "main/enums.h"
#include "main/colormac.h"
#include "main/fbobject.h"
#include "intel_blit.h"
#include "intel_buffers.h"
@@ -248,7 +249,7 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
}
cx = fb->_Xmin;
if (fb->Name == 0)
if (_mesa_is_winsys_fbo(fb))
cy = ctx->DrawBuffer->Height - fb->_Ymax;
else
cy = fb->_Ymin;

View File

@@ -70,7 +70,7 @@ void
intel_check_front_buffer_rendering(struct intel_context *intel)
{
const struct gl_framebuffer *fb = intel->ctx.DrawBuffer;
if (fb->Name == 0) {
if (_mesa_is_winsys_fbo(fb)) {
/* drawing to window system buffer */
if (fb->_NumColorDrawBuffers > 0) {
if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {

View File

@@ -359,7 +359,7 @@ intel_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
fb->Initialized = true; /* XXX remove someday */
if (fb->Name != 0) {
if (_mesa_is_user_fbo(fb)) {
return;
}

View File

@@ -37,6 +37,7 @@
#include "main/state.h"
#include "main/texobj.h"
#include "main/context.h"
#include "main/fbobject.h"
#include "swrast/swrast.h"
#include "drivers/common/meta.h"
@@ -158,7 +159,7 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height,
static INLINE int
y_flip(struct gl_framebuffer *fb, int y, int height)
{
if (fb->Name != 0)
if (_mesa_is_user_fbo(fb))
return y;
else
return fb->Height - y - height;
@@ -265,7 +266,7 @@ do_blit_bitmap( struct gl_context *ctx,
w, h,
(GLubyte *)stipple,
8,
fb->Name == 0 ? true : false) == 0)
_mesa_is_winsys_fbo(fb)) == 0)
continue;
if (!intelEmitImmediateColorExpandBlit(intel,

View File

@@ -30,6 +30,7 @@
#include "main/state.h"
#include "main/mtypes.h"
#include "main/condrender.h"
#include "main/fbobject.h"
#include "drivers/common/meta.h"
#include "intel_context.h"
@@ -175,14 +176,14 @@ do_blit_copypixels(struct gl_context * ctx,
dsty += srcy - orig_srcy;
/* Flip dest Y if it's a window system framebuffer. */
if (fb->Name == 0) {
if (_mesa_is_winsys_fbo(fb)) {
/* copypixels to a window system framebuffer */
dsty = fb->Height - dsty - height;
flip = !flip;
}
/* Flip source Y if it's a window system framebuffer. */
if (read_fb->Name == 0) {
if (_mesa_is_winsys_fbo(read_fb)) {
srcy = read_fb->Height - srcy - height;
flip = !flip;
}

View File

@@ -30,6 +30,7 @@
#include "main/image.h"
#include "main/teximage.h"
#include "main/texstate.h"
#include "main/fbobject.h"
#include "drivers/common/meta.h"
@@ -108,7 +109,7 @@ intel_copy_texsubimage(struct intel_context *intel,
return false;
}
if (ctx->ReadBuffer->Name == 0) {
if (_mesa_is_winsys_fbo(ctx->ReadBuffer)) {
/* Flip vertical orientation for system framebuffers */
y = ctx->ReadBuffer->Height - (y + height);
src_pitch = -region->pitch;