From: Francisco Jerez Date: Wed, 15 Jul 2015 13:42:57 +0000 (+0300) Subject: i965/fs: Fix slight layering violation in emit_single_fb_writes(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1ad928ed9f4e7723f709f91d18d17726c92f0b7b;p=mesa.git i965/fs: Fix slight layering violation in emit_single_fb_writes(). In cases where the color0 argument wasn't being provided, emit_single_fb_writes() would take the alpha channel directly from the visitor state instead of taking it from its arguments. This sort of hack didn't fit nicely into the logical send-message approach because all parameters of the instruction have to be visible to the SIMD lowering pass for it to be able to split them into halves at all. Fix it by using LOAD_PAYLOAD in fs_visitor::emit_fb_writes() to provide an actual color0 vector with undefined contents except for the alpha component to match the previous behavior when no color buffers are enabled. Reviewed-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 47dc9254664..b267e8cf015 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1551,17 +1551,7 @@ fs_visitor::emit_single_fb_write(const fs_builder &bld, payload_header_size = length; - if (color0.file == BAD_FILE) { - /* Even if there's no color buffers enabled, we still need to send - * alpha out the pipeline to our null renderbuffer to support - * alpha-testing, alpha-to-coverage, and so on. - */ - if (this->outputs[0].file != BAD_FILE) - setup_color_payload(&sources[length + 3], - offset(this->outputs[0], bld, 3), - 1, exec_size, false); - length += 4; - } else if (color1.file == BAD_FILE) { + if (color1.file == BAD_FILE) { if (src0_alpha.file != BAD_FILE) { setup_color_payload(&sources[length], src0_alpha, 1, exec_size, false); length++; @@ -1709,7 +1699,15 @@ fs_visitor::emit_fb_writes() * alpha out the pipeline to our null renderbuffer to support * alpha-testing, alpha-to-coverage, and so on. */ - inst = emit_single_fb_write(bld, reg_undef, reg_undef, reg_undef, 0, + /* FINISHME: Factor out this frequently recurring pattern into a + * helper function. + */ + const fs_reg srcs[] = { reg_undef, reg_undef, + reg_undef, offset(this->outputs[0], bld, 3) }; + const fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_UD, 4); + bld.LOAD_PAYLOAD(tmp, srcs, 4, 0); + + inst = emit_single_fb_write(bld, tmp, reg_undef, reg_undef, 4, dispatch_width); inst->target = 0; }