Merge remote branch 'origin/master' into lp-binning
[mesa.git] / src / mesa / main / dlist.c
index d3090b4a3b85f2de43f6ecbbfff4fe7849e92ea1..b182bbe0d0011e23a8b85c9428208ff0b48e0cea 100644 (file)
 #include "api_loopback.h"
 #include "config.h"
 #include "mfeatures.h"
-#include "attrib.h"
-#include "blend.h"
-#include "buffers.h"
 #if FEATURE_ARB_vertex_buffer_object
 #include "bufferobj.h"
 #endif
 #include "arrayobj.h"
-#include "clip.h"
-#include "colortab.h"
 #include "context.h"
-#include "convolve.h"
-#include "depth.h"
 #include "dlist.h"
-#include "enable.h"
 #include "enums.h"
 #include "eval.h"
-#include "extensions.h"
-#include "feedback.h"
 #include "framebuffer.h"
-#include "get.h"
 #include "glapi/glapi.h"
 #include "hash.h"
-#include "histogram.h"
 #include "image.h"
 #include "light.h"
-#include "lines.h"
 #include "dlist.h"
 #include "macros.h"
-#include "matrix.h"
-#include "pixel.h"
-#include "points.h"
-#include "polygon.h"
 #include "queryobj.h"
-#include "state.h"
-#include "texobj.h"
 #include "teximage.h"
-#include "texstate.h"
 #include "mtypes.h"
 #include "varray.h"
-#include "vtxfmt.h"
 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
 #include "shader/arbprogram.h"
 #include "shader/program.h"
@@ -218,6 +197,10 @@ typedef enum
    OPCODE_CLEAR_DEPTH,
    OPCODE_CLEAR_INDEX,
    OPCODE_CLEAR_STENCIL,
+   OPCODE_CLEAR_BUFFER_IV,
+   OPCODE_CLEAR_BUFFER_UIV,
+   OPCODE_CLEAR_BUFFER_FV,
+   OPCODE_CLEAR_BUFFER_FI,
    OPCODE_CLIP_PLANE,
    OPCODE_COLOR_MASK,
    OPCODE_COLOR_MASK_INDEXED,
@@ -1233,6 +1216,110 @@ save_Clear(GLbitfield mask)
 }
 
 
+static void GLAPIENTRY
+save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
+   if (n) {
+      n[1].e = buffer;
+      n[2].i = drawbuffer;
+      n[3].i = value[0];
+      if (buffer == GL_COLOR) {
+         n[4].i = value[1];
+         n[5].i = value[2];
+         n[6].i = value[3];
+      }
+      else {
+         n[4].i = 0;
+         n[5].i = 0;
+         n[6].i = 0;
+      }
+   }
+   if (ctx->ExecuteFlag) {
+      /*CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));*/
+   }
+}
+
+
+static void GLAPIENTRY
+save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_UIV, 6);
+   if (n) {
+      n[1].e = buffer;
+      n[2].i = drawbuffer;
+      n[3].ui = value[0];
+      if (buffer == GL_COLOR) {
+         n[4].ui = value[1];
+         n[5].ui = value[2];
+         n[6].ui = value[3];
+      }
+      else {
+         n[4].ui = 0;
+         n[5].ui = 0;
+         n[6].ui = 0;
+      }
+   }
+   if (ctx->ExecuteFlag) {
+      /*CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));*/
+   }
+}
+
+
+static void GLAPIENTRY
+save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
+   if (n) {
+      n[1].e = buffer;
+      n[2].i = drawbuffer;
+      n[3].f = value[0];
+      if (buffer == GL_COLOR) {
+         n[4].f = value[1];
+         n[5].f = value[2];
+         n[6].f = value[3];
+      }
+      else {
+         n[4].f = 0.0F;
+         n[5].f = 0.0F;
+         n[6].f = 0.0F;
+      }
+   }
+   if (ctx->ExecuteFlag) {
+      /*CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));*/
+   }
+}
+
+
+static void GLAPIENTRY
+save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
+                   GLfloat depth, GLint stencil)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
+   if (n) {
+      n[1].e = buffer;
+      n[2].i = drawbuffer;
+      n[3].f = depth;
+      n[4].i = stencil;
+   }
+   if (ctx->ExecuteFlag) {
+      /*CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));*/
+   }
+}
+
+
 static void GLAPIENTRY
 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
 {
@@ -1951,7 +2038,7 @@ save_DisableIndexed(GLuint index, GLenum cap)
       n[2].e = cap;
    }
    if (ctx->ExecuteFlag) {
-      /*CALL_DisableIndexedEXT(ctx->Exec, (index, cap));*/
+      CALL_DisableIndexedEXT(ctx->Exec, (index, cap));
    }
 }
 
@@ -2026,7 +2113,7 @@ save_EnableIndexed(GLuint index, GLenum cap)
       n[2].e = cap;
    }
    if (ctx->ExecuteFlag) {
-      /*CALL_EnableIndexed(ctx->Exec, (index, cap));*/
+      CALL_EnableIndexedEXT(ctx->Exec, (index, cap));
    }
 }
 
@@ -3642,7 +3729,7 @@ save_TexEnvi(GLenum target, GLenum pname, GLint param)
 {
    GLfloat p[4];
    p[0] = (GLfloat) param;
-   p[1] = p[2] = p[3] = 0.0;
+   p[1] = p[2] = p[3] = 0.0F;
    save_TexEnvfv(target, pname, p);
 }
 
