mesa: Add an index parameter to _mesa_set_viewport

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2014-01-07 16:57:11 -08:00
parent cbb271a488
commit 3eb135d1c7
4 changed files with 23 additions and 19 deletions
+7 -7
View File
@@ -746,7 +746,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
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,
_mesa_set_viewport(ctx, 0, 0, 0,
ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
}
/* save depth range state */
@@ -1093,7 +1093,7 @@ _mesa_meta_end(struct gl_context *ctx)
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,
_mesa_set_viewport(ctx, 0, save->ViewportX, save->ViewportY,
save->ViewportW, save->ViewportH);
}
_mesa_DepthRange(save->DepthNear, save->DepthFar);
@@ -1761,7 +1761,7 @@ blitframebuffer_texture(struct gl_context *ctx,
}
/* setup viewport */
_mesa_set_viewport(ctx, dstX, dstY, dstW, dstH);
_mesa_set_viewport(ctx, 0, dstX, dstY, dstW, dstH);
_mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
_mesa_DepthMask(GL_FALSE);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
@@ -1916,7 +1916,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
}
_mesa_set_viewport(ctx, dstX, dstY, dstW, dstH);
_mesa_set_viewport(ctx, 0, dstX, dstY, dstW, dstH);
_mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
_mesa_set_enable(ctx, GL_DEPTH_TEST, GL_FALSE);
_mesa_DepthMask(GL_FALSE);
@@ -1965,7 +1965,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
_mesa_DepthFunc(GL_ALWAYS);
_mesa_DepthMask(GL_TRUE);
_mesa_set_viewport(ctx, dstX, dstY, dstW, dstH);
_mesa_set_viewport(ctx, 0, dstX, dstY, dstW, dstH);
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
mask &= ~GL_DEPTH_BUFFER_BIT;
@@ -3782,7 +3782,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
assert(dstHeight == ctx->DrawBuffer->Height);
/* setup viewport */
_mesa_set_viewport(ctx, 0, 0, dstWidth, dstHeight);
_mesa_set_viewport(ctx, 0, 0, 0, dstWidth, dstHeight);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
@@ -4072,7 +4072,7 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
_mesa_Ortho(0.0, width, 0.0, height, -1.0, 1.0);
_mesa_set_viewport(ctx, 0, 0, width, height);
_mesa_set_viewport(ctx, 0, 0, 0, width, height);
/* upload new vertex data */
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+1 -1
View File
@@ -1437,7 +1437,7 @@ _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height)
* potential infinite recursion.
*/
ctx->ViewportInitialized = GL_TRUE;
_mesa_set_viewport(ctx, 0, 0, width, height);
_mesa_set_viewport(ctx, 0, 0, 0, width, height);
_mesa_set_scissor(ctx, 0, 0, width, height);
}
}
+14 -10
View File
@@ -57,7 +57,7 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
return;
}
_mesa_set_viewport(ctx, x, y, width, height);
_mesa_set_viewport(ctx, 0, x, y, width, height);
}
@@ -66,22 +66,23 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
* matrix). Usually called from _mesa_Viewport().
*
* \param ctx GL context.
* \param idx Index of the viewport to be updated.
* \param x, y coordinates of the lower left corner of the viewport rectangle.
* \param width width of the viewport rectangle.
* \param height height of the viewport rectangle.
*/
void
_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
_mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLint x, GLint y,
GLsizei width, GLsizei height)
{
/* clamp width and height to the implementation dependent range */
width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
ctx->ViewportArray[0].X = x;
ctx->ViewportArray[0].Width = width;
ctx->ViewportArray[0].Y = y;
ctx->ViewportArray[0].Height = height;
ctx->ViewportArray[idx].X = x;
ctx->ViewportArray[idx].Width = width;
ctx->ViewportArray[idx].Y = y;
ctx->ViewportArray[idx].Height = height;
ctx->NewState |= _NEW_VIEWPORT;
#if 1
@@ -89,10 +90,13 @@ _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->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,
_math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
ctx->ViewportArray[idx].X,
ctx->ViewportArray[idx].Y,
ctx->ViewportArray[idx].Width,
ctx->ViewportArray[idx].Height,
ctx->ViewportArray[idx].Near,
ctx->ViewportArray[idx].Far,
ctx->DrawBuffer->_DepthMaxF);
#endif
+1 -1
View File
@@ -36,7 +36,7 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
extern void
_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
_mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLint x, GLint y,
GLsizei width, GLsizei height);