From 11d9edf4c9c75d5a41fb0a1757441ad315330bea Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 8 Nov 2009 11:45:57 -0800 Subject: [PATCH] r300g: Unify context names for counts. From the SW TCL fixups. --- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_context.h | 4 ++-- src/gallium/drivers/r300/r300_emit.c | 16 ++++++++++------ src/gallium/drivers/r300/r300_render.c | 2 +- src/gallium/drivers/r300/r300_state.c | 4 ++-- src/gallium/drivers/r300/r300_vbo.c | 5 +++-- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 43d7ff3ed36..ae23329b83f 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -158,6 +158,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, /* Open up the OQ BO. */ r300->oqbo = screen->buffer_create(screen, 4096, PIPE_BUFFER_USAGE_VERTEX, 4096); + make_empty_list(&r300->query_list); r300_init_flush_functions(r300); @@ -172,6 +173,5 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300); r300->dirty_state = R300_NEW_KITCHEN_SINK; r300->dirty_hw++; - make_empty_list(&r300->query_list); return &r300->context; } diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 8d14c53f492..f954ba7f9aa 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -295,10 +295,10 @@ struct r300_context { /* Vertex buffers for Gallium. */ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - int vbuf_count; + int vertex_buffer_count; /* Vertex elements for Gallium. */ struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; - int aos_count; + int vertex_element_count; /* Bitmask of dirty state objects. */ uint32_t dirty_state; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index b3d9db676a6..eeb97a2d370 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -584,17 +584,20 @@ void r300_emit_texture(struct r300_context* r300, END_CS; } +/* XXX I can't read this and that's not good */ void r300_emit_aos(struct r300_context* r300, unsigned offset) { struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; struct pipe_vertex_element *velem = r300->vertex_element; CS_LOCALS(r300); int i; - unsigned packet_size = (r300->aos_count * 3 + 1) / 2; - BEGIN_CS(2 + packet_size + r300->aos_count * 2); + unsigned aos_count = r300->vertex_element_count; + + unsigned packet_size = (aos_count * 3 + 1) / 2; + BEGIN_CS(2 + packet_size + aos_count * 2); OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size); - OUT_CS(r300->aos_count); - for (i = 0; i < r300->aos_count - 1; i += 2) { + OUT_CS(aos_count); + for (i = 0; i < aos_count - 1; i += 2) { int buf_num1 = velem[i].vertex_buffer_index; int buf_num2 = velem[i+1].vertex_buffer_index; assert(vbuf[buf_num1].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); @@ -606,7 +609,7 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) OUT_CS(vbuf[buf_num2].buffer_offset + velem[i+1].src_offset + offset * vbuf[buf_num2].stride); } - if (r300->aos_count & 1) { + if (aos_count & 1) { int buf_num = velem[i].vertex_buffer_index; assert(vbuf[buf_num].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); OUT_CS((pf_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num].stride << 6)); @@ -614,7 +617,8 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) offset * vbuf[buf_num].stride); } - for (i = 0; i < r300->aos_count; i++) { + /* XXX bare CS reloc */ + for (i = 0; i < aos_count; i++) { cs_winsys->write_cs_reloc(cs_winsys, vbuf[velem[i].vertex_buffer_index].buffer, RADEON_GEM_DOMAIN_GTT, diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index fa057324f85..1ff3e64b449 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -140,7 +140,7 @@ static boolean r300_setup_vertex_buffers(struct r300_context *r300) struct pipe_vertex_element *velem = r300->vertex_element; validate: - for (int i = 0; i < r300->aos_count; i++) { + for (int i = 0; i < r300->vertex_element_count; i++) { if (!r300->winsys->add_buffer(r300->winsys, vbuf[velem[i].vertex_buffer_index].buffer, RADEON_GEM_DOMAIN_GTT, 0)) { diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index e0b85ab768b..d1eced61db1 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -668,7 +668,7 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, memcpy(r300->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); - r300->vbuf_count = count; + r300->vertex_buffer_count = count; if (r300->draw) { draw_flush(r300->draw); @@ -685,7 +685,7 @@ static void r300_set_vertex_elements(struct pipe_context* pipe, memcpy(r300->vertex_element, elements, sizeof(struct pipe_vertex_element) * count); - r300->aos_count = count; + r300->vertex_element_count = count; if (r300->draw) { draw_flush(r300->draw); diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index 5ad6b9c2157..a6a159667a3 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -71,12 +71,13 @@ void setup_vertex_attributes(struct r300_context *r300) struct pipe_vertex_element *vert_elem; int i; - for (i = 0; i < r300->aos_count; i++) { + for (i = 0; i < r300->vertex_element_count; i++) { vert_elem = &r300->vertex_element[i]; setup_vertex_attribute(r300->vertex_info, vert_elem, i); } - finish_vertex_attribs_setup(r300->vertex_info, r300->aos_count); + finish_vertex_attribs_setup(r300->vertex_info, + r300->vertex_element_count); } static INLINE int get_buffer_offset(struct r300_context *r300, -- 2.30.2