r300g: add size parameter to the atom emit functions
authorMarek Olšák <maraeo@gmail.com>
Sat, 27 Feb 2010 20:54:16 +0000 (21:54 +0100)
committerMarek Olšák <maraeo@gmail.com>
Sat, 27 Feb 2010 23:46:35 +0000 (00:46 +0100)
Maintaining a closer relationship between the atom size and what's passed
in BEGIN_CS.

src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_emit.h
src/gallium/drivers/r300/r300_state_invariant.c
src/gallium/drivers/r300/r300_state_invariant.h

index ac14e3f0df438abcdcddeaa1d6358a217e12669a..e3ad5869213f43dfdcf279cdfe3a9694e1a20510 100644 (file)
@@ -45,7 +45,7 @@ struct r300_atom {
     /* Opaque state. */
     void* state;
     /* Emit the state to the context. */
-    void (*emit)(struct r300_context*, void*);
+    void (*emit)(struct r300_context*, unsigned, void*);
     /* Upper bound on number of dwords to emit. */
     unsigned size;
     /* Whether this atom should be emitted. */
index 7fc66dd26501ed1ed3859cfa9da5f07307a31c69..a17ebb3ea87b5e5c13c2ca96154ca4eff4828ee0 100644 (file)
@@ -34,7 +34,8 @@
 #include "r300_screen.h"
 #include "r300_vs.h"
 
-void r300_emit_blend_state(struct r300_context* r300, void* state)
+void r300_emit_blend_state(struct r300_context* r300,
+                           unsigned size, void* state)
 {
     struct r300_blend_state* blend = (struct r300_blend_state*)state;
     struct pipe_framebuffer_state* fb =
@@ -58,7 +59,8 @@ void r300_emit_blend_state(struct r300_context* r300, void* state)
     END_CS;
 }
 
-void r300_emit_blend_color_state(struct r300_context* r300, void* state)
+void r300_emit_blend_color_state(struct r300_context* r300,
+                                 unsigned size, void* state)
 {
     struct r300_blend_color_state* bc = (struct r300_blend_color_state*)state;
     struct r300_screen* r300screen = r300_screen(r300->context.screen);
@@ -77,7 +79,8 @@ void r300_emit_blend_color_state(struct r300_context* r300, void* state)
     }
 }
 
-void r300_emit_clip_state(struct r300_context* r300, void* state)
+void r300_emit_clip_state(struct r300_context* r300,
+                          unsigned size, void* state)
 {
     struct pipe_clip_state* clip = (struct pipe_clip_state*)state;
     int i;
@@ -107,7 +110,7 @@ void r300_emit_clip_state(struct r300_context* r300, void* state)
 
 }
 
-void r300_emit_dsa_state(struct r300_context* r300, void* state)
+void r300_emit_dsa_state(struct r300_context* r300, unsigned size, void* state)
 {
     struct r300_dsa_state* dsa = (struct r300_dsa_state*)state;
     struct r300_screen* r300screen = r300_screen(r300->context.screen);
@@ -378,7 +381,7 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300,
     END_CS;
 }
 
-void r300_emit_fb_state(struct r300_context* r300, void* state)
+void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
 {
     struct pipe_framebuffer_state* fb = (struct pipe_framebuffer_state*)state;
     struct r300_screen* r300screen = r300_screen(r300->context.screen);
@@ -578,7 +581,7 @@ void r300_emit_query_end(struct r300_context* r300)
         r300_emit_query_finish(r300, query);
 }
 
-void r300_emit_rs_state(struct r300_context* r300, void* state)
+void r300_emit_rs_state(struct r300_context* r300, unsigned size, void* state)
 {
     struct r300_rs_state* rs = (struct r300_rs_state*)state;
     float scale, offset;
@@ -621,7 +624,8 @@ void r300_emit_rs_state(struct r300_context* r300, void* state)
     END_CS;
 }
 
-void r300_emit_rs_block_state(struct r300_context* r300, void* state)
+void r300_emit_rs_block_state(struct r300_context* r300,
+                              unsigned size, void* state)
 {
     struct r300_rs_block* rs = (struct r300_rs_block*)state;
     unsigned i;
@@ -663,7 +667,8 @@ void r300_emit_rs_block_state(struct r300_context* r300, void* state)
     END_CS;
 }
 
-void r300_emit_scissor_state(struct r300_context* r300, void* state)
+void r300_emit_scissor_state(struct r300_context* r300,
+                             unsigned size, void* state)
 {
     unsigned minx, miny, maxx, maxy;
     uint32_t top_left, bottom_right;
@@ -810,7 +815,8 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
     END_CS;
 }
 
-void r300_emit_vertex_format_state(struct r300_context* r300, void* state)
+void r300_emit_vertex_format_state(struct r300_context* r300,
+                                   unsigned size, void* state)
 {
     struct r300_vertex_info* vertex_info = (struct r300_vertex_info*)state;
     unsigned i;
@@ -856,7 +862,7 @@ static void r300_flush_pvs(struct r300_context* r300)
     END_CS;
 }
 
