r600g: rework vertex buffer uploads
[mesa.git] / src / gallium / drivers / r600 / r600_pipe.h
index 7f74fda0daf7c200ec84453cc5ff4b0168949e2c..360ee2af1fc31464d33015c256b3831d474bb5ba 100644 (file)
@@ -131,8 +131,6 @@ struct r600_translate_context {
 #define R600_CONSTANT_ARRAY_SIZE 256
 #define R600_RESOURCE_ARRAY_SIZE 160
 
-struct r600_upload;
-
 struct r600_pipe_context {
        struct pipe_context             context;
        struct blitter_context          *blitter;
@@ -146,6 +144,7 @@ struct r600_pipe_context {
        struct pipe_framebuffer_state   framebuffer;
        struct pipe_index_buffer        index_buffer;
        struct pipe_vertex_buffer       vertex_buffer[PIPE_MAX_ATTRIBS];
+       struct pipe_resource            *real_vertex_buffer[PIPE_MAX_ATTRIBS];
        unsigned                        nvertex_buffer;
        unsigned                        cb_target_mask;
        /* for saving when using blitter */
@@ -164,22 +163,17 @@ struct r600_pipe_context {
        /* shader information */
        unsigned                        sprite_coord_enable;
        bool                            flatshade;
-       struct r600_upload              *rupload_vb;
+       struct u_upload_mgr             *upload_vb;
        unsigned                        any_user_vbs;
        struct r600_textures_info       ps_samplers;
        unsigned                        vb_max_index;
        struct r600_translate_context   tran;
-       struct r600_upload              *rupload_const;
+       struct u_upload_mgr             *upload_const;
 };
 
 struct r600_drawl {
+       struct pipe_draw_info   info;
        struct pipe_context     *ctx;
-       unsigned                mode;
-       unsigned                min_index;
-       unsigned                max_index;
-       unsigned                index_bias;
-       unsigned                start;
-       unsigned                count;
        unsigned                index_size;
        unsigned                index_buffer_offset;
        struct pipe_resource    *index_buffer;
@@ -188,12 +182,15 @@ struct r600_drawl {
 /* evergreen_state.c */
 void evergreen_init_state_functions(struct r600_pipe_context *rctx);
 void evergreen_init_config(struct r600_pipe_context *rctx);
-void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info);
 void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx);
 void evergreen_polygon_offset_update(struct r600_pipe_context *rctx);
-void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx);
+void evergreen_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
+                                     struct r600_pipe_state *rstate,
+                                     unsigned index,
+                                     struct r600_resource *rbuffer,
+                                     unsigned offset, unsigned stride);
 
 /* r600_blit.c */
 void r600_init_blit_functions(struct r600_pipe_context *rctx);
@@ -210,8 +207,9 @@ unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context,
                                         unsigned level, int layer);
 struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen,
                                              struct winsys_handle *whandle);
-int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw);
-int r600_upload_user_buffers(struct r600_pipe_context *rctx);
+void r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw);
+void r600_upload_user_buffers(struct r600_pipe_context *rctx,
+                             int min_index, int max_index);
 
 /* r600_query.c */
 void r600_init_query_functions(struct r600_pipe_context *rctx);
@@ -228,11 +226,15 @@ int r600_find_vs_semantic_index(struct r600_shader *vs,
 
 /* r600_state.c */
 void r600_init_state_functions(struct r600_pipe_context *rctx);
-void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info);
+void r600_spi_update(struct r600_pipe_context *rctx);
 void r600_init_config(struct r600_pipe_context *rctx);
 void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx);
 void r600_polygon_offset_update(struct r600_pipe_context *rctx);
-void r600_vertex_buffer_update(struct r600_pipe_context *rctx);
+void r600_pipe_add_vertex_attrib(struct r600_pipe_context *rctx,
+                                struct r600_pipe_state *rstate,
+                                unsigned index,
+                                struct r600_resource *rbuffer,
+                                unsigned offset, unsigned stride);
 
 /* r600_helper.h */
 int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
@@ -277,6 +279,9 @@ void r600_bind_ps_shader(struct pipe_context *ctx, void *state);
 void r600_bind_vs_shader(struct pipe_context *ctx, void *state);
 void r600_delete_ps_shader(struct pipe_context *ctx, void *state);
 void r600_delete_vs_shader(struct pipe_context *ctx, void *state);
+void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
+                             struct pipe_resource *buffer);
+void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info);
 
 /*
  * common helpers