From 936ca6f3cfb563719d8b51ae000d4f0594aba824 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 29 Aug 2014 11:33:34 -0700 Subject: i965: Add uses_kill to brw_wm_prog_data Signed-off-by: Jordan Justen Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_context.h | 1 + src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 2 +- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 12 ++++++------ src/mesa/drivers/dri/i965/brw_wm.c | 1 + 5 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 5faa9422053..3bc1ea5d696 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -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; /** diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index a064390ce84..2f23a9c7aac 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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; } diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 068f079191b..d78997285a0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -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) diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 0206fb0c1d2..7ec8fd8aaa3 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -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; } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 6834534c54a..58635736e36 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -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 -- cgit v1.2.3