util_blitter_save_vertex_shader(r300->blitter, r300->vs_state.state);
util_blitter_save_viewport(r300->blitter, &r300->viewport);
util_blitter_save_vertex_elements(r300->blitter, r300->velems);
- util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
- r300->vbuf_mgr->vertex_buffer);
+ if (r300->vbuf_mgr) {
+ 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);
+ }
if (op & R300_SAVE_FRAMEBUFFER) {
util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
r300_init_query_functions(r300);
r300_init_state_functions(r300);
r300_init_resource_functions(r300);
-
+
r300->context.create_video_decoder = vl_create_decoder;
r300->context.create_video_buffer = vl_video_buffer_create;
- r300->vbuf_mgr = u_vbuf_create(&r300->context, 1024 * 1024, 16,
+ if (r300->screen->caps.has_tcl) {
+ r300->vbuf_mgr = u_vbuf_create(&r300->context, 1024 * 1024, 16,
PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER,
U_VERTEX_FETCH_DWORD_ALIGNED);
- if (!r300->vbuf_mgr)
- goto fail;
- r300->vbuf_mgr->caps.format_fixed32 = 0;
+ if (!r300->vbuf_mgr)
+ goto fail;
+ r300->vbuf_mgr->caps.format_fixed32 = 0;
+ }
r300->blitter = util_blitter_create(&r300->context);
if (r300->blitter == NULL)
void *dsa_decompress_zmask;
struct u_vbuf *vbuf_mgr;
+ struct pipe_index_buffer swtcl_index_buffer;
+ struct pipe_vertex_buffer swtcl_vertex_buffer[PIPE_MAX_ATTRIBS];
+ unsigned swtcl_nr_vertex_buffers;
struct util_slab_mempool pool_transfers;
struct pipe_transfer *ib_transfer = NULL;
int i;
void *indices = NULL;
- boolean indexed = info->indexed && r300->vbuf_mgr->index_buffer.buffer;
+ boolean indexed = info->indexed && r300->swtcl_index_buffer.buffer;
if (r300->skip_rendering) {
return;
(indexed ? PREP_INDEXED : 0),
indexed ? 256 : 6);
- for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
- if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
+ for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
+ if (r300->swtcl_vertex_buffer[i].buffer) {
void *buf = pipe_buffer_map(pipe,
- r300->vbuf_mgr->vertex_buffer[i].buffer,
+ r300->swtcl_vertex_buffer[i].buffer,
PIPE_TRANSFER_READ |
PIPE_TRANSFER_UNSYNCHRONIZED,
&vb_transfer[i]);
}
if (indexed) {
- indices = pipe_buffer_map(pipe, r300->vbuf_mgr->index_buffer.buffer,
+ indices = pipe_buffer_map(pipe, r300->swtcl_index_buffer.buffer,
PIPE_TRANSFER_READ |
PIPE_TRANSFER_UNSYNCHRONIZED, &ib_transfer);
}
draw_flush(r300->draw);
r300->draw_vbo_locked = FALSE;
- for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
- if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
+ for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
+ if (r300->swtcl_vertex_buffer[i].buffer) {
pipe_buffer_unmap(pipe, vb_transfer[i]);
draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
}
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. */
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);
}
}
{
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);
}
}
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);
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;
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;
}
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);
}