diff options
-rw-r--r-- | src/mesa/drivers/common/meta.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_clip_state.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_clip_state.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_viewport_state.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_viewport_state.c | 4 | ||||
-rw-r--r-- | src/mesa/main/get.c | 8 | ||||
-rw-r--r-- | src/mesa/main/get_hash_params.py | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/math/m_matrix.c | 7 | ||||
-rw-r--r-- | src/mesa/math/m_matrix.h | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_viewport.c | 8 | ||||
-rw-r--r-- | src/mesa/swrast/s_context.c | 4 |
12 files changed, 31 insertions, 30 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 173b45c..3608ee8 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -170,7 +170,7 @@ struct save_state struct gl_buffer_object *ArrayBufferObj; /** MESA_META_VIEWPORT */ - GLint ViewportX, ViewportY, ViewportW, ViewportH; + GLfloat ViewportX, ViewportY, ViewportW, ViewportH; GLclampd DepthNear, DepthFar; /** MESA_META_CLAMP_FRAGMENT_COLOR */ @@ -744,8 +744,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) /* set viewport to match window size */ if (ctx->Viewport.X != 0 || ctx->Viewport.Y != 0 || - ctx->Viewport.Width != ctx->DrawBuffer->Width || - ctx->Viewport.Height != ctx->DrawBuffer->Height) { + ctx->Viewport.Width != (float) ctx->DrawBuffer->Width || + ctx->Viewport.Height != (float) ctx->DrawBuffer->Height) { _mesa_set_viewport(ctx, 0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); } diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index a0bdb43..021acc8 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->Viewport.Width; - float gby = maximum_post_clamp_delta / (float) ctx->Viewport.Height; + float gbx = maximum_post_clamp_delta / ctx->Viewport.Width; + float gby = maximum_post_clamp_delta / ctx->Viewport.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->Viewport.X == 0 && ctx->Viewport.Y == 0 && - ctx->Viewport.Width == fb->Width && - ctx->Viewport.Height == fb->Height) + ctx->Viewport.Width == (float) fb->Width && + ctx->Viewport.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 6cec0ff..8dcca84 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->Viewport.X == 0 && ctx->Viewport.Y == 0 && - ctx->Viewport.Width == fb->Width && - ctx->Viewport.Height == fb->Height) { + ctx->Viewport.Width == (float) fb->Width && + ctx->Viewport.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 0335920..4c5135b 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->Viewport.Width; - float gby = maximum_post_clamp_delta / (float) ctx->Viewport.Height; + float gbx = maximum_post_clamp_delta / ctx->Viewport.Width; + float gby = maximum_post_clamp_delta / ctx->Viewport.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 8c5fcac..66c1838 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->Viewport.Width; - float gby = maximum_guardband_extent / (float) ctx->Viewport.Height; + float gbx = maximum_guardband_extent / ctx->Viewport.Width; + float gby = maximum_guardband_extent / ctx->Viewport.Height; vp->guardband.xmin = -gbx; vp->guardband.xmax = gbx; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index ad6096b..fa48195 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -691,10 +691,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu break; case GL_VIEWPORT: - v->value_int_4[0] = ctx->Viewport.X; - v->value_int_4[1] = ctx->Viewport.Y; - v->value_int_4[2] = ctx->Viewport.Width; - v->value_int_4[3] = ctx->Viewport.Height; + v->value_float_4[0] = ctx->Viewport.X; + v->value_float_4[1] = ctx->Viewport.Y; + v->value_float_4[2] = ctx->Viewport.Width; + v->value_float_4[3] = ctx->Viewport.Height; break; case GL_DEPTH_RANGE: diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 8e2fdae..3aa0548 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -44,7 +44,7 @@ descriptor=[ [ "SUBPIXEL_BITS", "CONTEXT_INT(Const.SubPixelBits), NO_EXTRA" ], [ "TEXTURE_BINDING_2D", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA" ], [ "UNPACK_ALIGNMENT", "CONTEXT_INT(Unpack.Alignment), NO_EXTRA" ], - [ "VIEWPORT", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], + [ "VIEWPORT", "LOC_CUSTOM, TYPE_FLOAT_4, 0, NO_EXTRA" ], # GL_ARB_multitexture [ "ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 1d5dd48..1231a6f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1432,8 +1432,8 @@ struct gl_transform_attrib */ struct gl_viewport_attrib { - GLint X, Y; /**< position */ - GLsizei Width, Height; /**< size */ + GLfloat X, Y; /**< position */ + GLfloat Width, Height; /**< size */ GLdouble Near, Far; /**< Depth buffer range */ GLmatrix _WindowMap; /**< Mapping transformation as a matrix. */ }; diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 38fa51e..e512e45 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1110,12 +1110,13 @@ _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) * Transforms Normalized Device Coords to window/Z values. */ void -_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, +_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y, + GLfloat width, GLfloat height, GLdouble zNear, GLdouble zFar, GLdouble depthMax) { - m->m[MAT_SX] = (GLfloat) width / 2.0F; + m->m[MAT_SX] = width / 2.0F; m->m[MAT_TX] = m->m[MAT_SX] + x; - m->m[MAT_SY] = (GLfloat) height / 2.0F; + m->m[MAT_SY] = height / 2.0F; m->m[MAT_TY] = m->m[MAT_SY] + y; m->m[MAT_SZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0)); m->m[MAT_TZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0 + zNear)); diff --git a/src/mesa/math/m_matrix.h b/src/mesa/math/m_matrix.h index fc65f84..dddce70 100644 --- a/src/mesa/math/m_matrix.h +++ b/src/mesa/math/m_matrix.h @@ -122,7 +122,7 @@ _math_matrix_frustum( GLmatrix *mat, GLfloat nearval, GLfloat farval ); extern void -_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, +_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLdouble zNear, GLdouble zFar, GLdouble depthMax); extern void diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index 7a1a689..a88160f 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -62,11 +62,11 @@ update_viewport( struct st_context *st ) /* _NEW_VIEWPORT */ { - GLfloat x = (GLfloat)ctx->Viewport.X; - GLfloat y = (GLfloat)ctx->Viewport.Y; + GLfloat x = ctx->Viewport.X; + GLfloat y = ctx->Viewport.Y; GLfloat z = ctx->Viewport.Near; - GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f; - GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f; + GLfloat half_width = ctx->Viewport.Width * 0.5f; + GLfloat half_height = ctx->Viewport.Height * 0.5f; GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f; st->state.viewport.scale[0] = half_width; diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index bb0b5b5..8a5de47 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -75,9 +75,9 @@ _swrast_update_rasterflags( struct gl_context *ctx ) if (ctx->Color.ColorLogicOpEnabled) rasterMask |= LOGIC_OP_BIT; if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT; if ( ctx->Viewport.X < 0 - || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width + || ctx->Viewport.X + ctx->Viewport.Width > (GLfloat) ctx->DrawBuffer->Width || ctx->Viewport.Y < 0 - || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) { + || ctx->Viewport.Y + ctx->Viewport.Height > (GLfloat) ctx->DrawBuffer->Height) { rasterMask |= CLIP_BIT; } |