diff options
author | Ian Romanick <[email protected]> | 2013-11-05 22:36:38 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-01-20 11:31:59 -0800 |
commit | 9de863603d8092243df502365a75d65982223f0e (patch) | |
tree | 0e49c768abe940e76494bd19ad6c84dade3fbb7a /src/mesa/main/state.c | |
parent | f6d7cd4a11e70b816733cff681dde7d03588d1c8 (diff) |
mesa: Initialize all the viewports
v2: Use MAX_VIEWPORTS instead of ctx->Const.MaxViewports because the
driver may not set ctx->Const.MaxViewports yet.
v3: Handle all viewport entries in update_viewport_matrix and
_mesa_copy_context too. This was previously in an earlier patch.
Having the code in the earlier patch could cause _mesa_copy_context to
access a matrix that hadn't been constructed.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]> [v2]
Diffstat (limited to 'src/mesa/main/state.c')
-rw-r--r-- | src/mesa/main/state.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index acb2f2073d2..87f6553a5f9 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -269,6 +269,7 @@ static void update_viewport_matrix(struct gl_context *ctx) { const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; + unsigned i; ASSERT(depthMax > 0); @@ -276,11 +277,13 @@ update_viewport_matrix(struct gl_context *ctx) * and should be maintained elsewhere if at all. * NOTE: RasterPos uses this. */ - _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); + for (i = 0; i < ctx->Const.MaxViewports; i++) { + _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap, + ctx->ViewportArray[i].X, ctx->ViewportArray[i].Y, + ctx->ViewportArray[i].Width, ctx->ViewportArray[i].Height, + ctx->ViewportArray[i].Near, ctx->ViewportArray[i].Far, + depthMax); + } } |