[Mesa-dev] [PATCH 11/14] i965: Add uses_kill to brw_scalar_prog_data

Jordan Justen jordan.l.justen at intel.com
Mon Sep 1 09:44:35 PDT 2014


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_context.h            |  1 +
 src/mesa/drivers/dri/i965/brw_fs.cpp               |  2 +-
 src/mesa/drivers/dri/i965/brw_scalar_generator.cpp |  2 +-
 src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp   | 12 ++++++------
 src/mesa/drivers/dri/i965/brw_wm.c                 |  1 +
 5 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 8313a4b..a5705ca 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -345,6 +345,7 @@ struct brw_scalar_prog_data {
    bool dual_src_blend;
    bool uses_pos_offset;
    bool uses_omask;
+   bool uses_kill;
    uint32_t prog_offset_16;
 
    /**
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 5298059..5c1e31e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3192,7 +3192,7 @@ scalar_visitor::run()
       /* We handle discards by keeping track of the still-live pixels in f0.1.
        * Initialize it with the dispatched pixels.
        */
-      if (fp->UsesKill || key->alpha_test_func) {
+      if (prog_data->uses_kill || key->alpha_test_func) {
          fs_inst *discard_init = emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
          discard_init->flag_subreg = 1;
       }
diff --git a/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp b/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp
index 02b327c..453f4d0 100644
--- a/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_scalar_generator.cpp
@@ -159,7 +159,7 @@ scalar_generator::generate_fb_write(fs_inst *inst)
       /* On HSW, the GPU will use the predicate on SENDC, unless the header is
        * present.
        */
-      if ((fp && fp->UsesKill) || key->alpha_test_func) {
+      if (prog_data->uses_kill || key->alpha_test_func) {
          struct brw_reg pixel_mask;
 
          if (brw->gen >= 6)
diff --git a/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp b/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp
index d9b9373..97fcbae 100644
--- a/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp
@@ -2681,7 +2681,7 @@ scalar_visitor::emit_untyped_atomic(unsigned atomic_op, unsigned surf_index,
    emit(MOV(brw_uvec_mrf(8, mlen, 0), fs_reg(0u)))
       ->force_writemask_all = true;
 
-   if (fp->UsesKill) {
+   if (prog_data->uses_kill) {
       emit(MOV(brw_uvec_mrf(1, mlen, 7), brw_flag_reg(0, 1)))
          ->force_writemask_all = true;
    } else {
@@ -2727,7 +2727,7 @@ scalar_visitor::emit_untyped_surface_read(unsigned surf_index, fs_reg dst,
    emit(MOV(brw_uvec_mrf(8, mlen, 0), fs_reg(0u)))
       ->force_writemask_all = true;
 
-   if (fp->UsesKill) {
+   if (prog_data->uses_kill) {
       emit(MOV(brw_uvec_mrf(1, mlen, 7), brw_flag_reg(0, 1)))
          ->force_writemask_all = true;
    } else {
@@ -3047,7 +3047,7 @@ scalar_visitor::emit_fb_writes()
     *      thread message and on all dual-source messages."
     */
    if (brw->gen >= 6 &&
-       (brw->is_haswell || brw->gen >= 8 || !this->fp->UsesKill) &&
+       (brw->is_haswell || brw->gen >= 8 || !this->prog_data->uses_kill) &&
        !do_dual_src &&
        key->nr_color_regions == 1) {
       header_present = false;
@@ -3144,7 +3144,7 @@ scalar_visitor::emit_fb_writes()
       inst->mlen = nr - base_mrf;
       inst->eot = true;
       inst->header_present = header_present;
-      if ((brw->gen >= 8 || brw->is_haswell) && fp->UsesKill) {
+      if ((brw->gen >= 8 || brw->is_haswell) && prog_data->uses_kill) {
          inst->predicate = BRW_PREDICATE_NORMAL;
          inst->flag_subreg = 1;
       }
@@ -3193,7 +3193,7 @@ scalar_visitor::emit_fb_writes()
          inst->mlen = nr - base_mrf;
       inst->eot = eot;
       inst->header_present = header_present;
-      if ((brw->gen >= 8 || brw->is_haswell) && fp->UsesKill) {
+      if ((brw->gen >= 8 || brw->is_haswell) && prog_data->uses_kill) {
          inst->predicate = BRW_PREDICATE_NORMAL;
          inst->flag_subreg = 1;
       }
@@ -3214,7 +3214,7 @@ scalar_visitor::emit_fb_writes()
       inst->mlen = nr - base_mrf;
       inst->eot = true;
       inst->header_present = header_present;
-      if ((brw->gen >= 8 || brw->is_haswell) && fp->UsesKill) {
+      if ((brw->gen >= 8 || brw->is_haswell) && prog_data->uses_kill) {
          inst->predicate = BRW_PREDICATE_NORMAL;
          inst->flag_subreg = 1;
       }
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index e913e78..375334d 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -157,6 +157,7 @@ bool do_wm_prog(struct brw_context *brw,
       fs = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
 
    memset(&prog_data, 0, sizeof(prog_data));
+   prog_data.base.uses_kill = fp->program.UsesKill;
 
    /* Allocate the references to the uniforms that will end up in the
     * prog_data associated with the compiled program, and which will be freed
-- 
2.1.0



More information about the mesa-dev mailing list