diff options
Diffstat (limited to 'src/gallium/drivers/svga/svga_tgsi_vgpu10.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index d9b76c265ab..9f5cd4b285b 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -2707,7 +2707,6 @@ emit_temporaries_declaration(struct svga_shader_emitter_v10 *emit) } else if (emit->unit == PIPE_SHADER_FRAGMENT) { if (emit->key.fs.alpha_func != SVGA3D_CMP_ALWAYS || - emit->key.fs.white_fragments || emit->key.fs.write_color0_to_n_cbufs > 1) { /* Allocate a temp to hold the output color */ emit->fs.color_tmp_index = total_temps; @@ -6414,11 +6413,9 @@ emit_alpha_test_instructions(struct svga_shader_emitter_v10 *emit, emit_src_register(emit, &tmp_src_x); end_emit_instruction(emit); - /* If we don't need to broadcast the color below or set fragments to - * white, emit final color here. + /* If we don't need to broadcast the color below, emit the final color here. */ - if (emit->key.fs.write_color0_to_n_cbufs <= 1 && - !emit->key.fs.white_fragments) { + if (emit->key.fs.write_color0_to_n_cbufs <= 1) { /* MOV output.color, tempcolor */ emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &color_dst, &color_src, FALSE); /* XXX saturate? */ @@ -6429,23 +6426,6 @@ emit_alpha_test_instructions(struct svga_shader_emitter_v10 *emit, /** - * When we need to emit white for all fragments (for emulating XOR logicop - * mode), this function copies white into the temporary color output register. - */ -static void -emit_set_color_white(struct svga_shader_emitter_v10 *emit, - unsigned fs_color_tmp_index) -{ - struct tgsi_full_dst_register color_dst = - make_dst_temp_reg(fs_color_tmp_index); - struct tgsi_full_src_register white = - make_immediate_reg_float(emit, 1.0f); - - emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &color_dst, &white, FALSE); -} - - -/** * Emit instructions for writing a single color output to multiple * color buffers. * This is used when the TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS (or @@ -6460,8 +6440,17 @@ emit_broadcast_color_instructions(struct svga_shader_emitter_v10 *emit, { const unsigned n = emit->key.fs.write_color0_to_n_cbufs; unsigned i; - struct tgsi_full_src_register color_src = - make_src_temp_reg(fs_color_tmp_index); + struct tgsi_full_src_register color_src; + + if (emit->key.fs.white_fragments) { + /* set all color outputs to white */ + color_src = make_immediate_reg_float(emit, 1.0f); + } + else { + /* set all color outputs to TEMP[fs_color_tmp_index] */ + assert(fs_color_tmp_index != INVALID_INDEX); + color_src = make_src_temp_reg(fs_color_tmp_index); + } assert(emit->unit == PIPE_SHADER_FRAGMENT); @@ -6497,6 +6486,9 @@ emit_post_helpers(struct svga_shader_emitter_v10 *emit) else if (emit->unit == PIPE_SHADER_FRAGMENT) { const unsigned fs_color_tmp_index = emit->fs.color_tmp_index; + assert(!(emit->key.fs.white_fragments && + emit->key.fs.write_color0_to_n_cbufs == 0)); + /* We no longer want emit_dst_register() to substitute the * temporary fragment color register for the real color output. */ @@ -6505,9 +6497,6 @@ emit_post_helpers(struct svga_shader_emitter_v10 *emit) if (emit->key.fs.alpha_func != SVGA3D_CMP_ALWAYS) { emit_alpha_test_instructions(emit, fs_color_tmp_index); } - if (emit->key.fs.white_fragments) { - emit_set_color_white(emit, fs_color_tmp_index); - } if (emit->key.fs.write_color0_to_n_cbufs > 1 || emit->key.fs.white_fragments) { emit_broadcast_color_instructions(emit, fs_color_tmp_index); |