extend some DrawRangeElements cases to support rendering more than 65535 verts in...
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_vtxfmt_c.c
index 3e8749a8cd6289c41c39869bdf0fd775d6dc4900..aac029aa0e4fc4e626127c08d2b6a41ac2dad0bc 100644 (file)
@@ -41,6 +41,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "radeon_vtxfmt.h"
 
+#include "dispatch.h"
+
 /* Fallback versions of all the entrypoints for situations where
  * codegen isn't available.  This is still a lot faster than the
  * vb/pipeline implementation in Mesa.
@@ -561,7 +563,7 @@ static void radeon_MultiTexCoord1fARB( GLenum target, GLfloat s  )
 {
    GET_CURRENT_CONTEXT(ctx);
    radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-   GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
+   GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
    dest[0] = s;
    dest[1] = 0;
 }
@@ -570,7 +572,7 @@ static void radeon_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-   GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
+   GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
    dest[0] = v[0];
    dest[1] = 0;
 }
@@ -579,7 +581,7 @@ static void radeon_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t )
 {
    GET_CURRENT_CONTEXT(ctx);
    radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-   GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
+   GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
    dest[0] = s;
    dest[1] = t;
 }
@@ -588,7 +590,7 @@ static void radeon_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-   GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
+   GLfloat *dest = rmesa->vb.texcoordptr[target & 3];
    dest[0] = v[0];
    dest[1] = v[1];
 }
@@ -623,15 +625,15 @@ static void choose_##FN ARGS1                                             \
       fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ );                \
                                                                        \
    if (dfn)                                                            \
-      ctx->Exec->FN = (FNTYPE)(dfn->code);                             \
+      SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code));                     \
    else {                                                              \
       if (RADEON_DEBUG & DEBUG_CODEGEN)                                        \
         fprintf(stderr, "%s -- generic version\n", __FUNCTION__ );     \
-      ctx->Exec->FN = radeon_##FN;                                     \
+      SET_ ## FN (ctx->Exec, radeon_##FN);                             \
    }                                                                   \
                                                                        \
    ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;                      \
-   ctx->Exec->FN ARGS2;                                                        \
+   CALL_ ## FN (ctx->Exec, ARGS2);                                     \
 }
 
 
@@ -652,7 +654,7 @@ static void choose_##FN ARGS1                                               \
    struct dynfn *dfn;                                                  \
                                                                        \
    if (rmesa->vb.vertex_format & ACTIVE_PKCOLOR) {                     \
-      ctx->Exec->FN = radeon_##FN##_ub;                                        \
+      SET_ ## FN (ctx->Exec, radeon_##FN##_ub);                                \
    }                                                                   \
    else if ((rmesa->vb.vertex_format &                                 \
             (ACTIVE_FPCOLOR|ACTIVE_FPALPHA)) == ACTIVE_FPCOLOR) {      \
@@ -663,15 +665,15 @@ static void choose_##FN ARGS1                                             \
          if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) {           \
             radeon_copy_to_current( ctx );                             \
             _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );       \
-            ctx->Exec->FN ARGS2;                                       \
+            CALL_ ## FN (ctx->Exec, ARGS2);                            \
             return;                                                    \
          }                                                             \
       }                                                                        \
                                                                        \
-      ctx->Exec->FN = radeon_##FN##_3f;                                        \
+      SET_ ## FN (ctx->Exec, radeon_##FN##_3f);                                \
    }                                                                   \
    else {                                                              \
-      ctx->Exec->FN = radeon_##FN##_4f;                                        \
+      SET_ ## FN (ctx->Exec, radeon_##FN##_4f);                                \
    }                                                                   \
                                                                        \
                                                                        \
@@ -681,13 +683,13 @@ static void choose_##FN ARGS1                                             \
    if (dfn) {                                                          \
       if (RADEON_DEBUG & DEBUG_CODEGEN)                                        \
          fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ );    \
-      ctx->Exec->FN = (FNTYPE)dfn->code;                               \
+      SET_ ## FN (ctx->Exec, (FNTYPE)dfn->code);                       \
    }                                                                   \
    else if (RADEON_DEBUG & DEBUG_CODEGEN)                              \
          fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ );                \
                                                                        \
    ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;                      \
-   ctx->Exec->FN ARGS2;                                                        \
+   CALL_ ## FN (ctx->Exec, ARGS2);                                     \
 }
 
 
@@ -712,16 +714,16 @@ static void choose_##FN ARGS1                                             \
       fprintf(stderr, "%s -- cached version\n", __FUNCTION__ );                \
                                                                        \
    if (dfn)                                                            \
-      ctx->Exec->FN = (FNTYPE)(dfn->code);                             \
+      SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code));                     \
    else {                                                              \
       if (RADEON_DEBUG & DEBUG_CODEGEN)                                        \
          fprintf(stderr, "%s -- generic version\n", __FUNCTION__ );    \
-      ctx->Exec->FN = ((rmesa->vb.vertex_format & ACTIVE_PKSPEC) != 0) \
-         ? radeon_##FN##_ub : radeon_##FN##_3f                       \
+      SET_ ## FN (ctx->Exec, ((rmesa->vb.vertex_format & ACTIVE_PKSPEC) != 0)  \
+         ? radeon_##FN##_ub : radeon_##FN##_3f);                       \
    }                                                                   \
                                                                        \
    ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;                      \
-   ctx->Exec->FN ARGS2;                                                        \
+   CALL_ ## FN (ctx->Exec, ARGS2);                                     \
 }
 
 
@@ -744,7 +746,8 @@ static void choose_##FN ARGS1                                               \
 
 #define ACTIVE_ST0 RADEON_CP_VC_FRMT_ST0
 #define ACTIVE_ST1 RADEON_CP_VC_FRMT_ST1
-#define ACTIVE_ST_ALL (RADEON_CP_VC_FRMT_ST1|RADEON_CP_VC_FRMT_ST0)
+#define ACTIVE_ST2 RADEON_CP_VC_FRMT_ST2
+#define ACTIVE_ST_ALL (RADEON_CP_VC_FRMT_ST1|RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST2)
 
 /* Each codegen function should be able to be fully specified by a
  * subsetted version of rmesa->vb.vertex_format.
@@ -754,7 +757,8 @@ static void choose_##FN ARGS1                                               \
 #define MASK_SPEC    (MASK_COLOR|ACTIVE_COLOR)
 #define MASK_ST0     (MASK_SPEC|ACTIVE_SPEC)
 #define MASK_ST1     (MASK_ST0|ACTIVE_ST0)
-#define MASK_ST_ALL  (MASK_ST1|ACTIVE_ST1)
+#define MASK_ST2     (MASK_ST1|ACTIVE_ST1)
+#define MASK_ST_ALL  (MASK_ST2|ACTIVE_ST2)
 #define MASK_VERTEX  (MASK_ST_ALL|ACTIVE_FPALPHA)