Mesa (vulkan): anv/pipeline: Avoid a division by zero

Jason Ekstrand jekstrand at kemper.freedesktop.org
Mon Feb 29 23:03:33 UTC 2016


Module: Mesa
Branch: vulkan
Commit: 6986ae35adbd83ff4f3c84946e998db488416b72
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6986ae35adbd83ff4f3c84946e998db488416b72

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Mon Feb 29 14:13:07 2016 -0800

anv/pipeline: Avoid a division by zero

---

 src/intel/vulkan/anv_pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index df26584..cbd3a21 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -894,7 +894,7 @@ gen7_compute_urb_partition(struct anv_pipeline *pipeline)
 
    const unsigned stages =
       _mesa_bitcount(pipeline->active_stages & VK_SHADER_STAGE_ALL_GRAPHICS);
-   const unsigned size_per_stage = push_constant_kb / stages;
+   const unsigned size_per_stage = stages ? (push_constant_kb / stages) : 0;
    unsigned used_kb = 0;
 
    for (int i = MESA_SHADER_VERTEX; i < MESA_SHADER_FRAGMENT; i++) {




More information about the mesa-commit mailing list