[Mesa-dev] [PATCH 5/8] mesa: add viewport_array() helper
Samuel Pitoiset
samuel.pitoiset at gmail.com
Thu Jun 22 14:36:27 UTC 2017
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/mesa/main/viewport.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 54d6e9905cf..5e28cf35c42 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -146,6 +146,19 @@ _mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y,
ctx->Driver.Viewport(ctx);
}
+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)
{
@@ -175,13 +188,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
--
2.13.1
More information about the mesa-dev
mailing list