Merge branch 'radv_fix_vrs_mips' into 'main'

radv: various VRS fixes/changes for mipmaps on GFX10.3

See merge request mesa/mesa!41427
This commit is contained in:
Samuel Pitoiset 2026-05-08 02:10:43 +02:00
commit 4346f59d2e
4 changed files with 22 additions and 32 deletions

View file

@ -1,29 +1,3 @@
# Issues specific to the Raphael. The list can be reduced when disabling VRS flat shading
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragdepth_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.1x1.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.noshaderrate.keep.replace.4x4.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.1x1.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.keep.replace.4x4.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.1x1.samples1.vs,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.ms,Fail
dEQP-VK.fragment_shading_rate.renderpass2.monolithic.fragstencil_baselevel.dynamic.attachment.shaderrate.replace.replace.4x4.samples1.vs,Fail
# RADV bug
dEQP-VK.api.copy_and_blit.core.use_after_copy.d16_unorm.general.32x32x1_cq_regions,Fail
dEQP-VK.api.copy_and_blit.core.use_after_copy.d16_unorm.general.32x32x2_cq_img2img_msaa,Fail

View file

@ -4319,6 +4319,7 @@ radv_emit_fsr_state(struct radv_cmd_buffer *cmd_buffer)
struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
const struct radv_physical_device *pdev = radv_device_physical(device);
const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic;
const struct radv_rendering_state *render = &cmd_buffer->state.render;
struct radv_cmd_stream *cs = cmd_buffer->cs;
/* When per-vertex VRS is forced and the dynamic fragment shading rate is a no-op, ignore
@ -4338,7 +4339,7 @@ radv_emit_fsr_state(struct radv_cmd_buffer *cmd_buffer)
assert(pdev->info.gfx_level >= GFX10_3);
if (!cmd_buffer->state.render.vrs_att.iview) {
if (!render->vrs_att.iview) {
/* When the current subpass has no VRS attachment, the VRS rates are expected to be 1x1, so we
* can cheat by tweaking the different combiner modes.
*/
@ -4364,6 +4365,20 @@ radv_emit_fsr_state(struct radv_cmd_buffer *cmd_buffer)
default:
break;
}
} else if (render->ds_att.iview && radv_image_has_vrs_htile(device, render->ds_att.iview->image) &&
!radv_htile_enabled(render->ds_att.iview->image, render->ds_att.iview->vk.base_mip_level)) {
/* Otherwise, adjust the combiners to force VRS rate to 1x1 when the depth/stencil view is
* incompatible with VRS which can happen with mipmaps.
*/
switch (htile_comb_mode) {
case VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_KHR:
case VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR:
rate_x = rate_y = 0;
pipeline_comb_mode = V_028848_SC_VRS_COMB_MODE_PASSTHRU;
break;
default:
break;
}
}
/* Disable VRS and use the rates from PS_ITER_SAMPLES if:
@ -10399,9 +10414,9 @@ radv_CmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo *pRe
/* Copy the VRS rates to the HTILE buffer. */
radv_copy_vrs_htile(cmd_buffer, vrs_att.iview, &render_area, ds_image, htile_va, true);
} else {
/* When a subpass uses a VRS attachment without binding a depth/stencil attachment, or when
* HTILE isn't enabled, we use a fallback that copies the VRS rates to our internal HTILE buffer.
} else if (!ds_att.iview) {
/* When a subpass uses a VRS attachment without binding a depth/stencil attachment, we
* use a fallback that copies the VRS rates to our internal HTILE buffer.
*/
struct radv_image *ds_image = radv_cmd_buffer_get_vrs_image(cmd_buffer);

View file

@ -595,7 +595,8 @@ radv_initialise_ds_surface(const struct radv_device *device, struct radv_ds_buff
.stencil_read_only = !(ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT),
.htile_enabled = radv_htile_enabled(iview->image, level),
.htile_stencil_disabled = radv_image_tile_stencil_disabled(device, iview->image),
.vrs_enabled = radv_image_has_vrs_htile(device, iview->image),
.vrs_enabled = radv_image_has_vrs_htile(device, iview->image) &&
radv_htile_enabled(iview->image, iview->vk.base_mip_level),
};
ac_init_ds_surface(&pdev->info, &ds_state, &ds->ac);

View file

@ -2103,7 +2103,7 @@ radv_get_physical_device_properties(struct radv_physical_device *pdev)
.maxFragmentShadingRateAttachmentTexelSize = vrs_texel_extent,
.maxFragmentShadingRateAttachmentTexelSizeAspectRatio = 1,
.primitiveFragmentShadingRateWithMultipleViewports = true,
.layeredShadingRateAttachments = false, /* TODO */
.layeredShadingRateAttachments = false,
.fragmentShadingRateNonTrivialCombinerOps = true,
.maxFragmentSize = (VkExtent2D){2, 2},
.maxFragmentSizeAspectRatio = 2,