intel: Make a wrapper for intelEmitCopyBlit using miptrees.
[mesa.git] / src / mesa / drivers / dri / intel / intel_pixel_bitmap.c
index 6821b69f0fc6b71a30e8cdef756c6b212210b931..c538a29571aa4b47b0dc5cf5bb7cfd9eacfad549 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;
@@ -258,14 +259,15 @@ do_blit_bitmap( struct gl_context *ctx,
          * Have to translate destination coordinates back into source
          * coordinates.
          */
-        if (get_bitmap_rect(bitmap_width, bitmap_height, unpack,
-                            bitmap,
-                            -orig_dstx + (dstx + px),
-                            -orig_dsty + y_flip(fb, dsty + py, h),
-                            w, h,
-                            (GLubyte *)stipple,
-                            8,
-                            fb->Name == 0 ? true : false) == 0)
+         int count = get_bitmap_rect(bitmap_width, bitmap_height, unpack,
+                                     bitmap,
+                                     -orig_dstx + (dstx + px),
+                                     -orig_dsty + y_flip(fb, dsty + py, h),
+                                     w, h,
+                                     (GLubyte *)stipple,
+                                     8,
+                                     _mesa_is_winsys_fbo(fb));
+         if (count == 0)
            continue;
 
         if (!intelEmitImmediateColorExpandBlit(intel,
@@ -283,6 +285,9 @@ do_blit_bitmap( struct gl_context *ctx,
                                                logic_op)) {
            return false;
         }
+
+         if (ctx->Query.CurrentOcclusionObject)
+            ctx->Query.CurrentOcclusionObject->Result += count;
       }
    }
 out:
@@ -328,8 +333,6 @@ intelBitmap(struct gl_context * ctx,
            const struct gl_pixelstore_attrib *unpack,
            const GLubyte * pixels)
 {
-   struct intel_context *intel = intel_context(ctx);
-
    if (!_mesa_check_conditional_render(ctx))
       return;