From c8245aebb5b9221ebfa7fb39a145d91e6f718f55 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Mon, 30 Nov 2020 20:48:50 -0400 Subject: [PATCH] radv: fix divide by zero with no tesselation params Cc: mesa-stable Reviewed-by: Samuel Pitoiset Part-of: (cherry picked from commit e3f56601e0c00380748bbf0039b82a2212e405b4) --- .pick_status.json | 2 +- src/amd/vulkan/radv_shader.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index be0c32bae80..256d0d46bec 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -40,7 +40,7 @@ "description": "radv: fix divide by zero with no tesselation params", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 9d9491d4361..2eb3ba4e64e 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -573,9 +573,11 @@ get_tcs_num_patches(unsigned tcs_num_input_vertices, if (chip_class >= GFX7 && family != CHIP_STONEY) hardware_lds_size = 65536; - num_patches = MIN2(num_patches, hardware_lds_size / (input_patch_size + output_patch_size)); + if (input_patch_size + output_patch_size) + num_patches = MIN2(num_patches, hardware_lds_size / (input_patch_size + output_patch_size)); /* Make sure the output data fits in the offchip buffer */ - num_patches = MIN2(num_patches, (tess_offchip_block_dw_size * 4) / output_patch_size); + if (output_patch_size) + num_patches = MIN2(num_patches, (tess_offchip_block_dw_size * 4) / output_patch_size); /* Not necessary for correctness, but improves performance. The * specific value is taken from the proprietary driver. */