Track Radeon driver symlinks in Git.
[mesa.git] / src / mesa / drivers / dri / r300 / r300_context.h
index 4111fa2d81a8e778516ac761ed91e3e9923278f4..f7af7d4e5747cad6ada6f7fd0d853100a6e210db 100644 (file)
@@ -399,56 +399,45 @@ struct r300_hw_state {
 #define STATE_R300_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0)
 #define STATE_R300_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1)
 
-struct r300_vertex_shader_fragment {
-       int length;
-       union {
-               GLuint d[VSF_MAX_FRAGMENT_LENGTH];
-               float f[VSF_MAX_FRAGMENT_LENGTH];
-               GLuint i[VSF_MAX_FRAGMENT_LENGTH];
-       } body;
-};
-
-struct r300_vertex_shader_state {
-       struct r300_vertex_shader_fragment program;
-};
-
 #define COLOR_IS_RGBA
 #define TAG(x) r300##x
 #include "tnl_dd/t_dd_vertex.h"
 #undef TAG
 
-#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->selected_vp)
-
-/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday.
- * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly.
- */
-
-struct r300_vertex_program_key {
-       GLuint InputsRead;
-       GLuint OutputsWritten;
-       GLuint OutputsAdded;
-};
-
 struct r300_vertex_program {
+       struct gl_vertex_program *Base;
        struct r300_vertex_program *next;
-       struct r300_vertex_program_key key;
-       int translated;
 
-       struct r300_vertex_shader_fragment program;
+       struct r300_vertex_program_key {
+               GLuint FpReads;
+               GLuint FogAttr;
+               GLuint WPosAttr;
+       } key;
+       
+       struct r300_vertex_shader_hw_code {
+               int length;
+               union {
+                       GLuint d[VSF_MAX_FRAGMENT_LENGTH];
+                       float f[VSF_MAX_FRAGMENT_LENGTH];
+               } body;
+       } hw_code;
+
+       GLboolean translated;
+       GLboolean error;
 
        int pos_end;
        int num_temporaries;    /* Number of temp vars used by program */
-       int wpos_idx;
        int inputs[VERT_ATTRIB_MAX];
        int outputs[VERT_RESULT_MAX];
-       int native;
-       int ref_count;
-       int use_ref_count;
 };
 
 struct r300_vertex_program_cont {
-       struct gl_vertex_program mesa_program;  /* Must be first */
-       struct r300_vertex_shader_fragment params;
+       /* This is the unmodified vertex program mesa provided us with.
+        * We need to keep it unchanged because we may need to create another
+        * hw specific vertex program based on this.
+        */
+       struct gl_vertex_program mesa_program;
+       /* This is the list of hw specific vertex programs derived from mesa_program */
        struct r300_vertex_program *progs;
 };
 
@@ -562,7 +551,7 @@ struct r500_fragment_program_code {
 * to render with that program.
 */
 struct r300_fragment_program {
-       struct gl_fragment_program Base;
+       struct gl_program *Base;
 
        GLboolean translated;
        GLboolean error;
@@ -575,6 +564,23 @@ struct r300_fragment_program {
 
        GLboolean writes_depth;
        GLuint optimization;
+
+       struct r300_fragment_program *next;
+
+       /* 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 {
+       /* This is the unmodified fragment program mesa provided us with.
+        * We need to keep it unchanged because we may need to create another
+        * hw specific fragment program based on this.
+        */
+       struct gl_fragment_program Base;
+       /* This is the list of hw specific fragment programs derived from Base */
+       struct r300_fragment_program *progs;
 };
 
 struct r300_fragment_program_compiler {
@@ -599,18 +605,6 @@ struct r300_swtcl_info {
     * Offset of the 3UB specular color data within a hardware (swtcl) vertex.
     */
    GLuint specoffset;
-
-   struct vertex_attribute{
-       GLuint attr;
-       GLubyte format;
-       GLubyte dst_loc;
-       GLuint swizzle;
-       GLubyte write_mask;
-   } vert_attrs[VERT_ATTRIB_MAX];
-
-   GLubyte vertex_attr_count;
-
-   int sw_tcl_inputs[VERT_ATTRIB_MAX];
 };
 
 struct r300_vtable {
@@ -621,6 +615,34 @@ struct r300_vtable {
        void (* SetupPixelShader)(GLcontext *ctx);
 };
 
+struct r300_vertex_buffer {
+       struct vertex_attribute {
+               /* generic */
+               GLubyte element;
+               GLvoid *data;
+               GLboolean free_needed;
+               GLuint stride;
+               GLuint dwords;
+               GLubyte size; /* number of components */
+
+               /* hw specific */
+               uint32_t data_type:4;
+               uint32_t dst_loc:5;
+               uint32_t _signed:1;
+               uint32_t normalize:1;
+               uint32_t swizzle:12;
+               uint32_t write_mask:4;
+       } attribs[VERT_ATTRIB_MAX];
+
+       GLubyte num_attribs;
+};
+
+struct r300_index_buffer {
+       GLvoid *ptr;
+       GLboolean is_32bit;
+       GLboolean free_needed;
+       GLuint count;
+};
 
 /**
  * \brief R300 context structure.
@@ -632,8 +654,8 @@ struct r300_context {
 
        struct r300_hw_state hw;
 
-       struct r300_vertex_shader_state vertex_shader;
        struct r300_vertex_program *selected_vp;
+       struct r300_fragment_program *selected_fp;
 
        /* Vertex buffers
         */
@@ -649,6 +671,8 @@ struct r300_context {
        } options;
        
        struct r300_swtcl_info swtcl;
+       struct r300_vertex_buffer vbuf;
+       struct r300_index_buffer ind_buf;
        GLboolean vap_flush_needed;
 
        uint32_t fallback;
@@ -663,14 +687,12 @@ extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
                                   __DRIcontextPrivate * driContextPriv,
                                   void *sharedContextPrivate);
 
-extern void r300SelectVertexShader(r300ContextPtr r300);
 extern void r300InitShaderFuncs(struct dd_function_table *functions);
-extern int r300VertexProgUpdateParams(GLcontext * ctx,
-                                     struct r300_vertex_program_cont *vp,
-                                     float *dst);
 
 extern void r300InitShaderFunctions(r300ContextPtr r300);
 
+extern void r300InitDraw(GLcontext *ctx);
+
 #define r300PackFloat32 radeonPackFloat32
 #define r300PackFloat24 radeonPackFloat24