New elt buffer code should be fairly stable.
[mesa.git] / src / mesa / drivers / dri / r300 / r300_context.h
index 6b027f380b4f64316649606d2a2b1f7b10e9288f..c7e1b8edca7886bdfd37c413cffa6d9983598788 100644 (file)
@@ -60,6 +60,7 @@ typedef struct r300_context *r300ContextPtr;
    I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble 
    with other compilers ... GLUE!
 */
+#if 1
 #define WARN_ONCE(a, ...)      { \
        static int warn##__LINE__=1; \
        if(warn##__LINE__){ \
@@ -71,6 +72,9 @@ typedef struct r300_context *r300ContextPtr;
                warn##__LINE__=0;\
                } \
        }
+#else
+#define WARN_ONCE(a, ...) {}
+#endif
 
 typedef GLuint uint32_t;
 typedef GLubyte uint8_t;
@@ -110,9 +114,12 @@ struct r300_dma_region {
        struct r300_dma_buffer *buf;
        char *address;          /* == buf->address */
        int start, end, ptr;    /* offsets from start of buf */
-       int aos_start;
-       int aos_stride;
-       int aos_size;
+
+    int aos_offset;     /* address in GART memory */
+    int aos_stride;     /* distance between elements, in dwords */
+    int aos_size;       /* number of components (1-4) */
+    int aos_format;     /* format of components */
+    int aos_reg;        /* VAP register assignment */
 };
 
 struct r300_dma {
@@ -125,7 +132,11 @@ struct r300_dma {
        void (*flush) (r300ContextPtr);
 
        char *buf0_address;     /* start of buf[0], for index calcs */
-       GLuint nr_released_bufs;        /* flush after so many buffers released */
+
+       /* Number of "in-flight" DMA buffers, i.e. the number of buffers
+        * for which a DISCARD command is currently queued in the command buffer.
+        */
+       GLuint nr_released_bufs;
 };
 
        /* Texture related */
@@ -407,7 +418,6 @@ struct r300_hw_state {
 #ifdef EXP_C
        struct r300_state_atom lsf;     /* line stipple factor */
 #endif
-       struct r300_state_atom dummy[4];
        struct r300_state_atom unk4260; /* (4260) */
        struct r300_state_atom unk4274; /* (4274) */
        struct r300_state_atom unk4288; /* (4288) */
@@ -420,9 +430,6 @@ struct r300_hw_state {
        struct r300_state_atom ri;      /* rs interpolators (4310) */
        struct r300_state_atom rr;      /* rs route (4330) */
        struct r300_state_atom unk43A4; /* (43A4) */
-#ifdef EXP_C
-       struct r300_state_atom lsp;     /* line stipple pattern */
-#endif 
        struct r300_state_atom unk43E8; /* (43E8) */
        struct r300_state_atom fp;      /* fragment program cntl + nodes (4600) */
        struct r300_state_atom fpt;     /* texi - (4620) */
@@ -452,7 +459,6 @@ struct r300_hw_state {
        struct r300_state_atom vpi;     /* vp instructions */
        struct r300_state_atom vpp;     /* vp parameters */
        struct r300_state_atom vps;     /* vertex point size (?) */
-
                /* 8 texture units */
                /* the state is grouped by function and not by
                   texture unit. This makes single unit updates
@@ -656,10 +662,18 @@ struct r300_state {
        struct r300_vap_reg_state vap_reg;
        struct r300_vertex_shader_state vertex_shader;
        struct r300_pixel_shader_state pixel_shader;
-       struct r300_aos_rec aos[R300_MAX_AOS_ARRAYS];
+
+       struct r300_dma_region aos[R300_MAX_AOS_ARRAYS];
        int aos_count;
+
+       GLuint *Elts;
+       struct r300_dma_region elt_dma;
+       
        GLuint render_inputs; /* actual render inputs that R300 was configured for. 
-                                They are the same as tnl->render_inputs for fixed pipeline */
+                                They are the same as tnl->render_inputs for fixed pipeline */  
+       struct {
+               int transform_offset;  /* Transform matrix offset, -1 if none */
+               } vap_param;  /* vertex processor parameter allocation - tells where to write parameters */
 
        int hw_stencil;
 };
@@ -709,6 +723,19 @@ struct r300_context {
 
 #define R300_CONTEXT(ctx)              ((r300ContextPtr)(ctx->DriverCtx))
 
+static __inline GLuint r300PackColor( GLuint cpp,
+                                       GLubyte r, GLubyte g,
+                                       GLubyte b, GLubyte a )
+{
+   switch ( cpp ) {
+   case 2:
+      return PACK_COLOR_565( r, g, b );
+   case 4:
+      return PACK_COLOR_8888( r, g, b, a );
+   default:
+      return 0;
+   }
+}
 extern void r300DestroyContext(__DRIcontextPrivate * driContextPriv);
 extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
                                   __DRIcontextPrivate * driContextPriv,