From 50c6f3196360f091cde0bd078d6dd1a73d1a8a78 Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Thu, 31 Jul 2025 08:52:45 +0200 Subject: [PATCH] tu: enable fragmentShadingRateWithShaderSampleMask We disabled it because it didn't play nicely together with VK_EXT_post_depth_coverage. Since we disabled the latter, we can enable this one now. Signed-off-by: Job Noorman Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13414 Part-of: --- src/freedreno/vulkan/tu_cmd_buffer.cc | 6 +----- src/freedreno/vulkan/tu_device.cc | 3 +-- src/freedreno/vulkan/tu_pipeline.cc | 22 ++++------------------ src/freedreno/vulkan/tu_pipeline.h | 1 - 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/freedreno/vulkan/tu_cmd_buffer.cc b/src/freedreno/vulkan/tu_cmd_buffer.cc index 6e282407cd0..4a972e2f230 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.cc +++ b/src/freedreno/vulkan/tu_cmd_buffer.cc @@ -4520,15 +4520,11 @@ tu_CmdBindPipeline(VkCommandBuffer commandBuffer, if (pipeline->program.writes_shading_rate != cmd->state.pipeline_writes_shading_rate || pipeline->program.reads_shading_rate != - cmd->state.pipeline_reads_shading_rate || - pipeline->program.accesses_smask != - cmd->state.pipeline_accesses_smask) { + cmd->state.pipeline_reads_shading_rate) { cmd->state.pipeline_writes_shading_rate = pipeline->program.writes_shading_rate; cmd->state.pipeline_reads_shading_rate = pipeline->program.reads_shading_rate; - cmd->state.pipeline_accesses_smask = - pipeline->program.accesses_smask; cmd->state.dirty |= TU_CMD_DIRTY_SHADING_RATE; } diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc index a2d68c157c8..b7f9ef50715 100644 --- a/src/freedreno/vulkan/tu_device.cc +++ b/src/freedreno/vulkan/tu_device.cc @@ -1176,8 +1176,7 @@ tu_get_properties(struct tu_physical_device *pdevice, props->maxFragmentShadingRateRasterizationSamples = VK_SAMPLE_COUNT_4_BIT; props->fragmentShadingRateWithShaderDepthStencilWrites = true; props->fragmentShadingRateWithSampleMask = true; - /* Has wrong gl_SampleMaskIn[0] values with VK_EXT_post_depth_coverage used. */ - props->fragmentShadingRateWithShaderSampleMask = false; + props->fragmentShadingRateWithShaderSampleMask = true; props->fragmentShadingRateWithConservativeRasterization = true; props->fragmentShadingRateWithFragmentShaderInterlock = false; props->fragmentShadingRateWithCustomSampleLocations = true; diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index db4703893c8..c22d9c70d67 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -2348,7 +2348,6 @@ tu_emit_program_state(struct tu_cs *sub_cs, prog->per_layer_viewport; prog->writes_shading_rate = last_variant->writes_shading_rate; prog->reads_shading_rate = fs->reads_shading_rate; - prog->accesses_smask = fs->reads_smask || fs->writes_smask; } static const enum mesa_vk_dynamic_graphics_state tu_vertex_input_state[] = { @@ -3574,8 +3573,7 @@ tu6_fragment_shading_rate_size(struct tu_device *dev, const vk_fragment_shading_rate_state *fsr, bool enable_att_fsr, bool enable_prim_fsr, - bool fs_reads_fsr, - bool sample_shading) + bool fs_reads_fsr) { return 6; } @@ -3586,8 +3584,7 @@ tu6_emit_fragment_shading_rate(struct tu_cs *cs, const vk_fragment_shading_rate_state *fsr, bool enable_att_fsr, bool enable_prim_fsr, - bool fs_reads_fsr, - bool accesses_smask) + bool fs_reads_fsr) { /* gl_ShadingRateEXT don't read 1x1 value with null config, so * if it is read - we have to emit the config. @@ -3623,15 +3620,6 @@ tu6_emit_fragment_shading_rate(struct tu_cs *cs, } } - /* Force 1x1 FSR because we don't support - * fragmentShadingRateWithShaderSampleMask. - */ - if (accesses_smask) { - enable_att_fsr = enable_prim_fsr = false; - frag_width = frag_height = 1; - enable_draw_fsr = true; - } - tu_cs_emit_regs( cs, A6XX_RB_VRS_CONFIG(.unk2 = true, .pipeline_fsr_enable = enable_draw_fsr, @@ -3859,8 +3847,7 @@ tu_pipeline_builder_emit_state(struct tu_pipeline_builder *builder, builder->graphics_state.fsr, has_fsr_att, pipeline->program.writes_shading_rate, - pipeline->program.reads_shading_rate, - pipeline->program.accesses_smask); + pipeline->program.reads_shading_rate); } #undef DRAW_STATE #undef DRAW_STATE_COND @@ -4053,8 +4040,7 @@ tu_emit_draw_state(struct tu_cmd_buffer *cmd) &cmd->vk.dynamic_graphics_state.fsr, cmd->state.subpass->fsr_attachment != VK_ATTACHMENT_UNUSED, cmd->state.program.writes_shading_rate, - cmd->state.program.reads_shading_rate, - cmd->state.program.accesses_smask); + cmd->state.program.reads_shading_rate); } DRAW_STATE_COND(rast, TU_DYNAMIC_STATE_RAST, cmd->state.dirty & (TU_CMD_DIRTY_SUBPASS | diff --git a/src/freedreno/vulkan/tu_pipeline.h b/src/freedreno/vulkan/tu_pipeline.h index 2c4573702e2..97bc9765b2b 100644 --- a/src/freedreno/vulkan/tu_pipeline.h +++ b/src/freedreno/vulkan/tu_pipeline.h @@ -151,7 +151,6 @@ struct tu_program_state bool writes_shading_rate; bool reads_shading_rate; - bool accesses_smask; bool uses_ray_intersection; };