rctx->ps_shader);
util_blitter_save_vertex_shader(rctx->blitter,
rctx->vs_shader);
+ util_blitter_save_vertex_elements(rctx->blitter,
+ rctx->vertex_elements);
+ util_blitter_save_viewport(rctx->blitter,
+ rctx->viewport);
}
void r600_clear(struct pipe_context *ctx, unsigned buffers,
struct r600_context *rctx = (struct r600_context*)ctx;
struct pipe_framebuffer_state *fb = &rctx->fb_state;
-#if 0
r600_blitter_save_states(ctx);
util_blitter_clear(rctx->blitter, fb->width, fb->height,
fb->nr_cbufs, buffers, rgba, depth,
stencil);
-#endif
}
void r600_surface_copy(struct pipe_context *ctx,
if (rbuffer == NULL)
return NULL;
- pipe_reference_init(&rbuffer->b.b.reference, 1);
rbuffer->b.b = *templ;
+ pipe_reference_init(&rbuffer->b.b.reference, 1);
rbuffer->b.b.screen = screen;
rbuffer->b.vtbl = &r600_buffer_vtbl;
if (radeon_ctx_pm4(rctx->ctx))
return;
- if (dc)
- return;
- radeon_ctx_dump_bof(rctx->ctx, "gallium.bof");
+ if (!dc)
+ radeon_ctx_dump_bof(rctx->ctx, "gallium.bof");
radeon_ctx_submit(rctx->ctx);
rctx->ctx = radeon_ctx_decref(rctx->ctx);
rctx->ctx = radeon_ctx(rscreen->rw);
r600_init_query_functions(rctx);
r600_init_state_functions(rctx);
r600_init_context_resource_functions(rctx);
-#if 0
+
rctx->blitter = util_blitter_create(&rctx->context);
if (rctx->blitter == NULL) {
FREE(rctx);
return NULL;
}
-#endif
rctx->cb_cntl = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL);
rctx->cb_cntl->states[R600_CB_CNTL__CB_SHADER_MASK] = 0x0000000F;
struct r600_state;
typedef void (*r600_state_destroy_t)(struct r600_state *rstate);
+/* XXX move this to a more appropriate place */
+struct r600_vertex_elements_state
+{
+ unsigned count;
+ struct pipe_vertex_element elements[32];
+};
+
struct r600_state {
unsigned type;
struct r600_atom *atom;
struct r600_pipe_shader *vs_shader;
unsigned flat_shade;
unsigned nvertex_buffer;
- unsigned nvertex_element;
+ struct r600_vertex_elements_state *vertex_elements;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
struct blitter_context *blitter;
struct pipe_stencil_ref stencil_ref;
struct pipe_framebuffer_state fb_state;
struct radeon_draw *draw;
+ struct pipe_viewport_state *viewport;
};
void r600_draw_arrays(struct pipe_context *ctx, unsigned mode,
if (r)
return r;
- for (i = 0 ; i < rctx->nvertex_element; i++) {
- j = rctx->vertex_element[i].vertex_buffer_index;
+ for (i = 0 ; i < rctx->vertex_elements->count; i++) {
+ j = rctx->vertex_elements->elements[i].vertex_buffer_index;
rbuffer = (struct r600_buffer*)rctx->vertex_buffer[j].buffer;
- offset = rctx->vertex_element[i].src_offset + rctx->vertex_buffer[j].buffer_offset;
- r = r600_conv_pipe_format(rctx->vertex_element[i].src_format, &format);
+ offset = rctx->vertex_elements->elements[i].src_offset + rctx->vertex_buffer[j].buffer_offset;
+ r = r600_conv_pipe_format(rctx->vertex_elements->elements[i].src_format, &format);
if (r)
return r;
vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + i);
rshader = &rpshader->shader;
switch (rpshader->type) {
case C_PROGRAM_TYPE_VS:
- for (i = 0; i < rctx->nvertex_element; i++) {
- resource_format[nresources++] = rctx->vertex_element[i].src_format;
+ for (i = 0; i < rctx->vertex_elements->count; i++) {
+ resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format;
}
break;
default:
rctx->db->bo[0] = radeon_bo_incref(rscreen->rw, rstate->bo[0]);
rctx->db->nbo = 1;
rctx->db->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ rctx->fb_state = *state;
}
static void *r600_create_fs_state(struct pipe_context *ctx,
return;
}
radeon_draw_set_new(rctx->draw, rstate);
+ rctx->viewport = state;
}
static void r600_set_vertex_buffers(struct pipe_context *ctx,
rctx->nvertex_buffer = count;
}
-/* XXX move this to a more appropriate place */
-struct r600_vertex_elements_state
-{
- unsigned count;
- struct pipe_vertex_element elements[32];
-};
static void *r600_create_vertex_elements_state(struct pipe_context *ctx,
unsigned count,
struct r600_context *rctx = (struct r600_context*)ctx;
struct r600_vertex_elements_state *v = (struct r600_vertex_elements_state*)state;
- memcpy(rctx->vertex_element, v->elements, v->count * sizeof(struct pipe_vertex_element));
- rctx->nvertex_element = v->count;
+ rctx->vertex_elements = v;
}
static void r600_delete_vertex_elements_state(struct pipe_context *ctx, void *state)
{
struct r600_texture *rtex = (struct r600_texture*)ptex;
- pipe_resource_reference((struct pipe_resource**)&rtex, NULL);
FREE(rtex);
}