Mesa (master): i965/blorp: Fix narrowing warnings.

Eric Anholt anholt at kemper.freedesktop.org
Fri Sep 21 08:54:30 UTC 2012


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Wed Sep 12 20:51:07 2012 -0700

i965/blorp: Fix narrowing warnings.

Blorp has to convert rectangle coordinates from integers to floats in
order to send them down the GPU pipeline.  Recent versions of GCC
issue a warning for this, since a float is not capable of precisely
representing all possible 32-bit integer values.  Suppress the warning
with an explicit type cast in the case of blorp, since rectangle
coordinates will never be large enough to cause a loss of precision.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/gen6_blorp.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 1f536bf..60c3ff1 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -188,9 +188,9 @@ gen6_blorp_emit_vertices(struct brw_context *brw,
       float *vertex_data;
 
       const float vertices[GEN6_BLORP_VBO_SIZE] = {
-         /* v0 */ 0, 0, 0, 0,     params->x0, params->y1, 0, 1,
-         /* v1 */ 0, 0, 0, 0,     params->x1, params->y1, 0, 1,
-         /* v2 */ 0, 0, 0, 0,     params->x0, params->y0, 0, 1,
+         /* v0 */ 0, 0, 0, 0,     (float) params->x0, (float) params->y1, 0, 1,
+         /* v1 */ 0, 0, 0, 0,     (float) params->x1, (float) params->y1, 0, 1,
+         /* v2 */ 0, 0, 0, 0,     (float) params->x0, (float) params->y0, 0, 1,
       };
 
       vertex_data = (float *) brw_state_batch(brw, AUB_TRACE_VERTEX_BUFFER,




More information about the mesa-commit mailing list