From 2fcda40ea40398e13c1aec3a7f53451fa07239cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Tue, 14 Jun 2022 12:57:20 -0700 Subject: [PATCH] anv: do not get rid of empty/useless fragment shaders This was an optimization done a while ago that doesn't seem to be having much of an impact anymore, and on the other hand, causes all sorts of breakage with queries, as many of our HW counters don't get incremented when rasterization is disabled. This fixes a bunch of issues Zink has with ANV, but more importantly, it fixes upcoming CTS tests: dEQP-VK.transform_feedback.primitives_generated_query.*.empty_frag.* dEQP-VK.transform_feedback.primitives_generated_query.*.no_attachment.* dEQP-VK.transform_feedback.primitives_generated_query.*.color_write_disable_* Cc: mesa-stable Reviewed-by: Lionel Landwerlin Reviewed-by: Jason Ekstrand Part-of: (cherry picked from commit 4666ef720edad0a95e1200c3105e87fb8ef2c73b) Conflicts: src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt CI file was deleted as it doesn't exist on 22.1 --- .pick_status.json | 2 +- src/intel/vulkan/anv_pipeline.c | 40 --------------------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 06bec15b404..d10049d6057 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -616,7 +616,7 @@ "description": "anv: do not get rid of empty/useless fragment shaders", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 95bc1fe3c54..557ad58793a 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -1850,46 +1850,6 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline, done: - if (pipeline->shaders[MESA_SHADER_FRAGMENT] != NULL) { - struct anv_shader_bin *fs = pipeline->shaders[MESA_SHADER_FRAGMENT]; - const struct brw_wm_prog_data *wm_prog_data = - brw_wm_prog_data_const(fs->prog_data); - - if (wm_prog_data->color_outputs_written == 0 && - !wm_prog_data->has_side_effects && - !wm_prog_data->uses_omask && - !wm_prog_data->uses_kill && - wm_prog_data->computed_depth_mode == BRW_PSCDEPTH_OFF && - !wm_prog_data->computed_stencil && - fs->xfb_info == NULL) { - /* This can happen if we decided to implicitly disable the fragment - * shader. See anv_pipeline_compile_fs(). - */ - anv_shader_bin_unref(pipeline->base.device, fs); - pipeline->shaders[MESA_SHADER_FRAGMENT] = NULL; - pipeline->active_stages &= ~VK_SHADER_STAGE_FRAGMENT_BIT; - - /* The per-SIMD size fragment shaders should be last in the - * executables array. Remove all of them. - */ - ASSERTED unsigned removed = 0; - - util_dynarray_foreach_reverse(&pipeline->base.executables, - struct anv_pipeline_executable, - tail) { - /* There must be at least one fragment shader. */ - assert(removed > 0 || tail->stage == MESA_SHADER_FRAGMENT); - - if (tail->stage != MESA_SHADER_FRAGMENT) - break; - - (void) util_dynarray_pop(&pipeline->base.executables, - struct anv_pipeline_executable); - removed++; - } - } - } - pipeline_feedback.duration = os_time_get_nano() - pipeline_start; const VkPipelineCreationFeedbackCreateInfo *create_feedback =