[Mesa-dev] [PATCH 001/101] mesa: add depth_range_arrayv() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Jul 21 17:39:10 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/viewport.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 0a5caf04c6..d010c8e6db 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -346,10 +346,20 @@ _mesa_DepthRangef(GLclampf nearval, GLclampf farval)
  * \param v       pointer to memory containing
  *                GLclampd near and far clip-plane values
  */
+static ALWAYS_INLINE void
+depth_range_arrayv(struct gl_context *ctx, GLuint first, GLsizei count,
+                   const struct gl_depthrange_inputs *const inputs)
+{
+   for (GLsizei i = 0; i < count; i++)
+      set_depth_range_no_notify(ctx, i + first, inputs[i].Near, inputs[i].Far);
+
+   if (ctx->Driver.DepthRange)
+      ctx->Driver.DepthRange(ctx);
+}
+
 void GLAPIENTRY
 _mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
 {
-   int i;
    const struct gl_depthrange_inputs *const p =
       (struct gl_depthrange_inputs *) v;
    GET_CURRENT_CONTEXT(ctx);
@@ -364,11 +374,7 @@ _mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
       return;
    }
 
-   for (i = 0; i < count; i++)
-      set_depth_range_no_notify(ctx, i + first, p[i].Near, p[i].Far);
-
-   if (ctx->Driver.DepthRange)
-      ctx->Driver.DepthRange(ctx);
+   depth_range_arrayv(ctx, first, count, p);
 }
 
 void GLAPIENTRY
-- 
2.13.3



More information about the mesa-dev mailing list