summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/failover
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-03-29 14:41:03 +0100
committerMichal Krol <michal@tungstengraphics.com>2008-03-29 14:41:03 +0100
commita52c0416d1f2105960b4646e2e268aed26814689 (patch)
treec49a0e4bce225c3126c6acf3ea3205aed99b1d93 /src/gallium/drivers/failover
parentf10016b9a0639d7bc814c7b92a30d5b5b2cba5ad (diff)
gallium: Set vertex state/buffers en-mass.
Diffstat (limited to 'src/gallium/drivers/failover')
-rw-r--r--src/gallium/drivers/failover/fo_context.h9
-rw-r--r--src/gallium/drivers/failover/fo_state.c35
-rw-r--r--src/gallium/drivers/failover/fo_state_emit.c22
3 files changed, 30 insertions, 36 deletions
diff --git a/src/gallium/drivers/failover/fo_context.h b/src/gallium/drivers/failover/fo_context.h
index 4afe10c4b8..c6409fe1e1 100644
--- a/src/gallium/drivers/failover/fo_context.h
+++ b/src/gallium/drivers/failover/fo_context.h
@@ -84,15 +84,16 @@ struct failover_context {
struct pipe_scissor_state scissor;
struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
- struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
+ struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
+ struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
+
+ uint num_vertex_buffers;
+ uint num_vertex_elements;
void *sw_sampler_state[PIPE_MAX_SAMPLERS];
void *hw_sampler_state[PIPE_MAX_SAMPLERS];
unsigned dirty;
- unsigned dirty_vertex_buffer;
- unsigned dirty_vertex_element;
unsigned num_samplers;
unsigned num_textures;
diff --git a/src/gallium/drivers/failover/fo_state.c b/src/gallium/drivers/failover/fo_state.c
index 11eec2714e..6a79706632 100644
--- a/src/gallium/drivers/failover/fo_state.c
+++ b/src/gallium/drivers/failover/fo_state.c
@@ -402,32 +402,35 @@ failover_set_viewport_state( struct pipe_context *pipe,
static void
-failover_set_vertex_buffer(struct pipe_context *pipe,
- unsigned unit,
- const struct pipe_vertex_buffer *vertex_buffer)
+failover_set_vertex_buffers(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_buffer *vertex_buffers)
{
struct failover_context *failover = failover_context(pipe);
- failover->vertex_buffer[unit] = *vertex_buffer;
+ memcpy(failover->vertex_buffers, vertex_buffers,
+ count * sizeof(vertex_buffers[0]));
failover->dirty |= FO_NEW_VERTEX_BUFFER;
- failover->dirty_vertex_buffer |= (1<<unit);
- failover->sw->set_vertex_buffer( failover->sw, unit, vertex_buffer );
- failover->hw->set_vertex_buffer( failover->hw, unit, vertex_buffer );
+ failover->num_vertex_buffers = count;
+ failover->sw->set_vertex_buffers( failover->sw, count, vertex_buffers );
+ failover->hw->set_vertex_buffers( failover->hw, count, vertex_buffers );
}
static void
-failover_set_vertex_element(struct pipe_context *pipe,
- unsigned unit,
- const struct pipe_vertex_element *vertex_element)
+failover_set_vertex_elements(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *vertex_elements)
{
struct failover_context *failover = failover_context(pipe);
- failover->vertex_element[unit] = *vertex_element;
+ memcpy(failover->vertex_elements, vertex_elements,
+ count * sizeof(vertex_elements[0]));
+
failover->dirty |= FO_NEW_VERTEX_ELEMENT;
- failover->dirty_vertex_element |= (1<<unit);
- failover->sw->set_vertex_element( failover->sw, unit, vertex_element );
- failover->hw->set_vertex_element( failover->hw, unit, vertex_element );
+ failover->num_vertex_elements = count;
+ failover->sw->set_vertex_elements( failover->sw, count, vertex_elements );
+ failover->hw->set_vertex_elements( failover->hw, count, vertex_elements );
}
void
@@ -474,7 +477,7 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.set_scissor_state = failover_set_scissor_state;
failover->pipe.set_sampler_textures = failover_set_sampler_textures;
failover->pipe.set_viewport_state = failover_set_viewport_state;
- failover->pipe.set_vertex_buffer = failover_set_vertex_buffer;
- failover->pipe.set_vertex_element = failover_set_vertex_element;
+ failover->pipe.set_vertex_buffers = failover_set_vertex_buffers;
+ failover->pipe.set_vertex_elements = failover_set_vertex_elements;
failover->pipe.set_constant_buffer = failover_set_constant_buffer;
}
diff --git a/src/gallium/drivers/failover/fo_state_emit.c b/src/gallium/drivers/failover/fo_state_emit.c
index bb89f925e9..bd4fce9d20 100644
--- a/src/gallium/drivers/failover/fo_state_emit.c
+++ b/src/gallium/drivers/failover/fo_state_emit.c
@@ -53,8 +53,6 @@
void
failover_state_emit( struct failover_context *failover )
{
- unsigned i;
-
if (failover->dirty & FO_NEW_BLEND)
failover->sw->bind_blend_state( failover->sw,
failover->blend->sw_state );
@@ -104,24 +102,16 @@ failover_state_emit( struct failover_context *failover )
}
if (failover->dirty & FO_NEW_VERTEX_BUFFER) {
- for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
- if (failover->dirty_vertex_buffer & (1<<i)) {
- failover->sw->set_vertex_buffer( failover->sw, i,
- &failover->vertex_buffer[i] );
- }
- }
+ failover->sw->set_vertex_buffers( failover->sw,
+ failover->num_vertex_buffers,
+ failover->vertex_buffers );
}
if (failover->dirty & FO_NEW_VERTEX_ELEMENT) {
- for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
- if (failover->dirty_vertex_element & (1<<i)) {
- failover->sw->set_vertex_element( failover->sw, i,
- &failover->vertex_element[i] );
- }
- }
+ failover->sw->set_vertex_elements( failover->sw,
+ failover->num_vertex_elements,
+ failover->vertex_elements );
}
failover->dirty = 0;
- failover->dirty_vertex_element = 0;
- failover->dirty_vertex_buffer = 0;
}