[Mesa-dev] [PATCH 11/16] i965/blorp: Move push const setup for the parameter type to handle

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Apr 23 11:00:36 PDT 2015


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_blorp.cpp  |  2 +-
 src/mesa/drivers/dri/i965/brw_blorp.h    |  7 ++++++-
 src/mesa/drivers/dri/i965/gen6_blorp.cpp | 22 +++++++++++++++-------
 src/mesa/drivers/dri/i965/gen6_blorp.h   |  2 +-
 src/mesa/drivers/dri/i965/gen7_blorp.cpp | 10 ++++------
 src/mesa/drivers/dri/i965/gen7_blorp.h   |  2 +-
 6 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index 300cafe..680db75 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -207,7 +207,7 @@ intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
 } /* extern "C" */
 
 void
-brw_blorp_exec(struct brw_context *brw, const brw_blorp_params *params)
+brw_blorp_exec(struct brw_context *brw, brw_blorp_params *params)
 {
    struct gl_context *ctx = &brw->ctx;
    uint32_t estimated_max_batch_usage = 1500;
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index a2682da..0149197 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -215,6 +215,8 @@ public:
                     unsigned num_draw_buffers = 1,
                     unsigned num_layers = 1);
 
+   virtual void gen6_emit_wm_constants(struct brw_context *brw);
+
    virtual void gen6_emit_wm_config(struct brw_context *brw) const;
    virtual void gen7_emit_wm_config(struct brw_context *brw) const;
 
@@ -238,7 +240,7 @@ public:
 
 
 void
