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 */
/* 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);
}
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;
/* 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 =
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;
}
* 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;
* 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;
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:
[ "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" ],
*/
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. */
};
* 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));
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
/* _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;
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;
}