From d68db9f24e99e90890755fd99c762e0da04a763d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Wed, 2 Apr 2014 08:44:13 +0300 Subject: [PATCH] i965/vec4: do not trim dead channels for gen6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On GEN6 many of the math operations require destination writemask to be WRITEMASK_XYZW. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76883 Signed-off-by: Tapani Pälli --- src/mesa/drivers/dri/i965/brw_vec4.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 32a3892..72a65b0 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -322,8 +322,11 @@ src_reg::equals(src_reg *r) } static bool -try_eliminate_instruction(vec4_instruction *inst, int new_writemask) +try_eliminate_instruction(struct brw_context *brw, + vec4_instruction *inst, + int new_writemask) { + if (new_writemask == 0) { /* Don't dead code eliminate instructions that write to the * accumulator as a side-effect. Instead just set the destination @@ -344,6 +347,11 @@ try_eliminate_instruction(vec4_instruction *inst, int new_writemask) } return true; } else if (inst->dst.writemask != new_writemask) { + + /* On GEN6, destination writemask is required to be XYZW */ + if (brw->gen == 6 && new_writemask != WRITEMASK_XYZW) + return false; + switch (inst->opcode) { case SHADER_OPCODE_TXF_CMS: case SHADER_OPCODE_GEN4_SCRATCH_READ: @@ -407,7 +415,8 @@ vec4_visitor::dead_code_eliminate() } } - progress = try_eliminate_instruction(inst, write_mask) || progress; + progress = try_eliminate_instruction(brw, + inst, write_mask) || progress; } if (seen_control_flow || inst->predicate || inst->prev == NULL) @@ -456,8 +465,9 @@ vec4_visitor::dead_code_eliminate() if (inst->dst.reg == scan_inst->dst.reg) { int new_writemask = scan_inst->dst.writemask & ~dead_channels; - progress = try_eliminate_instruction(scan_inst, new_writemask) || - progress; + progress = try_eliminate_instruction(brw, + scan_inst, + new_writemask) || progress; } for (int i = 0; i < 3; i++) { -- 1.8.3.1