i965: Drop a layer of indirection in doing HiZ resolves.
authorEric Anholt <eric@anholt.net>
Mon, 21 May 2012 17:01:20 +0000 (10:01 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 23 May 2012 17:18:27 +0000 (10:18 -0700)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/brw_vtbl.c
src/mesa/drivers/dri/i965/gen6_blorp.cpp
src/mesa/drivers/dri/i965/gen6_blorp.h
src/mesa/drivers/dri/i965/gen7_blorp.cpp
src/mesa/drivers/dri/i965/gen7_blorp.h
src/mesa/drivers/dri/intel/intel_context.h
src/mesa/drivers/dri/intel/intel_mipmap_tree.c

index d05b602ab8e92a28ded5a7c7b490681f358cea65..56997493318267e9687139034d25022c86062dac 100644 (file)
@@ -238,18 +238,6 @@ void brwInitVtbl( struct brw_context *brw )
    brw->intel.vtbl.render_target_supported = brw_render_target_supported;
    brw->intel.vtbl.is_hiz_depth_format = brw_is_hiz_depth_format;
 
-   if (brw->intel.has_hiz) {
-      if (brw->intel.gen == 7) {
-         brw->intel.vtbl.resolve_depth_slice = gen7_resolve_depth_slice;
-         brw->intel.vtbl.resolve_hiz_slice = gen7_resolve_hiz_slice;
-      } else if (brw->intel.gen == 6) {
-         brw->intel.vtbl.resolve_depth_slice = gen6_resolve_depth_slice;
-         brw->intel.vtbl.resolve_hiz_slice = gen6_resolve_hiz_slice;
-      } else {
-         assert(0);
-      }
-   }
-
    if (brw->intel.gen >= 7) {
       gen7_init_vtable_surface_functions(brw);
    } else if (brw->intel.gen >= 4) {
index 8eed9dca01efad261098f264011989cb1540ca74..7b3bdf31d9d7511973c7912db9515d5e9275e3ba 100644 (file)
@@ -1062,24 +1062,3 @@ gen6_blorp_exec(struct intel_context *intel,
    brw->state.dirty.cache = ~0;
 }
 
-/** \see intel_context::vtbl::resolve_hiz_slice */
-void
-gen6_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_HIZ_RESOLVE);
-   gen6_blorp_exec(intel, &params);
-}
-
-/** \see intel_context::vtbl::resolve_depth_slice */
-void
-gen6_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_DEPTH_RESOLVE);
-   gen6_blorp_exec(intel, &params);
-}
index 809614803626233c902738bb11d040ed125978bf..969ead1a2e7c41b9eb6cd644a591d960802db1ae 100644 (file)
@@ -32,18 +32,6 @@ extern "C" {
 struct intel_context;
 struct intel_mipmap_tree;
 
-void
-gen6_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer);
-
-void
-gen6_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer);
-
 #ifdef __cplusplus
 }
 
index fbb94dfed565837322b74399b8f95e1ef141ddc6..7ef0d36359fc150f65506232ffc57f890eaca3c4 100644 (file)
@@ -783,25 +783,3 @@ gen7_blorp_exec(struct intel_context *intel,
    brw->state.dirty.brw = ~0;
    brw->state.dirty.cache = ~0;
 }
-
-/** \copydoc gen6_resolve_hiz_slice() */
-void
-gen7_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_HIZ_RESOLVE);
-   gen7_blorp_exec(intel, &params);
-}
-
-/** \copydoc gen6_resolve_depth_slice() */
-void
-gen7_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_DEPTH_RESOLVE);
-   gen7_blorp_exec(intel, &params);
-}
index 43e4a10faeae8a9f47cb1deef67d07f7a260b4f8..caf5640dcd146411a5d36febfa3bd297a1f9bab8 100644 (file)
@@ -32,20 +32,6 @@ extern "C" {
 struct intel_context;
 struct intel_mipmap_tree;
 
-/** \copydoc gen6_resolve_hiz_slice() */
-void
-gen7_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer);
-
-/** \copydoc gen6_resolve_depth_slice() */
-void
-gen7_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer);
-
 #ifdef __cplusplus
 }
 
index d064f37c9c5f74a8dd906383a93c46abd41df031..cc3ee0d35925ca6a73ec8e8c1dbddae8669401b7 100644 (file)
@@ -185,26 +185,6 @@ struct intel_context
       bool (*is_hiz_depth_format)(struct intel_context *intel,
                                  gl_format format);
 
