ilo: honor render condition in blitter
authorChia-I Wu <olvaffe@gmail.com>
Tue, 25 Jun 2013 07:36:15 +0000 (15:36 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 25 Jun 2013 07:38:07 +0000 (15:38 +0800)
Make pass_render_condition() available for blitter, and check for render
condition in (and only in) clear(), clear_render_target(), and
clear_depth_stencil().

src/gallium/drivers/ilo/ilo_3d.c
src/gallium/drivers/ilo/ilo_3d.h
src/gallium/drivers/ilo/ilo_blitter_blt.c
src/gallium/drivers/ilo/ilo_blitter_pipe.c

index 6223de98c0f7430fdd2b2a78bf76e5b78e1d8f82..9ce6b75f9782386ac2ea0821bba4f52119926b16 100644 (file)
@@ -426,9 +426,10 @@ update_prim_count(struct ilo_3d *hw3d, int generated, int emitted)
       q->data.u64 += emitted;
 }
 
-static bool
-pass_render_condition(struct ilo_3d *hw3d, struct pipe_context *pipe)
+bool
+ilo_3d_pass_render_condition(struct ilo_context *ilo)
 {
+   struct ilo_3d *hw3d = ilo->hw3d;
    uint64_t result;
    bool wait;
 
@@ -447,13 +448,11 @@ pass_render_condition(struct ilo_3d *hw3d, struct pipe_context *pipe)
       break;
    }
 
-   if (pipe->get_query_result(pipe, hw3d->render_condition.query,
-            wait, (union pipe_query_result *) &result)) {
+   if (ilo->base.get_query_result(&ilo->base, hw3d->render_condition.query,
+            wait, (union pipe_query_result *) &result))
       return (!result == hw3d->render_condition.cond);
-   }
-   else {
+   else
       return true;
-   }
 }
 
 #define UPDATE_MIN2(a, b) (a) = MIN2((a), (b))
@@ -698,7 +697,7 @@ ilo_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    struct ilo_3d *hw3d = ilo->hw3d;
    int prim_generated, prim_emitted;
 
-   if (!pass_render_condition(hw3d, pipe))
+   if (!ilo_3d_pass_render_condition(ilo))
       return;
 
    if (info->primitive_restart && info->indexed) {
index 2c86153c2cd161d01d5f2b3029bb0b4e28b8957a..f73b8177a4cf2542a29129a342267991ad863777 100644 (file)
@@ -82,6 +82,9 @@ ilo_3d_end_query(struct ilo_context *ilo, struct ilo_query *q);
 void
 ilo_3d_process_query(struct ilo_context *ilo, struct ilo_query *q);
 
+bool
+ilo_3d_pass_render_condition(struct ilo_context *ilo);
+
 void
 ilo_init_3d_functions(struct ilo_context *ilo);
 
index 55fc68b08c0db04718525129e6e3fc21fb6556d0..80c0dcc46d685ff99cf75fa9e9828385dafe78b8 100644 (file)
@@ -28,6 +28,7 @@
 #include "util/u_pack_color.h"
 #include "intel_reg.h"
 
+#include "ilo_3d.h"
 #include "ilo_context.h"
 #include "ilo_cp.h"
 #include "ilo_resource.h"
@@ -692,6 +693,9 @@ ilo_blitter_blt_clear_rt(struct ilo_blitter *blitter,
    union util_color packed;
    bool success;
 
+   if (!ilo_3d_pass_render_condition(blitter->ilo))
+      return true;
+
    switch (cpp) {
    case 1:
       mask = GEN6_BLT_MASK_8;
@@ -753,6 +757,9 @@ ilo_blitter_blt_clear_zs(struct ilo_blitter *blitter,
    struct pipe_box box;
    uint32_t val;
 
+   if (!ilo_3d_pass_render_condition(blitter->ilo))
+      return true;
+
    switch (zs->format) {
    case PIPE_FORMAT_Z16_UNORM:
       if (!(clear_flags & PIPE_CLEAR_DEPTH))
index e37231ac00b7209a33640a5029d2c46cfbe4f668..8ca8f08e466fa3bf34d60477a430f9c4eb11a874 100644 (file)
@@ -28,6 +28,7 @@
 #include "util/u_blitter.h"
 #include "util/u_surface.h"
 
+#include "ilo_3d.h"
 #include "ilo_context.h"
 #include "ilo_blitter.h"
 
@@ -67,6 +68,11 @@ ilo_blitter_pipe_begin(struct ilo_blitter *blitter,
       util_blitter_save_rasterizer(b, (void *) ilo->rasterizer);
       util_blitter_save_framebuffer(b, &ilo->fb.state);
 
+      util_blitter_save_render_condition(b,
+            ilo->hw3d->render_condition.query,
+            ilo->hw3d->render_condition.cond,
+            ilo->hw3d->render_condition.mode);
+
       util_blitter_save_fragment_sampler_states(b,
             ilo->sampler[PIPE_SHADER_FRAGMENT].count,
             (void **) ilo->sampler[PIPE_SHADER_FRAGMENT].cso);