mesa: Convert gl_context::Viewport to gl_context::ViewportArray

Only element 0 of the array is used anywhere at this time, so there
should be no changes.

v4: Split out from a single megapatch.  Suggested by Ken.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Courtney Goeltzenleuchter
2013-11-13 16:24:56 -07:00
committed by Ian Romanick
parent 5b84226c31
commit cbb271a488
25 changed files with 133 additions and 127 deletions

View File

@@ -737,21 +737,21 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
if (state & MESA_META_VIEWPORT) {
/* save viewport state */
save->ViewportX = ctx->Viewport.X;
save->ViewportY = ctx->Viewport.Y;
save->ViewportW = ctx->Viewport.Width;
save->ViewportH = ctx->Viewport.Height;
save->ViewportX = ctx->ViewportArray[0].X;
save->ViewportY = ctx->ViewportArray[0].Y;
save->ViewportW = ctx->ViewportArray[0].Width;
save->ViewportH = ctx->ViewportArray[0].Height;
/* set viewport to match window size */
if (ctx->Viewport.X != 0 ||
ctx->Viewport.Y != 0 ||
ctx->Viewport.Width != (float) ctx->DrawBuffer->Width ||
ctx->Viewport.Height != (float) ctx->DrawBuffer->Height) {
if (ctx->ViewportArray[0].X != 0 ||
ctx->ViewportArray[0].Y != 0 ||
ctx->ViewportArray[0].Width != (float) ctx->DrawBuffer->Width ||
ctx->ViewportArray[0].Height != (float) ctx->DrawBuffer->Height) {
_mesa_set_viewport(ctx, 0, 0,
ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
}
/* save depth range state */
save->DepthNear = ctx->Viewport.Near;
save->DepthFar = ctx->Viewport.Far;
save->DepthNear = ctx->ViewportArray[0].Near;
save->DepthFar = ctx->ViewportArray[0].Far;
/* set depth range to default */
_mesa_DepthRange(0.0, 1.0);
}
@@ -1089,10 +1089,10 @@ _mesa_meta_end(struct gl_context *ctx)
}
if (state & MESA_META_VIEWPORT) {
if (save->ViewportX != ctx->Viewport.X ||
save->ViewportY != ctx->Viewport.Y ||
save->ViewportW != ctx->Viewport.Width ||
save->ViewportH != ctx->Viewport.Height) {
if (save->ViewportX != ctx->ViewportArray[0].X ||
save->ViewportY != ctx->ViewportArray[0].Y ||
save->ViewportW != ctx->ViewportArray[0].Width ||
save->ViewportH != ctx->ViewportArray[0].Height) {
_mesa_set_viewport(ctx, save->ViewportX, save->ViewportY,
save->ViewportW, save->ViewportH);
}

View File

@@ -404,21 +404,21 @@ intelCalcViewport(struct gl_context * ctx)
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
_math_matrix_viewport(&intel->ViewportMatrix,
ctx->Viewport.X,
ctx->DrawBuffer->Height - ctx->Viewport.Y,
ctx->Viewport.Width,
-ctx->Viewport.Height,
ctx->Viewport.Near,
ctx->Viewport.Far,
ctx->ViewportArray[0].X,
ctx->DrawBuffer->Height - ctx->ViewportArray[0].Y,
ctx->ViewportArray[0].Width,
-ctx->ViewportArray[0].Height,
ctx->ViewportArray[0].Near,
ctx->ViewportArray[0].Far,
1.0);
} else {
_math_matrix_viewport(&intel->ViewportMatrix,
ctx->Viewport.X,
ctx->Viewport.Y,
ctx->Viewport.Width,
ctx->Viewport.Height,
ctx->Viewport.Near,
ctx->Viewport.Far,
ctx->ViewportArray[0].X,
ctx->ViewportArray[0].Y,
ctx->ViewportArray[0].Width,
ctx->ViewportArray[0].Height,
ctx->ViewportArray[0].Near,
ctx->ViewportArray[0].Far,
1.0);
}
}

View File

@@ -50,8 +50,8 @@ brw_upload_cc_vp(struct brw_context *brw)
/* _NEW_TRANSFORM */
if (ctx->Transform.DepthClamp) {
/* _NEW_VIEWPORT */
ccv->min_depth = MIN2(ctx->Viewport.Near, ctx->Viewport.Far);
ccv->max_depth = MAX2(ctx->Viewport.Near, ctx->Viewport.Far);
ccv->min_depth = MIN2(ctx->ViewportArray[0].Near, ctx->ViewportArray[0].Far);
ccv->max_depth = MAX2(ctx->ViewportArray[0].Near, ctx->ViewportArray[0].Far);
} else {
ccv->min_depth = 0.0;
ccv->max_depth = 1.0;

View File

@@ -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 / ctx->Viewport.Width;
float gby = maximum_post_clamp_delta / ctx->Viewport.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;
@@ -125,10 +125,10 @@ brw_upload_clip_unit(struct brw_context *brw)
clip->clip5.userclip_must_clip = 1;
/* enable guardband clipping if we can */
if (ctx->Viewport.X == 0 &&
ctx->Viewport.Y == 0 &&
ctx->Viewport.Width == (float) fb->Width &&
ctx->Viewport.Height == (float) fb->Height)
if (ctx->ViewportArray[0].X == 0 &&
ctx->ViewportArray[0].Y == 0 &&
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 =

View File

@@ -46,7 +46,7 @@ static void upload_sf_vp(struct brw_context *brw)
struct brw_sf_viewport *sfv;
GLfloat y_scale, y_bias;
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
const GLfloat *v = ctx->Viewport._WindowMap.m;
const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
sizeof(*sfv), 32, &brw->sf.vp_offset);

View File

@@ -96,10 +96,10 @@ upload_clip_state(struct brw_context *brw)
dw2 |= (ctx->Transform.ClipPlanesEnabled <<
GEN6_USER_CLIP_CLIP_DISTANCES_SHIFT);
if (ctx->Viewport.X == 0 &&
ctx->Viewport.Y == 0 &&
ctx->Viewport.Width == (float) fb->Width &&
ctx->Viewport.Height == (float) fb->Height) {
if (ctx->ViewportArray[0].X == 0 &&
ctx->ViewportArray[0].Y == 0 &&
ctx->ViewportArray[0].Width == (float) fb->Width &&
ctx->ViewportArray[0].Height == (float) fb->Height) {
dw2 |= GEN6_CLIP_GB_TEST;
}

View File

@@ -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 / ctx->Viewport.Width;
float gby = maximum_post_clamp_delta / ctx->Viewport.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;
@@ -83,7 +83,7 @@ gen6_upload_sf_vp(struct brw_context *brw)
struct brw_sf_viewport *sfv;
GLfloat y_scale, y_bias;
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
const GLfloat *v = ctx->Viewport._WindowMap.m;
const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
sizeof(*sfv), 32, &brw->sf.vp_offset);

View File

@@ -34,7 +34,7 @@ gen7_upload_sf_clip_viewport(struct brw_context *brw)
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
GLfloat y_scale, y_bias;
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
const GLfloat *v = ctx->Viewport._WindowMap.m;
const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
struct gen7_sf_clip_viewport *vp;
vp = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
@@ -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 / ctx->Viewport.Width;
float gby = maximum_guardband_extent / ctx->Viewport.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;

View File

@@ -140,7 +140,7 @@ get_scissors(struct gl_framebuffer *fb, int *x, int *y, int *w, int *h)
static inline void
get_viewport_scale(struct gl_context *ctx, float a[16])
{
struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_viewport_attrib *vp = &ctx->ViewportArray[0];
struct gl_framebuffer *fb = ctx->DrawBuffer;
a[MAT_SX] = (float)vp->Width / 2;
@@ -157,7 +157,7 @@ get_viewport_scale(struct gl_context *ctx, float a[16])
static inline void
get_viewport_translate(struct gl_context *ctx, float a[4])
{
struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_viewport_attrib *vp = &ctx->ViewportArray[0];
struct gl_framebuffer *fb = ctx->DrawBuffer;
a[0] = (float)vp->Width / 2 + vp->X;

View File

@@ -176,7 +176,7 @@ void
nv10_emit_viewport(struct gl_context *ctx, int emit)
{
struct nouveau_pushbuf *push = context_push(ctx);
struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_viewport_attrib *vp = &ctx->ViewportArray[0];
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};

View File

@@ -1544,7 +1544,7 @@ void r200UpdateWindow( struct gl_context *ctx )
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
GLfloat xoffset = 0;
GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0;
const GLfloat *v = ctx->Viewport._WindowMap.m;
const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0);
const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
GLfloat y_scale, y_bias;
@@ -1622,7 +1622,7 @@ void r200UpdateViewportOffset( struct gl_context *ctx )
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
GLfloat xoffset = (GLfloat)0;
GLfloat yoffset = (GLfloat)dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;
const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
float_ui32_type tx;
float_ui32_type ty;

View File

@@ -1352,7 +1352,7 @@ void radeonUpdateWindow( struct gl_context *ctx )
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
GLfloat xoffset = 0.0;
GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0;
const GLfloat *v = ctx->Viewport._WindowMap.m;
const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0);
const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
GLfloat y_scale, y_bias;
@@ -1405,7 +1405,7 @@ void radeonUpdateViewportOffset( struct gl_context *ctx )
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
GLfloat xoffset = 0.0;
GLfloat yoffset = (GLfloat)dPriv->h;
const GLfloat *v = ctx->Viewport._WindowMap.m;
const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
float_ui32_type tx;
float_ui32_type ty;

View File

@@ -533,8 +533,9 @@ _mesa_PushAttrib(GLbitfield mask)
if (mask & GL_VIEWPORT_BIT) {
if (!push_attrib(ctx, &head, GL_VIEWPORT_BIT,
sizeof(struct gl_viewport_attrib),
(void*)&ctx->Viewport))
sizeof(struct gl_viewport_attrib)
* ctx->Const.MaxViewports,
(void*)&ctx->ViewportArray))
goto end;
}

