summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-06-22 15:22:25 +0200
committerSamuel Pitoiset <[email protected]>2017-06-23 09:26:43 +0200
commite1d6de7a1e657c9257452b0ebc6344b67b3b27f6 (patch)
treed9ea91358101e05fda41e3bd134f8bbb964b9fdc /src/mesa/main
parent0a667f03bbf7c180dbee5a2dd14ed302bad4943a (diff)
mesa: add viewport_array() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/viewport.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index b94cb56a4b7..3265f3f59d2 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -155,6 +155,19 @@ _mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y,
}
}
+static void
+viewport_array(struct gl_context *ctx, GLuint first, GLsizei count,
+ const struct gl_viewport_inputs *inputs)
+{
+ for (GLsizei i = 0; i < count; i++) {
+ set_viewport_no_notify(ctx, i + first, inputs[i].X, inputs[i].Y,
+ inputs[i].Width, inputs[i].Height);
+ }
+
+ if (ctx->Driver.Viewport)
+ ctx->Driver.Viewport(ctx);
+}
+
void GLAPIENTRY
_mesa_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
{
@@ -184,13 +197,7 @@ _mesa_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
}
}
- for (i = 0; i < count; i++)
- set_viewport_no_notify(ctx, i + first,
- p[i].X, p[i].Y,
- p[i].Width, p[i].Height);
-
- if (ctx->Driver.Viewport)
- ctx->Driver.Viewport(ctx);
+ viewport_array(ctx, first, count, p);
}
static void