Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / mesa / main / viewport.c
index 50e0402d2788001c803e0c53d4d890cda0ee3ef3..4747022d0b42c02aa2711925d825f02acc846625 100644 (file)
@@ -60,7 +60,7 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
  * \param height height of the viewport rectangle.
  */
 void
-_mesa_set_viewport(GLcontext *ctx, GLint x, GLint y,
+_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
                     GLsizei width, GLsizei height)
 {
    if (MESA_VERBOSE & VERBOSE_API)
@@ -120,6 +120,10 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval)
    if (MESA_VERBOSE&VERBOSE_API)
       _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval);
 
+   if (ctx->Viewport.Near == nearval &&
+       ctx->Viewport.Far == farval)
+      return;
+
    ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0);
    ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0);
    ctx->NewState |= _NEW_VIEWPORT;
@@ -147,7 +151,7 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval)
  * Initialize the context viewport attribute group.
  * \param ctx  the GL context.
  */
-void _mesa_init_viewport(GLcontext *ctx)
+void _mesa_init_viewport(struct gl_context *ctx)
 {
    GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
 
@@ -169,7 +173,7 @@ void _mesa_init_viewport(GLcontext *ctx)
  * Free the context viewport attribute group data.
  * \param ctx  the GL context.
  */
-void _mesa_free_viewport_data(GLcontext *ctx)
+void _mesa_free_viewport_data(struct gl_context *ctx)
 {
    _math_matrix_dtr(&ctx->Viewport._WindowMap);
 }