@@ -3776,7 +3863,7 @@ save_TexParameteri(GLenum target, GLenum pname, GLint param)
 {
    GLfloat fparam[4];
    fparam[0] = (GLfloat) param;
-   fparam[1] = fparam[2] = fparam[3] = 0.0;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
    save_TexParameterfv(target, pname, fparam);
 }
 
@@ -3786,7 +3873,7 @@ save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
 {
    GLfloat fparam[4];
    fparam[0] = (GLfloat) params[0];
-   fparam[1] = fparam[2] = fparam[3] = 0.0;
+   fparam[1] = fparam[2] = fparam[3] = 0.0F;
    save_TexParameterfv(target, pname, fparam);
 }
 
@@ -6655,6 +6742,39 @@ execute_list(GLcontext *ctx, GLuint list)
          case OPCODE_CLEAR:
             CALL_Clear(ctx->Exec, (n[1].bf));
             break;
+         case OPCODE_CLEAR_BUFFER_IV:
+            {
+               GLint value[4];
+               value[0] = n[3].i;
+               value[1] = n[4].i;
+               value[2] = n[5].i;
+               value[3] = n[6].i;
+               /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
+            }
+            break;
+         case OPCODE_CLEAR_BUFFER_UIV:
+            {
+               GLuint value[4];
+               value[0] = n[3].ui;
+               value[1] = n[4].ui;
+               value[2] = n[5].ui;
+               value[3] = n[6].ui;
+               /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
+            }
+            break;
+         case OPCODE_CLEAR_BUFFER_FV:
+            {
+               GLfloat value[4];
+               value[0] = n[3].f;
+               value[1] = n[4].f;
+               value[2] = n[5].f;
+               value[3] = n[6].f;
+               /*CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));*/
+            }
+            break;
+         case OPCODE_CLEAR_BUFFER_FI:
+            /*CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));*/
+            break;
          case OPCODE_CLEAR_COLOR:
             CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
             break;
@@ -6684,10 +6804,8 @@ execute_list(GLcontext *ctx, GLuint list)
             CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
             break;
          case OPCODE_COLOR_MASK_INDEXED:
-            /*
             CALL_ColorMaskIndexedEXT(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
                                                  n[4].b, n[5].b));
-            */
             break;
          case OPCODE_COLOR_MATERIAL:
             CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
@@ -6832,7 +6950,7 @@ execute_list(GLcontext *ctx, GLuint list)
             CALL_Disable(ctx->Exec, (n[1].e));
             break;
          case OPCODE_DISABLE_INDEXED:
-            /*CALL_DisableIndexed(ctx->Exec, (n[1].ui, n[2].e));*/
+            CALL_DisableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
             break;
          case OPCODE_DRAW_BUFFER:
             CALL_DrawBuffer(ctx->Exec, (n[1].e));
@@ -6850,7 +6968,7 @@ execute_list(GLcontext *ctx, GLuint list)
             CALL_Enable(ctx->Exec, (n[1].e));
             break;
          case OPCODE_ENABLE_INDEXED:
-            /*CALL_EnableIndexed(ctx->Exec, (n[1].ui, n[2].e));*/
+            CALL_EnableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
             break;
          case OPCODE_EVALMESH1:
             CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
@@ -8611,8 +8729,7 @@ _mesa_init_save_table(struct _glapi_table *table)
    SET_ClearStencil(table, save_ClearStencil);
    SET_ClipPlane(table, save_ClipPlane);
    SET_ColorMask(table, save_ColorMask);
-   /*SET_ColorMaskIndexedEXT(table, save_ColorMaskIndexed);*/
-   (void) save_ColorMaskIndexed;
+   SET_ColorMaskIndexedEXT(table, save_ColorMaskIndexed);
    SET_ColorMaterial(table, save_ColorMaterial);
    SET_CopyPixels(table, save_CopyPixels);
    SET_CullFace(table, save_CullFace);
@@ -8621,13 +8738,11 @@ _mesa_init_save_table(struct _glapi_table *table)
    SET_DepthMask(table, save_DepthMask);
    SET_DepthRange(table, save_DepthRange);
    SET_Disable(table, save_Disable);
-   /*SET_DisableIndexed(table, save_DisableIndexed);*/
-   (void) save_DisableIndexed;
+   SET_DisableIndexedEXT(table, save_DisableIndexed);
    SET_DrawBuffer(table, save_DrawBuffer);
    SET_DrawPixels(table, save_DrawPixels);
    SET_Enable(table, save_Enable);
-   /*SET_EnableIndexed(table, save_EnableIndexed);*/
-   (void) save_EnableIndexed;
+   SET_EnableIndexedEXT(table, save_EnableIndexed);
    SET_EndList(table, _mesa_EndList);
    SET_EvalMesh1(table, save_EvalMesh1);
    SET_EvalMesh2(table, save_EvalMesh2);
@@ -9171,6 +9286,19 @@ _mesa_init_save_table(struct _glapi_table *table)
 
    /* 364. GL_EXT_provoking_vertex */
    SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT);
+
+   /* GL 3.0 */
+#if 0
+   SET_ClearBufferiv(table, save_ClearBufferiv);
+   SET_ClearBufferuiv(table, save_ClearBufferuiv);
+   SET_ClearBufferfv(table, save_ClearBufferfv);
+   SET_ClearBufferfi(table, save_ClearBufferfi);
+#else
+   (void) save_ClearBufferiv;
+   (void) save_ClearBufferuiv;
+   (void) save_ClearBufferfv;
+   (void) save_ClearBufferfi;
+#endif
 }