View File

@@ -594,6 +594,9 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.ViewportBounds.Min = 0;
ctx->Const.ViewportBounds.Max = 0;
/* Driver must override if it supports ARB_viewport_array */
ctx->Const.MaxViewports = 1;
/** GL_ARB_uniform_buffer_object */
ctx->Const.MaxCombinedUniformBlocks = 36;
ctx->Const.MaxUniformBufferBindings = 36;
@@ -1354,13 +1357,14 @@ _mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
}
if (mask & GL_VIEWPORT_BIT) {
/* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */
dst->Viewport.X = src->Viewport.X;
dst->Viewport.Y = src->Viewport.Y;
dst->Viewport.Width = src->Viewport.Width;
dst->Viewport.Height = src->Viewport.Height;
dst->Viewport.Near = src->Viewport.Near;
dst->Viewport.Far = src->Viewport.Far;
_math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap);
dst->ViewportArray[0].X = src->ViewportArray[0].X;
dst->ViewportArray[0].Y = src->ViewportArray[0].Y;
dst->ViewportArray[0].Width = src->ViewportArray[0].Width;
dst->ViewportArray[0].Height = src->ViewportArray[0].Height;
dst->ViewportArray[0].Near = src->ViewportArray[0].Near;
dst->ViewportArray[0].Far = src->ViewportArray[0].Far;
_math_matrix_copy(&dst->ViewportArray[0]._WindowMap,
&src->ViewportArray[0]._WindowMap);
}
/* XXX FIXME: Call callbacks?

View File

@@ -691,15 +691,15 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
case GL_VIEWPORT:
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;
v->value_float_4[0] = ctx->ViewportArray[0].X;
v->value_float_4[1] = ctx->ViewportArray[0].Y;
v->value_float_4[2] = ctx->ViewportArray[0].Width;
v->value_float_4[3] = ctx->ViewportArray[0].Height;
break;
case GL_DEPTH_RANGE:
v->value_double_2[0] = ctx->Viewport.Near;
v->value_double_2[1] = ctx->Viewport.Far;
v->value_double_2[0] = ctx->ViewportArray[0].Near;
v->value_double_2[1] = ctx->ViewportArray[0].Far;
break;
case GL_ACTIVE_STENCIL_FACE_EXT:

View File

@@ -3983,7 +3983,7 @@ struct gl_context
struct gl_stencil_attrib Stencil; /**< Stencil buffer attributes */
struct gl_texture_attrib Texture; /**< Texture attributes */
struct gl_transform_attrib Transform; /**< Transformation attributes */
struct gl_viewport_attrib Viewport; /**< Viewport attributes */
struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS]; /**< Viewport attributes */
/*@}*/
/** \name Client attribute stack */

