summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-03-31 22:17:19 +0200
committerMarek Olšák <[email protected]>2012-04-04 04:28:40 +0200
commitda2123051c3923a2953cdd96f05ad684e7d3c8c3 (patch)
treeebd9cfa49f4a8b2cc8131e0c0afd6fbdfeffa235 /src/gallium/drivers/r300/r300_state.c
parent5ce0598a034179eaacff96f39eaebf0ba0f30d4c (diff)
r300g/swtcl: don't enter u_vbuf_mgr
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index a623ff898a7..05ed81b2b9d 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1589,7 +1589,6 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
const struct pipe_vertex_buffer* buffers)
{
struct r300_context* r300 = r300_context(pipe);
- unsigned i;
struct pipe_vertex_buffer dummy_vb = {0};
/* There must be at least one vertex buffer set, otherwise it locks up. */
@@ -1599,18 +1598,13 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
count = 1;
}
- u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
-
if (r300->screen->caps.has_tcl) {
- /* HW TCL. */
- for (i = 0; i < count; i++) {
- if (buffers[i].buffer &&
- !r300_resource(buffers[i].buffer)->b.user_ptr) {
- }
- }
+ u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
r300->vertex_arrays_dirty = TRUE;
} else {
- /* SW TCL. */
+ util_copy_vertex_buffers(r300->swtcl_vertex_buffer,
+ &r300->swtcl_nr_vertex_buffers,
+ buffers, count);
draw_set_vertex_buffers(r300->draw, count, buffers);
}
}
@@ -1620,9 +1614,15 @@ static void r300_set_index_buffer(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
- u_vbuf_set_index_buffer(r300->vbuf_mgr, ib);
-
- if (!r300->screen->caps.has_tcl) {
+ if (r300->screen->caps.has_tcl) {
+ u_vbuf_set_index_buffer(r300->vbuf_mgr, ib);
+ } else {
+ if (ib) {
+ pipe_resource_reference(&r300->swtcl_index_buffer.buffer, ib->buffer);
+ memcpy(&r300->swtcl_index_buffer, ib, sizeof(*ib));
+ } else {
+ pipe_resource_reference(&r300->swtcl_index_buffer.buffer, NULL);
+ }
draw_set_index_buffer(r300->draw, ib);
}
}
@@ -1696,11 +1696,11 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
return NULL;
velems->count = count;
- velems->vmgr_elements =
- u_vbuf_create_vertex_elements(r300->vbuf_mgr, count, attribs,
- velems->velem);
if (r300_screen(pipe->screen)->caps.has_tcl) {
+ velems->vmgr_elements =
+ u_vbuf_create_vertex_elements(r300->vbuf_mgr, count, attribs,
+ velems->velem);
/* Setup PSC.
* The unused components will be replaced by (..., 0, 1). */
r300_vertex_psc(velems);
@@ -1710,6 +1710,8 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
align(util_format_get_blocksize(velems->velem[i].src_format), 4);
velems->vertex_size_dwords += velems->format_size[i] / 4;
}
+ } else {
+ memcpy(velems->velem, attribs, count * sizeof(struct pipe_vertex_element));
}
return velems;
@@ -1727,9 +1729,9 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
r300->velems = velems;
- u_vbuf_bind_vertex_elements(r300->vbuf_mgr, state, velems->vmgr_elements);
-
- if (r300->draw) {
+ if (r300->screen->caps.has_tcl) {
+ u_vbuf_bind_vertex_elements(r300->vbuf_mgr, state, velems->vmgr_elements);
+ } else {
draw_set_vertex_elements(r300->draw, velems->count, velems->velem);
return;
}
@@ -1744,7 +1746,9 @@ static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *s
struct r300_context *r300 = r300_context(pipe);
struct r300_vertex_element_state *velems = state;
- u_vbuf_destroy_vertex_elements(r300->vbuf_mgr, velems->vmgr_elements);
+ if (r300->screen->caps.has_tcl) {
+ u_vbuf_destroy_vertex_elements(r300->vbuf_mgr, velems->vmgr_elements);
+ }
FREE(state);
}