aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
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/drivers
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/drivers')
-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
12 files changed, 52 insertions, 52 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;