View File

@@ -227,8 +227,9 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z)
FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near)
+ ctx->Viewport.Near;
z2 = CLAMP(z, 0.0F, 1.0F)
* (ctx->ViewportArray[0].Far - ctx->ViewportArray[0].Near)
+ ctx->ViewportArray[0].Near;
/* set raster position */
ctx->Current.RasterPos[0] = x;

View File

@@ -276,10 +276,10 @@ update_viewport_matrix(struct gl_context *ctx)
* and should be maintained elsewhere if at all.
* NOTE: RasterPos uses this.
*/
_math_matrix_viewport(&ctx->Viewport._WindowMap,
ctx->Viewport.X, ctx->Viewport.Y,
ctx->Viewport.Width, ctx->Viewport.Height,
ctx->Viewport.Near, ctx->Viewport.Far,
_math_matrix_viewport(&ctx->ViewportArray[0]._WindowMap,
ctx->ViewportArray[0].X, ctx->ViewportArray[0].Y,
ctx->ViewportArray[0].Width, ctx->ViewportArray[0].Height,
ctx->ViewportArray[0].Near, ctx->ViewportArray[0].Far,
depthMax);
}

View File

@@ -78,10 +78,10 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
ctx->Viewport.X = x;
ctx->Viewport.Width = width;
ctx->Viewport.Y = y;
ctx->Viewport.Height = height;
ctx->ViewportArray[0].X = x;
ctx->ViewportArray[0].Width = width;
ctx->ViewportArray[0].Y = y;
ctx->ViewportArray[0].Height = height;
ctx->NewState |= _NEW_VIEWPORT;
#if 1
@@ -89,10 +89,10 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
* the WindowMap matrix being up to date in the driver's Viewport
* and DepthRange functions.
*/
_math_matrix_viewport(&ctx->Viewport._WindowMap,
ctx->Viewport.X, ctx->Viewport.Y,
ctx->Viewport.Width, ctx->Viewport.Height,
ctx->Viewport.Near, ctx->Viewport.Far,
_math_matrix_viewport(&ctx->ViewportArray[0]._WindowMap,
ctx->ViewportArray[0].X, ctx->ViewportArray[0].Y,
ctx->ViewportArray[0].Width, ctx->ViewportArray[0].Height,
ctx->ViewportArray[0].Near, ctx->ViewportArray[0].Far,
ctx->DrawBuffer->_DepthMaxF);
#endif
@@ -123,12 +123,12 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval)
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
if (ctx->Viewport.Near == nearval &&
ctx->Viewport.Far == farval)
if (ctx->ViewportArray[0].Near == nearval &&
ctx->ViewportArray[0].Far == farval)
return;
ctx->Viewport.Near = CLAMP(nearval, 0.0, 1.0);
ctx->Viewport.Far = CLAMP(farval, 0.0, 1.0);
ctx->ViewportArray[0].Near = CLAMP(nearval, 0.0, 1.0);
ctx->ViewportArray[0].Far = CLAMP(farval, 0.0, 1.0);
ctx->NewState |= _NEW_VIEWPORT;
#if 1
@@ -136,10 +136,10 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval)
* the WindowMap matrix being up to date in the driver's Viewport
* and DepthRange functions.
*/
_math_matrix_viewport(&ctx->Viewport._WindowMap,
ctx->Viewport.X, ctx->Viewport.Y,
ctx->Viewport.Width, ctx->Viewport.Height,
ctx->Viewport.Near, ctx->Viewport.Far,
_math_matrix_viewport(&ctx->ViewportArray[0]._WindowMap,
ctx->ViewportArray[0].X, ctx->ViewportArray[0].Y,
ctx->ViewportArray[0].Width, ctx->ViewportArray[0].Height,
ctx->ViewportArray[0].Near, ctx->ViewportArray[0].Far,
ctx->DrawBuffer->_DepthMaxF);
#endif
@@ -163,15 +163,15 @@ void _mesa_init_viewport(struct gl_context *ctx)
GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
/* Viewport group */
ctx->Viewport.X = 0;
ctx->Viewport.Y = 0;
ctx->Viewport.Width = 0;
ctx->Viewport.Height = 0;
ctx->Viewport.Near = 0.0;
ctx->Viewport.Far = 1.0;
_math_matrix_ctr(&ctx->Viewport._WindowMap);
ctx->ViewportArray[0].X = 0;
ctx->ViewportArray[0].Y = 0;
ctx->ViewportArray[0].Width = 0;
ctx->ViewportArray[0].Height = 0;
ctx->ViewportArray[0].Near = 0.0;
ctx->ViewportArray[0].Far = 1.0;
_math_matrix_ctr(&ctx->ViewportArray[0]._WindowMap);
_math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0,
_math_matrix_viewport(&ctx->ViewportArray[0]._WindowMap, 0, 0, 0, 0,
0.0F, 1.0F, depthMax);
}
@@ -182,6 +182,6 @@ void _mesa_init_viewport(struct gl_context *ctx)
*/
void _mesa_free_viewport_data(struct gl_context *ctx)
{
_math_matrix_dtr(&ctx->Viewport._WindowMap);
_math_matrix_dtr(&ctx->ViewportArray[0]._WindowMap);
}

