dri_util: Update internal_format to GL_RGB8 for MESA_FORMAT_B8G8R8X8_UNORM
[mesa.git] / src / mesa / main / eval.c
index f739dbb8a5a19350c559c65adb8077e1dd81d5a1..874f5255e9c2e9b921b34ba9eb402f2be71eaadd 100644 (file)
@@ -1,7 +1,6 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
  *
  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 
@@ -38,8 +38,6 @@
 
 
 #include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
 #include "context.h"
 #include "eval.h"
 #include "macros.h"
@@ -310,7 +308,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
    GLfloat *pnts;
    struct gl_1d_map *map = NULL;
 
-   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
+   assert(type == GL_FLOAT || type == GL_DOUBLE);
 
    if (u1 == u2) {
       _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" );
@@ -355,7 +353,8 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
       pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
 
 
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   FLUSH_VERTICES(ctx, 0);
+   vbo_exec_update_eval_maps(ctx);
    map->Order = uorder;
    map->u1 = u1;
    map->u2 = u2;
@@ -392,7 +391,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
    GLfloat *pnts;
    struct gl_2d_map *map = NULL;
 
-   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);
+   assert(type == GL_FLOAT || type == GL_DOUBLE);
 
    if (u1==u2) {
       _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
@@ -450,7 +449,8 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
                                   vstride, vorder, (GLdouble*) points);
 
 
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   FLUSH_VERTICES(ctx, 0);
+   vbo_exec_update_eval_maps(ctx);
    map->Uorder = uorder;
    map->u1 = u1;
    map->u2 = u2;
@@ -481,7 +481,7 @@ _mesa_Map2d( GLenum target,
              GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
              const GLdouble *points )
 {
-   map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, 
+   map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder,
        (GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE);
 }
 
@@ -506,7 +506,7 @@ _mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v )
 
    map1d = get_1d_map(ctx, target);
    map2d = get_2d_map(ctx, target);
-   ASSERT(map1d || map2d);
+   assert(map1d || map2d);
 
    switch (query) {
       case GL_COEFF:
@@ -596,7 +596,7 @@ _mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v )
 
    map1d = get_1d_map(ctx, target);
    map2d = get_2d_map(ctx, target);
-   ASSERT(map1d || map2d);
+   assert(map1d || map2d);
 
    switch (query) {
       case GL_COEFF:
@@ -688,7 +688,7 @@ _mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v )
 
    map1d = get_1d_map(ctx, target);
    map2d = get_2d_map(ctx, target);
-   ASSERT(map1d || map2d);
+   assert(map1d || map2d);
 
    switch (query) {
       case GL_COEFF:
@@ -705,7 +705,7 @@ _mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v )
             if (bufSize < numBytes)
                goto overflow;
            for (i=0;i<n;i++) {
-              v[i] = IROUND(data[i]);
+              v[i] = lroundf(data[i]);
            }
         }
          break;
@@ -729,17 +729,17 @@ _mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v )
             numBytes = 2 * sizeof *v;
             if (bufSize < numBytes)
                goto overflow;
-            v[0] = IROUND(map1d->u1);
-            v[1] = IROUND(map1d->u2);
+            v[0] = lroundf(map1d->u1);
+            v[1] = lroundf(map1d->u2);
          }
          else {
             numBytes = 4 * sizeof *v;
             if (bufSize < numBytes)
                goto overflow;
-            v[0] = IROUND(map2d->u1);
-            v[1] = IROUND(map2d->u2);
-            v[2] = IROUND(map2d->v1);
-            v[3] = IROUND(map2d->v2);
+            v[0] = lroundf(map2d->u1);
+            v[1] = lroundf(map2d->u2);
+            v[2] = lroundf(map2d->v1);
+            v[3] = lroundf(map2d->v2);
          }
          break;
       default:
@@ -770,7 +770,8 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
       _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" );
       return;
    }
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   FLUSH_VERTICES(ctx, 0);
+   vbo_exec_update_eval_maps(ctx);
    ctx->Eval.MapGrid1un = un;
    ctx->Eval.MapGrid1u1 = u1;
    ctx->Eval.MapGrid1u2 = u2;
@@ -800,7 +801,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_EVAL);
+   FLUSH_VERTICES(ctx, 0);
+   vbo_exec_update_eval_maps(ctx);
    ctx->Eval.MapGrid2un = un;
    ctx->Eval.MapGrid2u1 = u1;
    ctx->Eval.MapGrid2u2 = u2;
@@ -816,15 +818,14 @@ void GLAPIENTRY
 _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
                  GLint vn, GLdouble v1, GLdouble v2 )
 {
-   _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2, 
+   _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2,
                    vn, (GLfloat) v1, (GLfloat) v2 );
 }
 
 
 void
 _mesa_install_eval_vtxfmt(struct _glapi_table *disp,
-                          const GLvertexformat *vfmt,
-                          bool beginend)
+                          const GLvertexformat *vfmt)
 {
    SET_EvalCoord1f(disp, vfmt->EvalCoord1f);
    SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv);
@@ -832,13 +833,6 @@ _mesa_install_eval_vtxfmt(struct _glapi_table *disp,
    SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv);
    SET_EvalPoint1(disp, vfmt->EvalPoint1);
    SET_EvalPoint2(disp, vfmt->EvalPoint2);
-
-   /* glEvalMesh1 and glEvalMesh2 are not allowed between glBegin and glEnd.
-    */
-   if (!beginend) {
-      SET_EvalMesh1(disp, vfmt->EvalMesh1);
-      SET_EvalMesh2(disp, vfmt->EvalMesh2);
-   }
 }
 
 
@@ -865,7 +859,7 @@ init_1d_map( struct gl_1d_map *map, int n, const float *initial )
 
 
 /**
- * Initialize a 2-D evaluator map 
+ * Initialize a 2-D evaluator map
  */
 static void
 init_2d_map( struct gl_2d_map *map, int n, const float *initial )