aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915/i915_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/i915/i915_context.c')
-rw-r--r--src/gallium/drivers/i915/i915_context.c56
1 files changed, 15 insertions, 41 deletions
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 2af9bdac956..2beb9e3091f 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -45,16 +45,11 @@
static void
-i915_draw_range_elements(struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize,
- int indexBias,
- unsigned min_index,
- unsigned max_index,
- unsigned prim, unsigned start, unsigned count)
+i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
{
struct i915_context *i915 = i915_context(pipe);
struct draw_context *draw = i915->draw;
+ void *mapped_indices = NULL;
unsigned i;
if (i915->dirty)
@@ -71,16 +66,18 @@ i915_draw_range_elements(struct pipe_context *pipe,
/*
* Map index buffer, if present
*/
- if (indexBuffer) {
- void *mapped_indexes = i915_buffer(indexBuffer)->data;
- draw_set_mapped_element_buffer_range(draw, indexSize, indexBias,
- min_index,
- max_index,
- mapped_indexes);
- } else {
- draw_set_mapped_element_buffer(draw, 0, 0, NULL);
+ if (info->indexed && i915->index_buffer.buffer) {
+ char *indices = (char *) i915_buffer(i915->index_buffer.buffer)->data;
+ mapped_indices = (void *) (indices + i915->index_buffer.offset);
}
+ draw_set_mapped_element_buffer_range(draw, (mapped_indices) ?
+ i915->index_buffer.index_size : 0,
+ info->index_bias,
+ info->min_index,
+ info->max_index,
+ mapped_indices);
+
draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
i915->current.constants[PIPE_SHADER_VERTEX],
@@ -90,7 +87,7 @@ i915_draw_range_elements(struct pipe_context *pipe,
/*
* Do the drawing
*/
- draw_arrays(i915->draw, prim, start, count);
+ draw_arrays(i915->draw, info->mode, info->start, info->count);
/*
* unmap vertex/index buffers
@@ -99,32 +96,11 @@ i915_draw_range_elements(struct pipe_context *pipe,
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
- if (indexBuffer) {
+ if (mapped_indices) {
draw_set_mapped_element_buffer(draw, 0, 0, NULL);
}
}
-static void
-i915_draw_elements(struct pipe_context *pipe,
- struct pipe_resource *indexBuffer,
- unsigned indexSize, int indexBias,
- unsigned prim, unsigned start, unsigned count)
-{
- i915_draw_range_elements(pipe, indexBuffer,
- indexSize, indexBias,
- 0, 0xffffffff,
- prim, start, count);
-}
-
-static void
-i915_draw_arrays(struct pipe_context *pipe,
- unsigned prim, unsigned start, unsigned count)
-{
- i915_draw_elements(pipe, NULL, 0, 0, prim, start, count);
-}
-
-
-
/*
* Generic context functions
@@ -168,9 +144,7 @@ i915_create_context(struct pipe_screen *screen, void *priv)
i915->base.clear = i915_clear;
- i915->base.draw_arrays = i915_draw_arrays;
- i915->base.draw_elements = i915_draw_elements;
- i915->base.draw_range_elements = i915_draw_range_elements;
+ i915->base.draw_vbo = i915_draw_vbo;
/*
* Create drawing context and plug our rendering stage into it.