aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/i915')
-rw-r--r--src/gallium/drivers/i915/i915_context.c9
-rw-r--r--src/gallium/drivers/i915/i915_resource_buffer.c1
-rw-r--r--src/gallium/drivers/i915/i915_screen.c5
-rw-r--r--src/gallium/drivers/i915/i915_state.c17
4 files changed, 25 insertions, 7 deletions
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 052a059c268..f3c7b30527c 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -53,7 +53,7 @@ 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;
+ const void *mapped_indices = NULL;
/*
@@ -67,8 +67,11 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
/*
* Map index buffer, if present
*/
- if (info->indexed && i915->index_buffer.buffer)
- mapped_indices = i915_buffer(i915->index_buffer.buffer)->data;
+ if (info->indexed) {
+ mapped_indices = i915->index_buffer.user_buffer;
+ if (!mapped_indices)
+ mapped_indices = i915_buffer(i915->index_buffer.buffer)->data;
+ }
draw_set_mapped_index_buffer(draw, mapped_indices);
if (i915->constants[PIPE_SHADER_VERTEX])
diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c
index 6718948fe5c..77c03450b3a 100644
--- a/src/gallium/drivers/i915/i915_resource_buffer.c
+++ b/src/gallium/drivers/i915/i915_resource_buffer.c
@@ -183,7 +183,6 @@ i915_user_buffer_create(struct pipe_screen *screen,
buf->b.b.height0 = 1;
buf->b.b.depth0 = 1;
buf->b.b.array_size = 1;
- buf->b.b.user_ptr = ptr;
buf->data = ptr;
buf->free_on_destroy = FALSE;
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 1546ee80230..00468602c09 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -181,6 +181,8 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_TGSI_INSTANCEID:
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
case PIPE_CAP_USER_VERTEX_BUFFERS:
+ case PIPE_CAP_USER_INDEX_BUFFERS:
+ case PIPE_CAP_USER_CONSTANT_BUFFERS:
return 1;
/* Unsupported features (boolean caps). */
@@ -206,6 +208,9 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
return 0;
+ case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
+ return 16;
+
/* Features we can lie about (boolean caps). */
case PIPE_CAP_OCCLUSION_QUERY:
return is->debug.lie ? 1 : 0;
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 4c284d9fcbb..bd9e8bac0ae 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -665,12 +665,18 @@ static void i915_delete_vs_state(struct pipe_context *pipe, void *shader)
static void i915_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
- struct pipe_resource *buf)
+ struct pipe_constant_buffer *cb)
{
struct i915_context *i915 = i915_context(pipe);
+ struct pipe_resource *buf = cb ? cb->buffer : NULL;
unsigned new_num = 0;
boolean diff = TRUE;
+ if (cb && cb->user_buffer) {
+ buf = i915_user_buffer_create(pipe->screen, cb->user_buffer,
+ cb->buffer_size,
+ PIPE_BIND_CONSTANT_BUFFER);
+ }
/* XXX don't support geom shaders now */
if (shader == PIPE_SHADER_GEOMETRY)
@@ -706,6 +712,10 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
if (diff)
i915->dirty |= shader == PIPE_SHADER_VERTEX ? I915_NEW_VS_CONSTANTS : I915_NEW_FS_CONSTANTS;
+
+ if (cb && cb->user_buffer) {
+ pipe_resource_reference(&buf, NULL);
+ }
}
@@ -982,7 +992,9 @@ static void i915_set_vertex_buffers(struct pipe_context *pipe,
/* map new */
for (i = 0; i < count; i++) {
- void *buf = i915_buffer(buffers[i].buffer)->data;
+ const void *buf = buffers[i].user_buffer;
+ if (!buf)
+ buf = i915_buffer(buffers[i].buffer)->data;
draw_set_mapped_vertex_buffer(draw, i, buf);
}
}
@@ -1092,7 +1104,6 @@ i915_init_state_functions( struct i915_context *i915 )
i915->base.set_viewport_state = i915_set_viewport_state;
i915->base.set_vertex_buffers = i915_set_vertex_buffers;
i915->base.set_index_buffer = i915_set_index_buffer;
- i915->base.redefine_user_buffer = u_default_redefine_user_buffer;
}
void