mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
mesa: Move parameter validation from _mesa_set_viewport to _mesa_Viewport
Internal callers should do the right thing. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
a9c73fb778
commit
83bd850cc7
1 changed files with 10 additions and 9 deletions
|
|
@ -47,6 +47,16 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_VERTICES(ctx, 0);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
|
||||
|
||||
if (width < 0 || height < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glViewport(%d, %d, %d, %d)", x, y, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
_mesa_set_viewport(ctx, x, y, width, height);
|
||||
}
|
||||
|
||||
|
|
@ -64,15 +74,6 @@ void
|
|||
_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height)
|
||||
{
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height);
|
||||
|
||||
if (width < 0 || height < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glViewport(%d, %d, %d, %d)", x, y, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
/* clamp width and height to the implementation dependent range */
|
||||
width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
|
||||
height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue