llvmpipe: move color storing earlier in frag shader

Move the color storage before the late Z test as for sample
shading it needs to be inside a loop with the fragment shader.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
This commit is contained in:
Dave Airlie 2020-03-21 06:54:26 +10:00 committed by Marge Bot
parent acba9a93ef
commit 335938cffd
1 changed files with 24 additions and 23 deletions

View File

@ -726,6 +726,30 @@ generate_fs_loop(struct gallivm_state *gallivm,
LLVMBuildStore(builder, output_smask, out_sample_mask_storage);
}
/* Color write */
for (attrib = 0; attrib < shader->info.base.num_outputs; ++attrib)
{
unsigned cbuf = shader->info.base.output_semantic_index[attrib];
if ((shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR) &&
((cbuf < key->nr_cbufs) || (cbuf == 1 && dual_source_blend)))
{
for(chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
if(outputs[attrib][chan]) {
/* XXX: just initialize outputs to point at colors[] and
* skip this.
*/
LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
LLVMValueRef color_ptr;
color_ptr = LLVMBuildGEP(builder, out_color[cbuf][chan],
&loop_state.counter, 1, "");
lp_build_name(out, "color%u.%c", attrib, "rgba"[chan]);
LLVMBuildStore(builder, out, color_ptr);
}
}
}
}
if (key->multisample) {
/* execute depth test for each sample */
lp_build_for_loop_begin(&sample_loop_state, gallivm,
@ -841,29 +865,6 @@ generate_fs_loop(struct gallivm_state *gallivm,
lp_build_for_loop_end(&sample_loop_state);
}
/* Color write */
for (attrib = 0; attrib < shader->info.base.num_outputs; ++attrib)
{
unsigned cbuf = shader->info.base.output_semantic_index[attrib];
if ((shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR) &&
((cbuf < key->nr_cbufs) || (cbuf == 1 && dual_source_blend)))
{
for(chan = 0; chan < TGSI_NUM_CHANNELS; ++chan) {
if(outputs[attrib][chan]) {
/* XXX: just initialize outputs to point at colors[] and
* skip this.
*/
LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
LLVMValueRef color_ptr;
color_ptr = LLVMBuildGEP(builder, out_color[cbuf][chan],
&loop_state.counter, 1, "");
lp_build_name(out, "color%u.%c", attrib, "rgba"[chan]);
LLVMBuildStore(builder, out, color_ptr);
}
}
}
}
if (key->occlusion_count) {
LLVMValueRef counter = lp_jit_thread_data_counter(gallivm, thread_data_ptr);
lp_build_name(counter, "counter");