-      /**
-       * \name HiZ operations
-       *
-       * See the following sections of the Sandy Bridge PRM, Volume 1, Part2:
-       *   - 7.5.3.1 Depth Buffer Clear
-       *   - 7.5.3.2 Depth Buffer Resolve
-       *   - 7.5.3.3 Hierarchical Depth Buffer Resolve
-       * \{
-       */
-      void (*resolve_hiz_slice)(struct intel_context *intel,
-                               struct intel_mipmap_tree *mt,
-                               uint32_t level,
-                               uint32_t layer);
-
-      void (*resolve_depth_slice)(struct intel_context *intel,
-                                 struct intel_mipmap_tree *mt,
-                                 uint32_t level,
-                                 uint32_t layer);
-      /** \} */
-
       /**
        * Surface state operations (i965+ only)
        * \{
index 2042afd76ec5b63100b26b82d17282ac2c192f73..40cd3d03019e53e09acba77cad5a3e958280171c 100644 (file)
@@ -608,18 +608,12 @@ intel_miptree_slice_set_needs_depth_resolve(struct intel_mipmap_tree *mt,
                         level, layer, GEN6_HIZ_OP_DEPTH_RESOLVE);
 }
 
-typedef void (*resolve_func_t)(struct intel_context *intel,
-                              struct intel_mipmap_tree *mt,
-                              uint32_t level,
-                              uint32_t layer);
-
 static bool
 intel_miptree_slice_resolve(struct intel_context *intel,
                            struct intel_mipmap_tree *mt,
                            uint32_t level,
                            uint32_t layer,
-                           enum gen6_hiz_op need,
-                           resolve_func_t func)
+                           enum gen6_hiz_op need)
 {
    intel_miptree_check_level_layer(mt, level, layer);
 
@@ -629,7 +623,7 @@ intel_miptree_slice_resolve(struct intel_context *intel,
    if (!item || item->need != need)
       return false;
 
-   func(intel, mt, level, layer);
+   intel_hiz_exec(intel, mt, level, layer, need);
    intel_resolve_map_remove(item);
    return true;
 }
@@ -641,8 +635,7 @@ intel_miptree_slice_resolve_hiz(struct intel_context *intel,
                                uint32_t layer)
 {
    return intel_miptree_slice_resolve(intel, mt, level, layer,
-                                     GEN6_HIZ_OP_HIZ_RESOLVE,
-                                     intel->vtbl.resolve_hiz_slice);
+                                     GEN6_HIZ_OP_HIZ_RESOLVE);
 }
 
 bool
@@ -652,15 +645,13 @@ intel_miptree_slice_resolve_depth(struct intel_context *intel,
                                  uint32_t layer)
 {
    return intel_miptree_slice_resolve(intel, mt, level, layer,
-                                     GEN6_HIZ_OP_DEPTH_RESOLVE,
-                                     intel->vtbl.resolve_depth_slice);
+                                     GEN6_HIZ_OP_DEPTH_RESOLVE);
 }
 
 static bool
 intel_miptree_all_slices_resolve(struct intel_context *intel,
                                 struct intel_mipmap_tree *mt,
-                                enum gen6_hiz_op need,
-                                resolve_func_t func)
+                                enum gen6_hiz_op need)
 {
    bool did_resolve = false;
    struct intel_resolve_map *i, *next;
@@ -669,7 +660,8 @@ intel_miptree_all_slices_resolve(struct intel_context *intel,
       next = i->next;
       if (i->need != need)
         continue;
-      func(intel, mt, i->level, i->layer);
+
+      intel_hiz_exec(intel, mt, i->level, i->layer, need);
       intel_resolve_map_remove(i);
       did_resolve = true;
    }
@@ -682,8 +674,7 @@ intel_miptree_all_slices_resolve_hiz(struct intel_context *intel,
                                     struct intel_mipmap_tree *mt)
 {
    return intel_miptree_all_slices_resolve(intel, mt,
-                                          GEN6_HIZ_OP_HIZ_RESOLVE,
-                                          intel->vtbl.resolve_hiz_slice);
+                                          GEN6_HIZ_OP_HIZ_RESOLVE);
 }
 
 bool
@@ -691,8 +682,7 @@ intel_miptree_all_slices_resolve_depth(struct intel_context *intel,
                                       struct intel_mipmap_tree *mt)
 {
    return intel_miptree_all_slices_resolve(intel, mt,
-                                          GEN6_HIZ_OP_DEPTH_RESOLVE,
-                                          intel->vtbl.resolve_depth_slice);
+                                          GEN6_HIZ_OP_DEPTH_RESOLVE);
 }
 
 static void