mesa: Enable translation between astc 3d gl formats and mesa formats
[mesa.git] / src / mesa / main / api_arrayelt.c
index 536326f6e14bf323d437a0b6a11de77e0b6c82d9..c84db5f97f6eb3fb41748194364f81e108317be4 100644 (file)
@@ -65,7 +65,7 @@ typedef struct {
 typedef struct {
    AEarray arrays[32];
    AEattrib attribs[VERT_ATTRIB_MAX + 1];
-   GLuint NewState;
+   GLbitfield NewState;
 
    /* List of VBOs we need to map before executing ArrayElements */
    struct gl_buffer_object *vbo[VERT_ATTRIB_MAX];
@@ -1258,12 +1258,37 @@ VertexAttribI4uiv(GLuint index, const GLuint *v)
    CALL_VertexAttribI4uivEXT(GET_DISPATCH(), (index, v));
 }
 
+/* GL_DOUBLE unconverted attributes */
+
+static void GLAPIENTRY
+VertexAttribL1dv(GLuint index, const GLdouble *v)
+{
+   CALL_VertexAttribL1dv(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY
+VertexAttribL2dv(GLuint index, const GLdouble *v)
+{
+   CALL_VertexAttribL2dv(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY
+VertexAttribL3dv(GLuint index, const GLdouble *v)
+{
+   CALL_VertexAttribL3dv(GET_DISPATCH(), (index, v));
+}
+
+static void GLAPIENTRY
+VertexAttribL4dv(GLuint index, const GLdouble *v)
+{
+   CALL_VertexAttribL4dv(GET_DISPATCH(), (index, v));
+}
 
 /*
  * Array [unnormalized/normalized/integer][size][type] of VertexAttrib
  * functions
  */
-static attrib_func AttribFuncsARB[3][4][NUM_TYPES] = {
+static attrib_func AttribFuncsARB[4][4][NUM_TYPES] = {
    {
       /* non-normalized */
       {
@@ -1405,7 +1430,55 @@ static attrib_func AttribFuncsARB[3][4][NUM_TYPES] = {
          NULL, /* GL_FLOAT */
          NULL  /* GL_DOUBLE */
       }
+   },
+   {
+      /* double-valued */
+      {
+         /* size 1 */
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         (attrib_func) VertexAttribL1dv,
+      },
+      {
+         /* size 2 */
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         (attrib_func) VertexAttribL2dv,
+      },
+      {
+         /* size 3 */
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         (attrib_func) VertexAttribL3dv,
+      },
+      {
+         /* size 4 */
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         NULL,
+         (attrib_func) VertexAttribL4dv,
+      }
    }
+
 };
 
 
@@ -1548,7 +1621,7 @@ _ae_update_state(struct gl_context *ctx)
           */
          at->array = attribArray;
          at->binding = &vao->VertexBinding[attribArray->VertexBinding];
-         ASSERT(!at->array->Normalized);
+         assert(!at->array->Normalized);
          at->func = AttribFuncsNV[at->array->Normalized]
                                  [at->array->Size-1]
                                  [TYPE_IDX(at->array->Type)];
@@ -1571,7 +1644,9 @@ _ae_update_state(struct gl_context *ctx)
           * change from one execution of _ae_ArrayElement() to
           * the next.  Doing so caused UT to break.
           */
-         if (at->array->Integer)
+         if (at->array->Doubles)
+            intOrNorm = 3;
+         else if (at->array->Integer)
             intOrNorm = 2;
          else if (at->array->Normalized)
             intOrNorm = 1;
@@ -1610,8 +1685,8 @@ _ae_update_state(struct gl_context *ctx)
 
    check_vbo(actx, vao->IndexBufferObj);
 
-   ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX);
-   ASSERT(aa - actx->arrays < 32);
+   assert(at - actx->attribs <= VERT_ATTRIB_MAX);
+   assert(aa - actx->arrays < 32);
    at->func = NULL;  /* terminate the list */
    aa->offset = -1;  /* terminate the list */
 
@@ -1727,7 +1802,7 @@ _ae_ArrayElement(GLint elt)
 
 
 void
-_ae_invalidate_state(struct gl_context *ctx, GLuint new_state)
+_ae_invalidate_state(struct gl_context *ctx, GLbitfield new_state)
 {
    AEcontext *actx = AE_CONTEXT(ctx);