r300: fix vertex program parameters limits
[mesa.git] / src / mesa / drivers / dri / r300 / r300_context.h
index d14d992366b5a80420d4559d4f1c36de09a8537a..1dadcc0a69783ba92dd610868457fe0fc49a6252 100644 (file)
@@ -51,22 +51,6 @@ typedef struct r300_context r300ContextRec;
 typedef struct r300_context *r300ContextPtr;
 
 
-/* From http://gcc. gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html .
-   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!
-*/
-#define WARN_ONCE(a, ...)      { \
-       static int warn##__LINE__=1; \
-       if(warn##__LINE__){ \
-               fprintf(stderr, "*********************************WARN_ONCE*********************************\n"); \
-               fprintf(stderr, "File %s function %s line %d\n", \
-                       __FILE__, __FUNCTION__, __LINE__); \
-               fprintf(stderr,  a, ## __VA_ARGS__);\
-               fprintf(stderr, "***************************************************************************\n"); \
-               warn##__LINE__=0;\
-               } \
-       }
-
 #include "r300_vertprog.h"
 
 
@@ -290,6 +274,12 @@ typedef struct r300_context *r300ContextPtr;
 #define R300_TEX_CMDSIZE       (MAX_TEXTURE_UNITS+1)
 */
 
+#define R300_QUERYOBJ_CMD_0  0
+#define R300_QUERYOBJ_DATA_0 1
+#define R300_QUERYOBJ_CMD_1  2
+#define R300_QUERYOBJ_DATA_1  3
+#define R300_QUERYOBJ_CMDSIZE  4
+
 /**
  * Cache for hardware register state.
  */
@@ -360,6 +350,7 @@ struct r300_hw_state {
        struct radeon_state_atom zb_hiz_offset; /* (4F44) */
        struct radeon_state_atom zb_hiz_pitch;  /* (4F54) */
 
+       struct radeon_state_atom vap_flush;
        struct radeon_state_atom vpi;   /* vp instructions */
        struct radeon_state_atom vpp;   /* vp parameters */
        struct radeon_state_atom vps;   /* vertex point size (?) */
@@ -380,7 +371,6 @@ struct r300_hw_state {
                struct radeon_state_atom border_color;
        } tex;
        struct radeon_state_atom txe;   /* tex enable (4104) */
-
        radeonTexObj *textures[R300_MAX_TEXTURE_UNITS];
 };
 
@@ -390,20 +380,13 @@ struct r300_hw_state {
 
 /* Vertex shader state */
 
-/* Perhaps more if we store programs in vmem? */
-/* drm_r300_cmd_header_t->vpu->count is unsigned char */
-#define VSF_MAX_FRAGMENT_LENGTH (255*4)
-
-/* Can be tested with colormat currently. */
-#define VSF_MAX_FRAGMENT_TEMPS (14)
-
 #define COLOR_IS_RGBA
 #define TAG(x) r300##x
 #include "tnl_dd/t_dd_vertex.h"
 #undef TAG
 
 struct r300_vertex_program_key {
-       GLuint FpReads;
+       GLbitfield FpReads;
        GLuint FogAttr;
        GLuint WPosAttr;
 };
@@ -413,23 +396,9 @@ struct r300_vertex_program {
        struct r300_vertex_program *next;
 
        struct r300_vertex_program_key key;
-       GLbitfield InputsRead;
-       GLbitfield OutputsWritten;
-
-       struct r300_vertex_shader_hw_code {
-               int length;
-               union {
-                       GLuint d[VSF_MAX_FRAGMENT_LENGTH];
-                       float f[VSF_MAX_FRAGMENT_LENGTH];
-               } body;
-       } hw_code;
+       struct r300_vertex_program_code code;
 
        GLboolean error;
-
-       int pos_end;
-       int num_temporaries;    /* Number of temp vars used by program */
-       int inputs[VERT_ATTRIB_MAX];
-       int outputs[VERT_RESULT_MAX];
 };
 
 struct r300_vertex_program_cont {
@@ -449,12 +418,16 @@ struct r300_vertex_program_cont {
 */
 struct r300_fragment_program {
        GLboolean error;
-       struct gl_program *Base;
        struct r300_fragment_program *next;
        struct r300_fragment_program_external_state state;
 
        struct rX00_fragment_program_code code;
        GLbitfield InputsRead;
+
+       /* attribute that we are sending the WPOS in */
+       gl_frag_attrib wpos_attr;
+       /* attribute that we are sending the fog coordinate in */
+       gl_frag_attrib fog_attr;
 };
 
 struct r300_fragment_program_cont {
@@ -495,11 +468,12 @@ struct r300_vertex_buffer {
        struct vertex_attribute {
                /* generic */
                GLubyte element;
-               GLvoid *data;
-               GLboolean free_needed;
                GLuint stride;
                GLuint dwords;
                GLubyte size; /* number of components */
+               GLboolean is_named_bo;
+               struct radeon_bo *bo;
+               GLint bo_offset;
 
                /* hw specific */
                uint32_t data_type:4;
@@ -514,12 +488,14 @@ struct r300_vertex_buffer {
 };
 
 struct r300_index_buffer {
-       GLvoid *ptr;
+       struct radeon_bo *bo;
+       int bo_offset;
+
        GLboolean is_32bit;
-       GLboolean free_needed;
        GLuint count;
 };
 
+
 /**
  * \brief R300 context structure.
  */
@@ -549,7 +525,6 @@ struct r300_context {
        struct r300_swtcl_info swtcl;
        struct r300_vertex_buffer vbuf;
        struct r300_index_buffer ind_buf;
-       GLboolean vap_flush_needed;
 
        uint32_t fallback;