diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.h b/src/gallium/drivers/etnaviv/etnaviv_compiler.h index fa52d47a16f..5ea548e5322 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.h +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.h @@ -120,7 +120,7 @@ struct etna_shader_variant { uint32_t vs_load_balancing; /* special outputs (ps only) */ - int ps_color_out_reg; /* color output register */ + int ps_color_out_reg[PIPE_MAX_COLOR_BUFS]; /* color output register */ int ps_depth_out_reg; /* depth output register */ /* unknown input property (XX_INPUT_COUNT, field UNK8) */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c index 8b3f70c5138..83c5d44cbac 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c @@ -105,7 +105,14 @@ etna_emit_output(struct etna_compile *c, nir_variable *var, struct etna_inst_src if (is_fs(c)) { switch (var->data.location) { case FRAG_RESULT_DATA0: - c->variant->ps_color_out_reg = src.reg; + case FRAG_RESULT_DATA1: + case FRAG_RESULT_DATA2: + case FRAG_RESULT_DATA3: + case FRAG_RESULT_DATA4: + case FRAG_RESULT_DATA5: + case FRAG_RESULT_DATA6: + case FRAG_RESULT_DATA7: + c->variant->ps_color_out_reg[var->data.location - FRAG_RESULT_DATA0] = src.reg; break; case FRAG_RESULT_DEPTH: c->variant->ps_depth_out_reg = src.reg; @@ -1141,7 +1148,6 @@ etna_compile_shader(struct etna_shader_variant *v) v->vs_id_in_reg = -1; v->vs_pos_out_reg = -1; v->vs_pointsize_out_reg = -1; - v->ps_color_out_reg = 0; /* 0 for shader that doesn't write fragcolor.. */ v->ps_depth_out_reg = -1; if (s->info.stage == MESA_SHADER_FRAGMENT) diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index 3b2278588e5..9c8ebfc2a1b 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -100,7 +100,9 @@ etna_dump_shader(const struct etna_shader_variant *shader) printf(" vs_pointsize_out_reg=%i\n", shader->vs_pointsize_out_reg); printf(" vs_load_balancing=0x%08x\n", shader->vs_load_balancing); } else { - printf(" ps_color_out_reg=%i\n", shader->ps_color_out_reg); + for (int idx = 0; idx < ARRAY_SIZE(shader->ps_color_out_reg); idx++) + printf(" ps_color_out_reg[%u]=%i\n", idx, shader->ps_color_out_reg[idx]); + printf(" ps_depth_out_reg=%i\n", shader->ps_depth_out_reg); } printf(" input_count_unk8=0x%08x\n", shader->input_count_unk8); @@ -188,7 +190,19 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs, cs->VS_START_PC = 0; cs->PS_END_PC = fs->code_size / 4; - cs->PS_OUTPUT_REG[0] = fs->ps_color_out_reg; + + cs->PS_OUTPUT_REG[0] = + VIVS_PS_OUTPUT_REG_0(fs->ps_color_out_reg[0]) | + VIVS_PS_OUTPUT_REG_1(fs->ps_color_out_reg[1]) | + VIVS_PS_OUTPUT_REG_2(fs->ps_color_out_reg[2]) | + VIVS_PS_OUTPUT_REG_3(fs->ps_color_out_reg[3]); + + cs->PS_OUTPUT_REG[1] = + VIVS_PS_OUTPUT_REG2_4(fs->ps_color_out_reg[4]) | + VIVS_PS_OUTPUT_REG2_5(fs->ps_color_out_reg[5]) | + VIVS_PS_OUTPUT_REG2_6(fs->ps_color_out_reg[6]) | + VIVS_PS_OUTPUT_REG2_7(fs->ps_color_out_reg[7]); + cs->PS_INPUT_COUNT = VIVS_PS_INPUT_COUNT_COUNT(link.num_varyings + 1) | /* Number of inputs plus position */ VIVS_PS_INPUT_COUNT_UNK8(fs->input_count_unk8);