diff options
author | Ardinartsev Nikita <[email protected]> | 2016-06-22 18:28:11 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2016-06-23 10:08:58 -0700 |
commit | 01c89ccc5d1529aa1efbae80c8ef641a59abbd93 (patch) | |
tree | f505c89965c48559192927df2ca6beb20ddc5c74 /src/mesa/drivers/dri/i965/gen7_urb.c | |
parent | a16d274032cc1ee264b14de39be1bbb3f923bfb0 (diff) |
i965: Avoid division by zero.
Fixes regression introduced by af5ca43f2676bff7499f93277f908b681cb821d0
Cc: "12.0 11.2" <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95419
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_urb.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_urb.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_urb.c b/src/mesa/drivers/dri/i965/gen7_urb.c index 387ed2e8923..797d1b675b6 100644 --- a/src/mesa/drivers/dri/i965/gen7_urb.c +++ b/src/mesa/drivers/dri/i965/gen7_urb.c @@ -300,17 +300,21 @@ gen7_upload_urb(struct brw_context *brw) remaining_space -= vs_additional; total_wants -= vs_wants; - unsigned hs_additional = (unsigned) - round(hs_wants * (((double) remaining_space) / total_wants)); - hs_chunks += hs_additional; - remaining_space -= hs_additional; - total_wants -= hs_wants; - - unsigned ds_additional = (unsigned) - round(ds_wants * (((double) remaining_space) / total_wants)); - ds_chunks += ds_additional; - remaining_space -= ds_additional; - total_wants -= ds_wants; + if (total_wants > 0) { + unsigned hs_additional = (unsigned) + round(hs_wants * (((double) remaining_space) / total_wants)); + hs_chunks += hs_additional; + remaining_space -= hs_additional; + total_wants -= hs_wants; + } + + if (total_wants > 0) { + unsigned ds_additional = (unsigned) + round(ds_wants * (((double) remaining_space) / total_wants)); + ds_chunks += ds_additional; + remaining_space -= ds_additional; + total_wants -= ds_wants; + } gs_chunks += remaining_space; } |