-void r300_emit_vs_state(struct r300_context* r300, void* state)
+void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
 {
     struct r300_vertex_shader* vs = (struct r300_vertex_shader*)state;
     struct r300_vertex_program_code* code = &vs->code;
@@ -942,7 +948,8 @@ void r300_emit_vs_constant_buffer(struct r300_context* r300,
     END_CS;
 }
 
-void r300_emit_viewport_state(struct r300_context* r300, void* state)
+void r300_emit_viewport_state(struct r300_context* r300,
+                              unsigned size, void* state)
 {
     struct r300_viewport_state* viewport = (struct r300_viewport_state*)state;
     CS_LOCALS(r300);
@@ -986,7 +993,8 @@ void r300_emit_texture_count(struct r300_context* r300)
 
 }
 
-void r300_emit_ztop_state(struct r300_context* r300, void* state)
+void r300_emit_ztop_state(struct r300_context* r300,
+                          unsigned size, void* state)
 {
     struct r300_ztop_state* ztop = (struct r300_ztop_state*)state;
     CS_LOCALS(r300);
@@ -1110,7 +1118,7 @@ void r300_emit_dirty_state(struct r300_context* r300)
 
     foreach(atom, &r300->atom_list) {
         if (atom->dirty || atom->always_dirty) {
-            atom->emit(r300, atom->state);
+            atom->emit(r300, atom->size, atom->state);
             atom->dirty = FALSE;
         }
     }
index f27cf5f32d272b8f0a9d14cdc831af5f63ec7c16..a9b75d5b37bd0856e975d77f70701c9975cffed2 100644 (file)
@@ -31,13 +31,17 @@ struct r300_vertex_program_code;
 
 void r300_emit_aos(struct r300_context* r300, unsigned offset);
 
-void r300_emit_blend_state(struct r300_context* r300, void* state);
+void r300_emit_blend_state(struct r300_context* r300,
+                           unsigned size, void* state);
 
-void r300_emit_blend_color_state(struct r300_context* r300, void* state);
+void r300_emit_blend_color_state(struct r300_context* r300,
+                                 unsigned size, void* state);
 
-void r300_emit_clip_state(struct r300_context* r300, void* state);
+void r300_emit_clip_state(struct r300_context* r300,
+                          unsigned size, void* state);
 
-void r300_emit_dsa_state(struct r300_context* r300, void* state);
+void r300_emit_dsa_state(struct r300_context* r300,
+                         unsigned size, void* state);
 
 void r300_emit_fragment_program_code(struct r300_context* r300,
                                      struct rX00_fragment_program_code* generic_code);
@@ -51,18 +55,20 @@ void r500_emit_fragment_program_code(struct r300_context* r300,
 void r500_emit_fs_constant_buffer(struct r300_context* r300,
                                   struct rc_constant_list* constants);
 
-void r300_emit_fb_state(struct r300_context* r300, void* state);
+void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state);
 
 void r300_emit_query_begin(struct r300_context* r300,
                            struct r300_query* query);
 
 void r300_emit_query_end(struct r300_context* r300);
 
-void r300_emit_rs_state(struct r300_context* r300, void* state);
+void r300_emit_rs_state(struct r300_context* r300, unsigned size, void* state);
 
-void r300_emit_rs_block_state(struct r300_context* r300, void* state);
+void r300_emit_rs_block_state(struct r300_context* r300,
+                              unsigned size, void* state);
 
-void r300_emit_scissor_state(struct r300_context* r300, void* state);
+void r300_emit_scissor_state(struct r300_context* r300,
+                             unsigned size, void* state);
 
 void r300_emit_texture(struct r300_context* r300,
                        struct r300_sampler_state* sampler,
@@ -71,7 +77,8 @@ void r300_emit_texture(struct r300_context* r300,
 
 void r300_emit_vertex_buffer(struct r300_context* r300);
 
-void r300_emit_vertex_format_state(struct r300_context* r300, void* state);
+void r300_emit_vertex_format_state(struct r300_context* r300,
+                                   unsigned size, void* state);
 
 void r300_emit_vertex_program_code(struct r300_context* r300,
                                    struct r300_vertex_program_code* code);
@@ -79,13 +86,15 @@ void r300_emit_vertex_program_code(struct r300_context* r300,
 void r300_emit_vs_constant_buffer(struct r300_context* r300,
                                   struct rc_constant_list* constants);
 
-void r300_emit_vs_state(struct r300_context* r300, void* state);
+void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state);
 
-void r300_emit_viewport_state(struct r300_context* r300, void* state);
+void r300_emit_viewport_state(struct r300_context* r300,
+                              unsigned size, void* state);
 
 void r300_emit_texture_count(struct r300_context* r300);
 
-void r300_emit_ztop_state(struct r300_context* r300, void* state);
+void r300_emit_ztop_state(struct r300_context* r300,
+                          unsigned size, void* state);
 
 void r300_flush_textures(struct r300_context* r300);
 
index 97927acf1b44f65a78cd813df2089f69f86ea9fe..4a2c68269b1003bad0b139c9800f2a3619ba6720 100644 (file)
@@ -38,7 +38,8 @@ struct pipe_viewport_state r300_viewport_identity = {
  *
  * Note that eventually this should be empty, but it's useful for development
  * and general unduplication of code. */
-void r300_emit_invariant_state(struct r300_context* r300, void* state)
+void r300_emit_invariant_state(struct r300_context* r300,
+                               unsigned size, void* state)
 {
     struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
     CS_LOCALS(r300);
index 5d1a96365451439df0f56b0b83a2f180a3d83f11..83d031c7fe9c4c1d895974287a4f4b832684dbab 100644 (file)
@@ -25,6 +25,7 @@
 
 struct r300_context;
 
-void r300_emit_invariant_state(struct r300_context* r300, void* state);
+void r300_emit_invariant_state(struct r300_context* r300,
+                               unsigned size, void* state);
 
 #endif /* R300_STATE_INVARIANT_H */