diff options
author | Dave Airlie <[email protected]> | 2020-03-21 06:54:26 +1000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-06 06:20:38 +0000 |
commit | 335938cffd10a7285b98999ad7a6bc8a4ed92ba1 (patch) | |
tree | ca4f59b5547185b90711e2dd7e9e32469a945d1b /src | |
parent | acba9a93ef23796b394b88d5352ec6ebdf14d123 (diff) |
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index f09c49a1ff3..34ed257b5b0 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -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"); |