summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_blit.c4
-rw-r--r--src/gallium/drivers/r300/r300_context.c4
-rw-r--r--src/gallium/drivers/r300/r300_context.h6
-rw-r--r--src/gallium/drivers/r300/r300_emit.c9
-rw-r--r--src/gallium/drivers/r300/r300_render.c22
-rw-r--r--src/gallium/drivers/r300/r300_state.c12
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c4
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h2
-rw-r--r--src/gallium/drivers/r600/r600_state.c4
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c8
10 files changed, 36 insertions, 39 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 920612b8de5..103780ffe63 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -67,8 +67,8 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
r300->vbuf_mgr->vertex_buffer);
} else {
- util_blitter_save_vertex_buffers(r300->blitter, r300->swtcl_nr_vertex_buffers,
- r300->swtcl_vertex_buffer);
+ util_blitter_save_vertex_buffers(r300->blitter, r300->nr_vertex_buffers,
+ r300->vertex_buffer);
}
if (op & R300_SAVE_FRAMEBUFFER) {
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 23fac301095..74d5e8ed36c 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -80,7 +80,7 @@ static void r300_release_referenced_objects(struct r300_context *r300)
}
/* Manually-created vertex buffers. */
- pipe_resource_reference(&r300->dummy_vb, NULL);
+ pipe_resource_reference(&r300->dummy_vb.buffer, NULL);
pipe_resource_reference(&r300->vbo, NULL);
r300->context.delete_depth_stencil_alpha_state(&r300->context,
@@ -480,7 +480,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
vb.height0 = 1;
vb.depth0 = 1;
- r300->dummy_vb = screen->resource_create(screen, &vb);
+ r300->dummy_vb.buffer = screen->resource_create(screen, &vb);
}
{
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index de582666ec9..086799dbadd 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -470,7 +470,7 @@ struct r300_context {
/* When no vertex buffer is set, this one is used instead to prevent
* hardlocks. */
- struct pipe_resource *dummy_vb;
+ struct pipe_vertex_buffer dummy_vb;
/* The currently active query. */
struct r300_query *query_current;
@@ -580,8 +580,8 @@ struct r300_context {
struct u_vbuf *vbuf_mgr;
struct pipe_index_buffer index_buffer;
- struct pipe_vertex_buffer swtcl_vertex_buffer[PIPE_MAX_ATTRIBS];
- unsigned swtcl_nr_vertex_buffers;
+ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+ unsigned nr_vertex_buffers;
struct util_slab_mempool pool_transfers;
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index e4afe786d65..467339f6a62 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -823,7 +823,7 @@ void r300_emit_textures_state(struct r300_context *r300,
void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
boolean indexed, int instance_id)
{
- struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer;
+ struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
struct pipe_vertex_element *velem = r300->velems->velem;
struct r300_resource *buf;
int i;
@@ -1223,10 +1223,11 @@ validate:
r300_resource(r300->vbo)->domain);
/* ...vertex buffers for HWTCL path... */
if (do_validate_vertex_buffers && r300->vertex_arrays_dirty) {
- struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer;
- struct pipe_vertex_buffer *last = r300->vbuf_mgr->real_vertex_buffer +
- r300->vbuf_mgr->nr_real_vertex_buffers;
+ struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
+ struct pipe_vertex_buffer *last = r300->vertex_buffer +
+ r300->nr_vertex_buffers;
struct pipe_resource *buf;
+
for (; vbuf != last; vbuf++) {
buf = vbuf->buffer;
if (!buf)
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 49013c061b7..84162bfa638 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -148,7 +148,7 @@ static void r300_emit_draw_init(struct r300_context *r300, unsigned mode,
static void r300_split_index_bias(struct r300_context *r300, int index_bias,
int *buffer_offset, int *index_offset)
{
- struct pipe_vertex_buffer *vb, *vbufs = r300->vbuf_mgr->real_vertex_buffer;
+ struct pipe_vertex_buffer *vb, *vbufs = r300->vertex_buffer;
struct pipe_vertex_element *velem = r300->velems->velem;
unsigned i, size;
int max_neg_bias;
@@ -367,7 +367,7 @@ static void r300_draw_arrays_immediate(struct r300_context *r300,
velem = &r300->velems->velem[i];
size[i] = r300->velems->format_size[i] / 4;
vbi = velem->vertex_buffer_index;
- vbuf = &r300->vbuf_mgr->real_vertex_buffer[vbi];
+ vbuf = &r300->vertex_buffer[vbi];
stride[i] = vbuf->stride / 4;
/* Map the buffer. */
@@ -401,7 +401,7 @@ static void r300_draw_arrays_immediate(struct r300_context *r300,
vbi = r300->velems->velem[i].vertex_buffer_index;
if (map[vbi]) {
- r300->rws->buffer_unmap(r300_resource(r300->vbuf_mgr->real_vertex_buffer[vbi].buffer)->buf);
+ r300->rws->buffer_unmap(r300_resource(r300->vertex_buffer[vbi].buffer)->buf);
map[vbi] = NULL;
}
}
@@ -754,11 +754,7 @@ static void r300_draw_vbo(struct pipe_context* pipe,
}
r300_update_derived_state(r300);
-
- /* Start the vbuf manager and update buffers if needed. */
- if (u_vbuf_draw_begin(r300->vbuf_mgr, &info) & U_VBUF_BUFFERS_UPDATED) {
- r300->vertex_arrays_dirty = TRUE;
- }
+ u_vbuf_draw_begin(r300->vbuf_mgr, &info);
/* Draw. */
if (info.indexed) {
@@ -831,10 +827,10 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
(indexed ? PREP_INDEXED : 0),
indexed ? 256 : 6);
- for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
- if (r300->swtcl_vertex_buffer[i].buffer) {
+ for (i = 0; i < r300->nr_vertex_buffers; i++) {
+ if (r300->vertex_buffer[i].buffer) {
void *buf = pipe_buffer_map(pipe,
- r300->swtcl_vertex_buffer[i].buffer,
+ r300->vertex_buffer[i].buffer,
PIPE_TRANSFER_READ |
PIPE_TRANSFER_UNSYNCHRONIZED,
&vb_transfer[i]);
@@ -856,8 +852,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
draw_flush(r300->draw);
r300->draw_vbo_locked = FALSE;
- for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
- if (r300->swtcl_vertex_buffer[i].buffer) {
+ for (i = 0; i < r300->nr_vertex_buffers; i++) {
+ if (r300->vertex_buffer[i].buffer) {
pipe_buffer_unmap(pipe, vb_transfer[i]);
draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
}
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index ab5c18158d1..3345bae0990 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1593,22 +1593,20 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
const struct pipe_vertex_buffer* buffers)
{
struct r300_context* r300 = r300_context(pipe);
- struct pipe_vertex_buffer dummy_vb = {0};
/* There must be at least one vertex buffer set, otherwise it locks up. */
if (!count) {
- dummy_vb.buffer = r300->dummy_vb;
- buffers = &dummy_vb;
+ buffers = &r300->dummy_vb;
count = 1;
}
+ util_copy_vertex_buffers(r300->vertex_buffer,
+ &r300->nr_vertex_buffers,
+ buffers, count);
+
if (r300->screen->caps.has_tcl) {
- u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
r300->vertex_arrays_dirty = TRUE;
} else {
- util_copy_vertex_buffers(r300->swtcl_vertex_buffer,
- &r300->swtcl_nr_vertex_buffers,
- buffers, count);
draw_set_vertex_buffers(r300->draw, count, buffers);
}
}
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index a26b44516f9..3b437bad325 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1713,8 +1713,8 @@ static void evergreen_emit_db_misc_state(struct r600_context *rctx, struct r600_
static void evergreen_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom *atom)
{
struct radeon_winsys_cs *cs = rctx->cs;
- struct pipe_vertex_buffer *vb = rctx->vbuf_mgr->real_vertex_buffer;
- unsigned count = rctx->vbuf_mgr->nr_real_vertex_buffers;
+ struct pipe_vertex_buffer *vb = rctx->vertex_buffer;
+ unsigned count = rctx->nr_vertex_buffers;
unsigned i;
uint64_t va;
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index e49fbdf898a..dfc93d1ff70 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -355,6 +355,8 @@ struct r600_context {
unsigned color0_format;
struct pipe_index_buffer index_buffer;
+ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+ unsigned nr_vertex_buffers;
};
static INLINE void r600_emit_atom(struct r600_context *rctx, struct r600_atom *atom)
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 9d3197419e5..2498196fd5e 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1692,8 +1692,8 @@ static void r600_emit_db_misc_state(struct r600_context *rctx, struct r600_atom
static void r600_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom *atom)
{
struct radeon_winsys_cs *cs = rctx->cs;
- struct pipe_vertex_buffer *vb = rctx->vbuf_mgr->real_vertex_buffer;
- unsigned count = rctx->vbuf_mgr->nr_real_vertex_buffers;
+ struct pipe_vertex_buffer *vb = rctx->vertex_buffer;
+ unsigned count = rctx->nr_vertex_buffers;
unsigned i, offset;
for (i = 0; i < count; i++) {
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index a2cf05def17..864996d006f 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -400,7 +400,7 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
{
struct r600_context *rctx = (struct r600_context *)ctx;
- u_vbuf_set_vertex_buffers(rctx->vbuf_mgr, count, buffers);
+ util_copy_vertex_buffers(rctx->vertex_buffer, &rctx->nr_vertex_buffers, buffers, count);
rctx->vertex_buffers_dirty = true;
}
@@ -766,11 +766,11 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo)
r600_update_derived_state(rctx);
/* Update vertex buffers. */
- if ((u_vbuf_draw_begin(rctx->vbuf_mgr, &info) & U_VBUF_BUFFERS_UPDATED) ||
- rctx->vertex_buffers_dirty) {
+ u_vbuf_draw_begin(rctx->vbuf_mgr, &info);
+ if (rctx->vertex_buffers_dirty) {
r600_inval_vertex_cache(rctx);
rctx->vertex_buffer_state.num_dw = (rctx->chip_class >= EVERGREEN ? 12 : 10) *
- rctx->vbuf_mgr->nr_real_vertex_buffers;
+ rctx->nr_vertex_buffers;
r600_atom_dirty(rctx, &rctx->vertex_buffer_state);
rctx->vertex_buffers_dirty = FALSE;
}