[Mesa-dev] [PATCH] swr: [rasterizer common] avoid divison by zero
Eric Engestrom
eric at engestrom.ch
Tue May 31 01:23:31 UTC 2016
Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---
src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
index 412182f..2b82967 100644
--- a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
+++ b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
@@ -107,10 +107,18 @@ void BucketManager::PrintBucket(FILE* f, UINT level, uint64_t threadCycles, uint
};
// compute percent of total cycles used by this bucket
- float percentTotal = (float)((double)bucket.elapsed / (double)threadCycles * 100.0);
+ float percentTotal = 0;
+ if (threadCycles)
+ {
+ percentTotal = (float)((double)bucket.elapsed / (double)threadCycles * 100.0);
+ }
// compute percent of parent cycles used by this bucket
- float percentParent = (float)((double)bucket.elapsed / (double)parentCycles * 100.0);
+ float percentParent = 0;
+ if (parentCycles)
+ {
+ percentParent = (float)((double)bucket.elapsed / (double)parentCycles * 100.0);
+ }
// compute average cycle count per invocation
uint64_t CPE = bucket.elapsed / bucket.count;
--
2.8.3
More information about the mesa-dev
mailing list