i965: Add uses_kill to brw_wm_prog_data
authorJordan Justen <jordan.l.justen@intel.com>
Fri, 29 Aug 2014 18:33:34 +0000 (11:33 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Sat, 6 Sep 2014 05:15:06 +0000 (22:15 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_wm.c

index 5faa9422053f887a4a1a74ebab70061ba68d4201..3bc1ea5d69692eec7a61e9092b2369cc330721da 100644 (file)
@@ -346,6 +346,7 @@ struct brw_wm_prog_data {
    bool dual_src_blend;
    bool uses_pos_offset;
    bool uses_omask;
+   bool uses_kill;
    uint32_t prog_offset_16;
 
    /**
index a064390ce84ba4331c06c28f50d4d046e5c0a33e..2f23a9c7aac3ba269a6420ad6aeb022e75c2c4cf 100644 (file)
@@ -3195,7 +3195,7 @@ fs_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;
       }
index 068f079191b17beedd70c10843fb3960b3f59512..d78997285a036990bdec0a94b1d11bfb974e8f9a 100644 (file)
@@ -160,7 +160,7 @@ fs_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)
index 0206fb0c1d281c4ec008058569f87f78e27ffe93..7ec8fd8aaa33603d928f220a1dd345d3e9df2452 100644 (file)
@@ -2691,7 +2691,7 @@ fs_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 {
@@ -2736,7 +2736,7 @@ fs_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 {
@@ -3054,7 +3054,7 @@ fs_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;
@@ -3151,7 +3151,7 @@ fs_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;
       }
@@ -3200,7 +3200,7 @@ fs_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;
       }
@@ -3221,7 +3221,7 @@ fs_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;
       }
index 6834534c54af0daf2011c2608326614835adceed..58635736e369d95442e30dc62b9c011edc8b3120 100644 (file)
@@ -156,6 +156,7 @@ bool do_wm_prog(struct brw_context *brw,
       fs = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
 
    memset(&prog_data, 0, sizeof(prog_data));
+   prog_data.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