-brw_blorp_exec(struct brw_context *brw, const brw_blorp_params *params);
+brw_blorp_exec(struct brw_context *brw, brw_blorp_params *params);
 
 
 /**
@@ -353,6 +355,8 @@ public:
                          GLfloat dst_x1, GLfloat dst_y1,
                          GLenum filter, bool mirror_x, bool mirror_y);
 
+   virtual void gen6_emit_wm_constants(struct brw_context *brw);
+
    virtual void gen6_emit_wm_config(struct brw_context *brw) const;
    virtual void gen7_emit_wm_config(struct brw_context *brw) const;
 
@@ -365,6 +369,7 @@ private:
 
    brw_blorp_prog_data *prog_data;
    uint32_t prog_offset;
+   uint32_t wm_push_const_offset;
 };
 
 /**
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 39fbb24..d42b7f3 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -999,14 +999,27 @@ gen6_blorp_emit_primitive(struct brw_context *brw,
 }
 
 void
+brw_blorp_params::gen6_emit_wm_constants(struct brw_context *)
+{
+}
+
+void
 brw_blorp_params::gen6_emit_wm_config(struct brw_context *brw) const
 {
+   gen6_blorp_emit_constant_ps_disable(brw, this);
    gen6_blorp_emit_wm_config(brw, this, 0, NULL);
 }
 
 void
+brw_blorp_blit_params::gen6_emit_wm_constants(struct brw_context *brw)
+{
+   wm_push_const_offset = gen6_blorp_emit_wm_constants(brw, this);
+}
+
+void
 brw_blorp_blit_params::gen6_emit_wm_config(struct brw_context *brw) const
 {
+   gen6_blorp_emit_constant_ps(brw, this, wm_push_const_offset);
    gen6_blorp_emit_wm_config(brw, this, prog_offset, prog_data);
 }
 
@@ -1021,12 +1034,11 @@ brw_blorp_blit_params::gen6_emit_wm_config(struct brw_context *brw) const
  */
 void
 gen6_blorp_exec(struct brw_context *brw,
-                const brw_blorp_params *params)
+                brw_blorp_params *params)
 {
    uint32_t cc_blend_state_offset = 0;
    uint32_t cc_state_offset = 0;
    uint32_t depthstencil_offset;
-   uint32_t wm_push_const_offset = 0;
    uint32_t wm_bind_bo_offset = 0;
 
    /* Emit workaround flushes when we switch from drawing to blorping. */
@@ -1046,11 +1058,11 @@ gen6_blorp_exec(struct brw_context *brw,
    depthstencil_offset = gen6_blorp_emit_depth_stencil_state(brw, params);
    gen6_blorp_emit_cc_state_pointers(brw, params, cc_blend_state_offset,
                                      depthstencil_offset, cc_state_offset);
+   params->gen6_emit_wm_constants(brw);
    if (params->use_wm_prog) {
       uint32_t wm_surf_offset_renderbuffer;
       uint32_t wm_surf_offset_texture = 0;
       uint32_t sampler_offset;
-      wm_push_const_offset = gen6_blorp_emit_wm_constants(brw, params);
       intel_miptree_used_for_rendering(params->dst.mt);
       wm_surf_offset_renderbuffer =
          gen6_blorp_emit_surface_state(brw, params, &params->dst,
@@ -1073,10 +1085,6 @@ gen6_blorp_exec(struct brw_context *brw,
    gen6_blorp_emit_gs_disable(brw, params);
    gen6_blorp_emit_clip_disable(brw);
    gen6_blorp_emit_sf_config(brw, params);
-   if (params->use_wm_prog)
-      gen6_blorp_emit_constant_ps(brw, params, wm_push_const_offset);
-   else
-      gen6_blorp_emit_constant_ps_disable(brw, params);
    params->gen6_emit_wm_config(brw);
    if (params->use_wm_prog)
       gen6_blorp_emit_binding_table_pointers(brw, wm_bind_bo_offset);
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.h b/src/mesa/drivers/dri/i965/gen6_blorp.h
index 1b273a4..55fddcc 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.h
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.h
@@ -36,6 +36,6 @@ struct intel_mipmap_tree;
 
 void
 gen6_blorp_exec(struct brw_context *brw,
-                const brw_blorp_params *params);
+                brw_blorp_params *params);
 
 #endif
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index e2b865f..f849a0b 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -768,6 +768,7 @@ brw_blorp_params::gen7_emit_wm_config(struct brw_context *brw) const
 void
 brw_blorp_params::gen7_emit_ps_config(struct brw_context *brw) const
 {
+   gen7_blorp_emit_constant_ps_disable(brw);
    gen7_blorp_emit_ps_config(brw, this, 0, NULL);
 }
 
@@ -780,6 +781,7 @@ brw_blorp_blit_params::gen7_emit_wm_config(struct brw_context *brw) const
 void
 brw_blorp_blit_params::gen7_emit_ps_config(struct brw_context *brw) const
 {
+   gen7_blorp_emit_constant_ps(brw, wm_push_const_offset);
    gen7_blorp_emit_ps_config(brw, this, prog_offset, prog_data);
 }
 
@@ -788,7 +790,7 @@ brw_blorp_blit_params::gen7_emit_ps_config(struct brw_context *brw) const
  */
 void
 gen7_blorp_exec(struct brw_context *brw,
-                const brw_blorp_params *params)
+                brw_blorp_params *params)
 {
    if (brw->gen >= 8)
       return;
@@ -796,7 +798,6 @@ gen7_blorp_exec(struct brw_context *brw,
    uint32_t cc_blend_state_offset = 0;
    uint32_t cc_state_offset = 0;
    uint32_t depthstencil_offset;
-   uint32_t wm_push_const_offset = 0;
    uint32_t wm_bind_bo_offset = 0;
    uint32_t sampler_offset = 0;
 
@@ -815,10 +816,10 @@ gen7_blorp_exec(struct brw_context *brw,
    }
    depthstencil_offset = gen6_blorp_emit_depth_stencil_state(brw, params);
    gen7_blorp_emit_depth_stencil_state_pointers(brw, depthstencil_offset);
+   params->gen6_emit_wm_constants(brw);
    if (params->use_wm_prog) {
       uint32_t wm_surf_offset_renderbuffer;
       uint32_t wm_surf_offset_texture = 0;
-      wm_push_const_offset = gen6_blorp_emit_wm_constants(brw, params);
       intel_miptree_used_for_rendering(params->dst.mt);
       wm_surf_offset_renderbuffer =
          gen7_blorp_emit_surface_state(brw, &params->dst,
@@ -850,9 +851,6 @@ gen7_blorp_exec(struct brw_context *brw,
    if (params->use_wm_prog) {
       gen7_blorp_emit_binding_table_pointers_ps(brw, wm_bind_bo_offset);
       gen7_blorp_emit_sampler_state_pointers_ps(brw, sampler_offset);
-      gen7_blorp_emit_constant_ps(brw, wm_push_const_offset);
-   } else {
-      gen7_blorp_emit_constant_ps_disable(brw);
    }
    params->gen7_emit_ps_config(brw);
    gen7_blorp_emit_cc_viewport(brw);
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.h b/src/mesa/drivers/dri/i965/gen7_blorp.h
index 6443430..37b20c6 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.h
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.h
@@ -36,6 +36,6 @@ struct intel_mipmap_tree;
 
 void
 gen7_blorp_exec(struct brw_context *brw,
-                const brw_blorp_params *params);
+                brw_blorp_params *params);
 
 #endif
-- 
1.9.3



More information about the mesa-dev mailing list