r300g: initialize state & render functions before creating u_vbuf & u_blitter
authorMarek Olšák <maraeo@gmail.com>
Tue, 3 Apr 2012 20:12:35 +0000 (22:12 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 4 Apr 2012 02:28:40 +0000 (04:28 +0200)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_render.c

index 505c6ccf99e7c3a8040979609aa27403e33aa656..bf354724524caee3a1d1420829a9c063a4a26974 100644 (file)
@@ -418,6 +418,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300_init_query_functions(r300);
     r300_init_state_functions(r300);
     r300_init_resource_functions(r300);
+    r300_init_render_functions(r300);
+    r300_init_states(&r300->context);
 
     r300->context.create_video_decoder = vl_create_decoder;
     r300->context.create_video_buffer = vl_video_buffer_create;
@@ -435,10 +437,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300->blitter = util_blitter_create(&r300->context);
     if (r300->blitter == NULL)
         goto fail;
-
-    /* Render functions must be initialized after blitter. */
-    r300_init_render_functions(r300);
-    r300_init_states(&r300->context);
+    r300->blitter->draw_rectangle = r300_blitter_draw_rectangle;
 
     rws->cs_set_flush_callback(r300->cs, r300_flush_callback, r300);
 
index 0802e79add73367dc11b329920443f2e8f788dc9..b679592c0bf8078a6be990447aaf1f6154c28977 100644 (file)
@@ -705,6 +705,12 @@ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300);
 /* r300_render.c */
 void r300_draw_flush_vbuf(struct r300_context *r300);
 void r500_emit_index_bias(struct r300_context *r300, int index_bias);
+void r300_blitter_draw_rectangle(struct blitter_context *blitter,
+                                 unsigned x1, unsigned y1,
+                                 unsigned x2, unsigned y2,
+                                 float depth,
+                                 enum blitter_attrib_type type,
+                                 const union pipe_color_union *attrib);
 
 /* r300_state.c */
 enum r300_fb_state_change {
index 91c528ec512c26d6e014f73a9255e9c0a7a6fae9..5981bec4023aa808f04ad5742488a3fb4a5bff36 100644 (file)
@@ -1165,12 +1165,12 @@ void r300_draw_flush_vbuf(struct r300_context *r300)
  * If we rendered a quad, the pixels on the main diagonal
  * would be computed and stored twice, which makes the clear/copy codepaths
  * somewhat inefficient. Instead we use a rectangular point sprite. */
-static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
-                                        unsigned x1, unsigned y1,
-                                        unsigned x2, unsigned y2,
-                                        float depth,
-                                        enum blitter_attrib_type type,
-                                        const union pipe_color_union *attrib)
+void r300_blitter_draw_rectangle(struct blitter_context *blitter,
+                                 unsigned x1, unsigned y1,
+                                 unsigned x2, unsigned y2,
+                                 float depth,
+                                 enum blitter_attrib_type type,
+                                 const union pipe_color_union *attrib)
 {
     struct r300_context *r300 = r300_context(util_blitter_get_pipe(blitter));
     unsigned last_sprite_coord_enable = r300->sprite_coord_enable;
@@ -1309,7 +1309,6 @@ void r300_init_render_functions(struct r300_context *r300)
     }
 
     r300->context.resource_resolve = r300_resource_resolve;
-    r300->blitter->draw_rectangle = r300_blitter_draw_rectangle;
 
     /* Plug in the two-sided stencil reference value fallback if needed. */
     if (!r300->screen->caps.is_r500)