[Mesa-dev] [PATCH 11/40] i965: Add / remove casts around viewport width and height
Ian Romanick
idr at freedesktop.org
Fri Jan 10 17:40:12 PST 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Now that gl_viewport_attrib::Width and gl_viewport_attrib::Height are
float, we don't need explicit casts to float in the driver. However, we
do need some casts when comparing with integer variables.
(This could probably be squashed with the previous commit where the
gl_viewport_attrib fields changed type.)
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/dri/i965/brw_clip_state.c | 8 ++++----
src/mesa/drivers/dri/i965/gen6_clip_state.c | 4 ++--
src/mesa/drivers/dri/i965/gen6_viewport_state.c | 4 ++--
src/mesa/drivers/dri/i965/gen7_viewport_state.c | 4 ++--
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c
index 3d77a09..4bbbcb3 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_state.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_state.c
@@ -43,8 +43,8 @@ upload_clip_vp(struct brw_context *brw)
sizeof(*vp), 32, &brw->clip.vp_offset);
const float maximum_post_clamp_delta = 4096;
- float gbx = maximum_post_clamp_delta / (float) ctx->ViewportArray[0].Width;
- float gby = maximum_post_clamp_delta / (float) ctx->ViewportArray[0].Height;
+ float gbx = maximum_post_clamp_delta / ctx->ViewportArray[0].Width;
+ float gby = maximum_post_clamp_delta / ctx->ViewportArray[0].Height;
vp->xmin = -gbx;
vp->xmax = gbx;
@@ -127,8 +127,8 @@ brw_upload_clip_unit(struct brw_context *brw)
/* enable guardband clipping if we can */
if (ctx->ViewportArray[0].X == 0 &&
ctx->ViewportArray[0].Y == 0 &&
- ctx->ViewportArray[0].Width == fb->Width &&
- ctx->ViewportArray[0].Height == fb->Height)
+ ctx->ViewportArray[0].Width == (float) fb->Width &&
+ ctx->ViewportArray[0].Height == (float) fb->Height)
{
clip->clip5.guard_band_enable = 1;
clip->clip6.clipper_viewport_state_ptr =
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index d2c880d..e4dc278 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -98,8 +98,8 @@ upload_clip_state(struct brw_context *brw)
if (ctx->ViewportArray[0].X == 0 &&
ctx->ViewportArray[0].Y == 0 &&
- ctx->ViewportArray[0].Width == fb->Width &&
- ctx->ViewportArray[0].Height == fb->Height) {
+ ctx->ViewportArray[0].Width == (float) fb->Width &&
+ ctx->ViewportArray[0].Height == (float) fb->Height) {
dw2 |= GEN6_CLIP_GB_TEST;
}
diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c
index b30f3f3..0c5de0a 100644
--- a/src/mesa/drivers/dri/i965/gen6_viewport_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c
@@ -55,8 +55,8 @@ gen6_upload_clip_vp(struct brw_context *brw)
* drawable.
*/
const float maximum_post_clamp_delta = 8192;
- float gbx = maximum_post_clamp_delta / (float) ctx->ViewportArray[0].Width;
- float gby = maximum_post_clamp_delta / (float) ctx->ViewportArray[0].Height;
+ float gbx = maximum_post_clamp_delta / ctx->ViewportArray[0].Width;
+ float gby = maximum_post_clamp_delta / ctx->ViewportArray[0].Height;
vp->xmin = -gbx;
vp->xmax = gbx;
diff --git a/src/mesa/drivers/dri/i965/gen7_viewport_state.c b/src/mesa/drivers/dri/i965/gen7_viewport_state.c
index d676919..ed7d8c9 100644
--- a/src/mesa/drivers/dri/i965/gen7_viewport_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_viewport_state.c
@@ -54,8 +54,8 @@ gen7_upload_sf_clip_viewport(struct brw_context *brw)
* drawable.
*/
const float maximum_guardband_extent = 8192;
- float gbx = maximum_guardband_extent / (float) ctx->ViewportArray[0].Width;
- float gby = maximum_guardband_extent / (float) ctx->ViewportArray[0].Height;
+ float gbx = maximum_guardband_extent / ctx->ViewportArray[0].Width;
+ float gby = maximum_guardband_extent / ctx->ViewportArray[0].Height;
vp->guardband.xmin = -gbx;
vp->guardband.xmax = gbx;
--
1.8.1.4
More information about the mesa-dev
mailing list