From b029a79b834fde2f8ffcff33bca2ebadd18d505c Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 29 Apr 2025 09:48:30 +0300 Subject: [PATCH] anv: force fragment shader execution when occlusion queries are active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lionel Landwerlin Cc: mesa-stable Reviewed-by: Tapani Pälli Part-of: (cherry picked from commit f7bc22e0d726d60a911270ea08fad36d8a52605c) --- .pick_status.json | 2 +- src/intel/vulkan/genX_gfx_state.c | 23 ++++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 976e9ae2232..b11a28200b3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5824,7 +5824,7 @@ "description": "anv: force fragment shader execution when occlusion queries are active", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index 5bab5d8c560..877f4a304ef 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -857,27 +857,16 @@ update_ps_extra_has_uav(struct anv_gfx_dynamic_state *hw_state, { const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline); -#if GFX_VERx10 >= 125 - SET_STAGE(PS_EXTRA, ps_extra.PixelShaderHasUAV, - wm_prog_data && wm_prog_data->has_side_effects, - FRAGMENT); -#else - /* Prior to Gfx12.5 the HW seems to avoid spawning fragment shaders even if - * 3DSTATE_PS_EXTRA::PixelShaderKillsPixel=true when - * 3DSTATE_PS_BLEND::HasWriteableRT=false. This is causing problems with - * occlusion queries with 0 attachments. There are no CTS tests exercising - * this but zink+anv fails a bunch of tests like piglit - * arb_framebuffer_no_attachments-query. - * - * Here we choose to tweak the PixelShaderHasUAV to make sure the fragment - * shaders are run properly. + /* Force fragment shader execution if occlusion queries are active to + * ensure PS_DEPTH_COUNT is correct. Otherwise a fragment shader with + * discard and no render target setup could be increment PS_DEPTH_COUNT if + * the HW internally decides to not run the shader because it has already + * established that depth-test is passing. */ SET_STAGE(PS_EXTRA, ps_extra.PixelShaderHasUAV, wm_prog_data && (wm_prog_data->has_side_effects || - (gfx->color_att_count == 0 && - gfx->n_occlusion_queries > 0)), + gfx->n_occlusion_queries > 0), FRAGMENT); -#endif } ALWAYS_INLINE static void