mesa: Support EXT_framebuffer_blit targets in ES 3.0 as well.
[mesa.git] / src / mesa / main / clip.c
index a061980af424a2add0106299706850b436b17750..ba2028cf2e19ed82fee223d4dc1b66766525c637 100644 (file)
@@ -1,9 +1,8 @@
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.3
  *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
 #include "macros.h"
 #include "mtypes.h"
 
-#include "math/m_xform.h"
 #include "math/m_matrix.h"
 
 
+/**
+ * Update derived clip plane state.
+ */
+void
+_mesa_update_clip_plane(struct gl_context *ctx, GLuint plane)
+{
+   if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top))
+      _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
 
-/**********************************************************************/
-/*                     Get/Set User clip-planes.                      */
-/**********************************************************************/
-
+   /* Clip-Space Plane = Eye-Space Plane * Projection Matrix */
+   _mesa_transform_vector(ctx->Transform._ClipUserPlane[plane],
+                          ctx->Transform.EyeUserPlane[plane],
+                          ctx->ProjectionMatrixStack.Top->inv);
+}
 
 
-void
+void GLAPIENTRY
 _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -68,7 +75,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
     * clipping now takes place.  The clip-space equations are recalculated
     * whenever the projection matrix changes.
     */
-   if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY)
+   if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top))
       _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
 
    _mesa_transform_vector( equation, equation,
@@ -80,17 +87,8 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
    FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
    COPY_4FV(ctx->Transform.EyeUserPlane[p], equation);
 
-   /* Update derived state.  This state also depends on the projection
-    * matrix, and is recalculated on changes to the projection matrix by
-    * code in _mesa_update_state().
-    */
    if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
-      if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
-         _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
-
-      _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
-                          ctx->Transform.EyeUserPlane[p],
-                          ctx->ProjectionMatrixStack.Top->inv );
+      _mesa_update_clip_plane(ctx, p);
    }
 
    if (ctx->Driver.ClipPlane)
@@ -98,7 +96,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
 }
 
 
-void
+void GLAPIENTRY
 _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -116,4 +114,3 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
    equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2];
    equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3];
 }
-