intel: Make more consistent use of _mesa_is_{user,winsys}_fbo()
authorPaul Berry <stereotype441@gmail.com>
Wed, 18 Jul 2012 19:54:48 +0000 (12:54 -0700)
committerPaul Berry <stereotype441@gmail.com>
Thu, 26 Jul 2012 17:48:36 +0000 (10:48 -0700)
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>
src/mesa/drivers/dri/i915/i830_vtbl.c
src/mesa/drivers/dri/i915/intel_tris.c
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
src/mesa/drivers/dri/intel/intel_blit.c
src/mesa/drivers/dri/intel/intel_buffers.c
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
src/mesa/drivers/dri/intel/intel_pixel_copy.c
src/mesa/drivers/dri/intel/intel_tex_copy.c

index 28e95d97cc3fb8512001777f3417f19eeb72e434..6019852bf6c9b7c7c73ff421910d78a705967fd4 100644 (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);
index cf67d7430048c72e3b80b274da4bc63d58f5f99a..5954b24fe5a2bb149ee2069701fb617dad2223da 100644 (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];
index f8b7e4add8fb9a9a36d2c90c5704a31439274cd2..bd156327463233a2fba450b67e815569e8dd6296 100644 (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;
index fd4a86c4e72ececd93b7fbfe46447dfa7a98797a..36a2c6aadac797bc1d03bcb82c286a1da842aad7 100644 (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;
index 2b0276327d20342ca8ad1b668494063fe499eff0..9a9a259c9e56f27abf98cb6e7892110f6b597687 100644 (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) {
index ac7d6c11665e1232be4714eaa6496be83e7bb4af..a53985b189354d9441fc1636268921ced627f992 100644 (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;
    }
 
index 769738c0ec2abb776ba41a2adfabea85e0bb17e3..954dfc50b141b325443cd76944189699f3d2c3f0 100644 (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,
index 18a807508b3e4496ce43fed06b3389c80565f136..682a52d97d2e9a58c5520f0f09b926bc7de3b1c8 100644 (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;
    }
index 0798cec8f3c54dde8fee87a6448532625aa9bb35..6da4ec6da3e91c4b8e30c3b6e90fe97832fd6f54 100644 (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;