View File

@@ -353,9 +353,9 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
((int *)value)[0] = ctx->DrawBuffer->Visual.samples;
return;
case STATE_DEPTH_RANGE:
value[0] = ctx->Viewport.Near; /* near */
value[1] = ctx->Viewport.Far; /* far */
value[2] = ctx->Viewport.Far - ctx->Viewport.Near; /* far - near */
value[0] = ctx->ViewportArray[0].Near; /* near */
value[1] = ctx->ViewportArray[0].Far; /* far */
value[2] = ctx->ViewportArray[0].Far - ctx->ViewportArray[0].Near; /* far - near */
value[3] = 1.0;
return;
case STATE_FRAGMENT_PROGRAM:

View File

@@ -62,12 +62,12 @@ update_viewport( struct st_context *st )
/* _NEW_VIEWPORT
*/
{
GLfloat x = ctx->Viewport.X;
GLfloat y = ctx->Viewport.Y;
GLfloat z = ctx->Viewport.Near;
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;
GLfloat x = ctx->ViewportArray[0].X;
GLfloat y = ctx->ViewportArray[0].Y;
GLfloat z = ctx->ViewportArray[0].Near;
GLfloat half_width = ctx->ViewportArray[0].Width * 0.5f;
GLfloat half_height = ctx->ViewportArray[0].Height * 0.5f;
GLfloat half_depth = (GLfloat)(ctx->ViewportArray[0].Far - ctx->ViewportArray[0].Near) * 0.5f;
st->state.viewport.scale[0] = half_width;
st->state.viewport.scale[1] = half_height * yScale;

View File

@@ -74,10 +74,10 @@ _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 > (GLfloat) ctx->DrawBuffer->Width
|| ctx->Viewport.Y < 0
|| ctx->Viewport.Y + ctx->Viewport.Height > (GLfloat) ctx->DrawBuffer->Height) {
if ( ctx->ViewportArray[0].X < 0
|| ctx->ViewportArray[0].X + ctx->ViewportArray[0].Width > (GLfloat) ctx->DrawBuffer->Width
|| ctx->ViewportArray[0].Y < 0
|| ctx->ViewportArray[0].Y + ctx->ViewportArray[0].Height > (GLfloat) ctx->DrawBuffer->Height) {
rasterMask |= CLIP_BIT;
}

View File

@@ -171,12 +171,12 @@ _swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span )
GLfloat min_f, max_f;
GLuint i;
if (ctx->Viewport.Near < ctx->Viewport.Far) {
min_f = ctx->Viewport.Near;
max_f = ctx->Viewport.Far;
if (ctx->ViewportArray[0].Near < ctx->ViewportArray[0].Far) {
min_f = ctx->ViewportArray[0].Near;
max_f = ctx->ViewportArray[0].Far;
} else {
min_f = ctx->Viewport.Far;
max_f = ctx->Viewport.Near;
min_f = ctx->ViewportArray[0].Far;
max_f = ctx->ViewportArray[0].Near;
}
/* Convert floating point values in [0,1] to device Z coordinates in

View File

@@ -167,7 +167,7 @@ setup_vertex_format(struct gl_context *ctx)
EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize );
_tnl_install_attrs( ctx, map, e,
ctx->Viewport._WindowMap.m,
ctx->ViewportArray[0]._WindowMap.m,
sizeof(SWvertex) );
swsetup->last_index_bitset = index_bitset;
@@ -265,7 +265,7 @@ _swsetup_Wakeup( struct gl_context *ctx )
void
_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest )
{
const GLfloat *m = ctx->Viewport._WindowMap.m;
const GLfloat *m = ctx->ViewportArray[0]._WindowMap.m;
GLfloat tmp[4];
GLuint i;

View File

@@ -409,19 +409,19 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
ndc[1] = clip[1] * d;
ndc[2] = clip[2] * d;
/* wincoord = viewport_mapping(ndc) */
ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX]
+ ctx->Viewport._WindowMap.m[MAT_TX]);
ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY]
+ ctx->Viewport._WindowMap.m[MAT_TY]);
ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ]
+ ctx->Viewport._WindowMap.m[MAT_TZ])
ctx->Current.RasterPos[0] = (ndc[0] * ctx->ViewportArray[0]._WindowMap.m[MAT_SX]
+ ctx->ViewportArray[0]._WindowMap.m[MAT_TX]);
ctx->Current.RasterPos[1] = (ndc[1] * ctx->ViewportArray[0]._WindowMap.m[MAT_SY]
+ ctx->ViewportArray[0]._WindowMap.m[MAT_TY]);
ctx->Current.RasterPos[2] = (ndc[2] * ctx->ViewportArray[0]._WindowMap.m[MAT_SZ]
+ ctx->ViewportArray[0]._WindowMap.m[MAT_TZ])
/ ctx->DrawBuffer->_DepthMaxF;
ctx->Current.RasterPos[3] = clip[3];
if (ctx->Transform.DepthClamp) {
ctx->Current.RasterPos[3] = CLAMP(ctx->Current.RasterPos[3],
ctx->Viewport.Near,
ctx->Viewport.Far);
ctx->ViewportArray[0].Near,
ctx->ViewportArray[0].Far);
}
/* compute raster distance */