From 1b77138a1effe2e18a9ce9e16c43852ff855a7be Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 16 Feb 2009 02:53:34 -0800 Subject: r300-gallium: Add draw_arrays and friends. This is the last bit of Gallium-side plumbing for drawing things. From this point on, the only missing parts should be in r3xx-specific code areas... --- src/gallium/drivers/r300/r300_state.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers/r300/r300_state.c') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 6ecd61e3a2..559844f9b4 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -22,7 +22,9 @@ #include "util/u_math.h" #include "util/u_pack_color.h" + #include "pipe/p_debug.h" +#include "pipe/internal/p_winsys_screen.h" #include "r300_context.h" #include "r300_reg.h" @@ -211,7 +213,24 @@ static void uint shader, uint index, const struct pipe_constant_buffer* buffer) { - /* XXX */ + struct r300_context* r300 = r300_context(pipe); + + /* This entire chunk of code seems ever-so-slightly baked. + * It's as if I've got pipe_buffer* matryoshkas... */ + if (buffer && buffer->buffer && buffer->buffer->size) { + void* map = pipe->winsys->buffer_map(pipe->winsys, buffer->buffer, + PIPE_BUFFER_USAGE_CPU_READ); + memcpy(r300->shader_constants[shader].constants, + map, buffer->buffer->size); + pipe->winsys->buffer_unmap(pipe->winsys, map); + + r300->shader_constants[shader].user_count = + buffer->buffer->size / (sizeof(float) * 4); + } else { + r300->shader_constants[shader].user_count = 0; + } + + r300->dirty_state |= R300_NEW_CONSTANTS; } static uint32_t translate_depth_stencil_function(int zs_func) { @@ -738,7 +757,12 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, const struct pipe_vertex_buffer* buffers) { struct r300_context* r300 = r300_context(pipe); - /* XXX Draw */ + + memcpy(r300->vertex_buffers, buffers, + sizeof(struct pipe_vertex_buffer) * count); + + r300->vertex_buffer_count = count; + draw_flush(r300->draw); draw_set_vertex_buffers(r300->draw, count, buffers); } -- cgit v1.2.3