r300g: Unify context names for counts.

From the SW TCL fixups.
This commit is contained in:
Corbin Simpson 2009-11-08 11:45:57 -08:00
parent b6f93e2607
commit 11d9edf4c9
6 changed files with 19 additions and 14 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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,

View file

@ -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)) {

View file

@ -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);

View file

@ -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,