Mesa (master): radv: fix divide by zero with no tesselation params

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 26 15:24:42 UTC 2021


Module: Mesa
Branch: master
Commit: e3f56601e0c00380748bbf0039b82a2212e405b4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3f56601e0c00380748bbf0039b82a2212e405b4

Author: David McFarland <corngood at gmail.com>
Date:   Mon Nov 30 20:48:50 2020 -0400

radv: fix divide by zero with no tesselation params

Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7878>

---

 src/amd/vulkan/radv_shader.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index 10370353da8..5e25261361f 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -577,9 +577,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.
 	 */



More information about the mesa-commit mailing list