mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
radv: Disable NGG culling when conservative overestimation is used.
Even when small primitive culling is disabled, the face culling algorithm in ac_nir_cull can delete tiny triangles when their area is almost zero. Cc: mesa-stable Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20987>
This commit is contained in:
parent
9b3b7e5091
commit
3508597aa1
1 changed files with 12 additions and 8 deletions
|
|
@ -187,7 +187,7 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dy
|
|||
|
||||
RADV_CMP_COPY(vk.ts.patch_control_points, RADV_DYNAMIC_PATCH_CONTROL_POINTS);
|
||||
RADV_CMP_COPY(vk.ts.domain_origin, RADV_DYNAMIC_TESS_DOMAIN_ORIGIN);
|
||||
|
||||
|
||||
RADV_CMP_COPY(vk.rs.line.width, RADV_DYNAMIC_LINE_WIDTH);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.constant, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.clamp, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
|
|
@ -235,7 +235,7 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dy
|
|||
RADV_CMP_COPY(vk.cb.logic_op, RADV_DYNAMIC_LOGIC_OP);
|
||||
RADV_CMP_COPY(vk.cb.color_write_enables, RADV_DYNAMIC_COLOR_WRITE_ENABLE);
|
||||
RADV_CMP_COPY(vk.cb.logic_op_enable, RADV_DYNAMIC_LOGIC_OP_ENABLE);
|
||||
|
||||
|
||||
RADV_CMP_COPY(vk.fsr.fragment_size.width, RADV_DYNAMIC_FRAGMENT_SHADING_RATE);
|
||||
RADV_CMP_COPY(vk.fsr.fragment_size.height, RADV_DYNAMIC_FRAGMENT_SHADING_RATE);
|
||||
RADV_CMP_COPY(vk.fsr.combiner_ops[0], RADV_DYNAMIC_FRAGMENT_SHADING_RATE);
|
||||
|
|
@ -8401,6 +8401,12 @@ radv_get_ngg_culling_settings(struct radv_cmd_buffer *cmd_buffer, bool vp_y_inve
|
|||
const struct radv_graphics_pipeline *pipeline = cmd_buffer->state.graphics_pipeline;
|
||||
const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic;
|
||||
|
||||
/* Disable shader culling entirely when conservative overestimate is used.
|
||||
* The face culling algorithm can delete very tiny triangles (even if unintended).
|
||||
*/
|
||||
if (d->vk.rs.conservative_mode == VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT)
|
||||
return radv_nggc_none;
|
||||
|
||||
/* Cull every triangle when rasterizer discard is enabled. */
|
||||
if (d->vk.rs.rasterizer_discard_enable)
|
||||
return radv_nggc_front_face | radv_nggc_back_face;
|
||||
|
|
@ -8422,12 +8428,10 @@ radv_get_ngg_culling_settings(struct radv_cmd_buffer *cmd_buffer, bool vp_y_inve
|
|||
if (d->vk.rs.cull_mode & VK_CULL_MODE_BACK_BIT)
|
||||
nggc_settings |= radv_nggc_back_face;
|
||||
|
||||
/* Small primitive culling is only valid when conservative overestimation is not used. It's also
|
||||
* disabled for user sample locations because small primitive culling assumes a sample
|
||||
* position at (0.5, 0.5). */
|
||||
bool uses_conservative_overestimate =
|
||||
d->vk.rs.conservative_mode == VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT;
|
||||
if (!uses_conservative_overestimate && !pipeline->uses_user_sample_locations) {
|
||||
/* Small primitive culling assumes a sample position at (0.5, 0.5)
|
||||
* so don't enable it with user sample locations.
|
||||
*/
|
||||
if (!pipeline->uses_user_sample_locations) {
|
||||
nggc_settings |= radv_nggc_small_primitives;
|
||||
|
||||
/* small_prim_precision = num_samples / 2^subpixel_bits
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue