turnip: disable LRZ writes when blend is enabled

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
This commit is contained in:
Samuel Iglesias Gonsálvez 2020-09-11 15:16:39 +02:00 committed by Marge Bot
parent 38f008e07b
commit d1fa40bdcf
2 changed files with 19 additions and 0 deletions

View File

@ -2582,6 +2582,24 @@ tu_pipeline_builder_parse_multisample_and_color_blend(
assert(cs.cur == cs.end); /* validate draw state size */
if (blend_enable_mask) {
for (int i = 0; i < blend_info->attachmentCount; i++) {
VkPipelineColorBlendAttachmentState blendAttachment = blend_info->pAttachments[i];
/* Disable LRZ writes when blend is enabled, since the
* resulting pixel value from the blend-draw
* depends on an earlier draw, which LRZ in the draw pass
* could early-reject if the previous blend-enabled draw wrote LRZ.
*
* From the PoV of LRZ, having masked color channels is
* the same as having blend enabled, in that the draw will
* care about the fragments from an earlier draw.
*/
if (blendAttachment.blendEnable || blendAttachment.colorWriteMask != 0xf) {
pipeline->lrz.blend_disable_write = true;
}
}
}
if (tu_pipeline_static_state(pipeline, &cs, VK_DYNAMIC_STATE_BLEND_CONSTANTS, 5)) {
tu_cs_emit_pkt4(&cs, REG_A6XX_RB_BLEND_RED_F32, 4);
tu_cs_emit_array(&cs, (const uint32_t *) blend_info->blendConstants, 4);

View File

@ -845,6 +845,7 @@ struct tu_lrz_pipeline
bool enable : 1;
bool greater : 1;
bool z_test_enable : 1;
bool blend_disable_write : 1;
};
struct tu_cmd_state