summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <[email protected]>2013-11-13 16:24:56 -0700
committerIan Romanick <[email protected]>2014-01-20 11:31:56 -0800
commitcbb271a48845c2d236f31327df316d42888a1907 (patch)
treea860c48f113d8171d31d77bacf1c341627e4c099 /src/mesa
parent5b84226c31e941219422f6d60c31524081b7a188 (diff)
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 <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/meta.c28
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c24
-rw-r--r--src/mesa/drivers/dri/i965/brw_cc.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_state.c12
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/gen6_clip_state.c8
-rw-r--r--src/mesa/drivers/dri/i965/gen6_viewport_state.c6
-rw-r--r--src/mesa/drivers/dri/i965/gen7_viewport_state.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_util.h4
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_fb.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c4
-rw-r--r--src/mesa/main/attrib.c5
-rw-r--r--src/mesa/main/context.c18
-rw-r--r--src/mesa/main/get.c12
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/rastpos.c5
-rw-r--r--src/mesa/main/state.c8
-rw-r--r--src/mesa/main/viewport.c52
-rw-r--r--src/mesa/program/prog_statevars.c6
-rw-r--r--src/mesa/state_tracker/st_atom_viewport.c12
-rw-r--r--src/mesa/swrast/s_context.c8
-rw-r--r--src/mesa/swrast/s_depth.c10
-rw-r--r--src/mesa/swrast_setup/ss_context.c4
-rw-r--r--src/mesa/tnl/t_rasterpos.c16
25 files changed, 134 insertions, 128 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 3608ee85c58..48203c7e4a7 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -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);
}
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index 94be2379854..f31b271500f 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -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);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c
index 2f4e9dcb196..eeb63c6d0bd 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c
index 021acc80e52..de25b86bcfe 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 / 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 =
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index db3a34d3e0e..50f356f96b1 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -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);
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 8dcca84c216..e4dc278e172 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -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;
}
diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c
index 4c5135b84a3..0c5de0a2f38 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 / 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);
diff --git a/src/mesa/drivers/dri/i965/gen7_viewport_state.c b/src/mesa/drivers/dri/i965/gen7_viewport_state.c
index 66c183845a0..ed7d8c9523f 100644
--- a/src/mesa/drivers/dri/i965/gen7_viewport_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_viewport_state.c
@@ -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;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index 17d6965ee2c..e44e8efba29 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -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;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 87ae1d6e006..6f554618814 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -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] = {};
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 8939ea24ae8..7c46d11e0c9 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -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;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index ddc2e20fd5f..4a19db4bf24 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -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;
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index f571f9fc7f0..3a6bf05eee9 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -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;
}
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 538322e9eb8..5c67159e5a9 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -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?
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index fa48195cdf4..c8accb6d261 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -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:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1231a6f4415..cac02061516 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -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 */
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 1acdb8b53eb..a9a6ceec0c1 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -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;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 33070b7e02d..acb2f2073d2 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -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);
}
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 8eede518f9d..360f066a966 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -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);
-
- _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0,
+ 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->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);
}
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 58e1f496eaa..5dda8e28d65 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -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:
diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c
index a88160fc876..8c6d679a041 100644
--- a/src/mesa/state_tracker/st_atom_viewport.c
+++ b/src/mesa/state_tracker/st_atom_viewport.c
@@ -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;
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 8a5de4761c2..07485006cb7 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -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;
}
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 0f4fb950602..7f3c76de40a 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -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
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index 1be37d4c8cd..12a47358faf 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -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;
diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c
index 3ee5c454793..e538c348fd8 100644
--- a/src/mesa/tnl/t_rasterpos.c
+++ b/src/mesa/tnl/t_rasterpos.c
@@ -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 */