diff options
author | Nicolai Hähnle <[email protected]> | 2017-02-02 23:32:48 +0100 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-04-05 10:37:16 +0200 |
commit | d9bc4d8305c3f3ee4b82386ae119d72d3a66a4d2 (patch) | |
tree | 625c49a29a5307f38a82f9d358a71bb0bc50b5ba /src | |
parent | 2599b23f7c7a00b5711831792c2acdf1786c99aa (diff) |
st/mesa: plumbing for sparse buffers
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 7c202ebcc50..5911d1e1604 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -293,6 +293,8 @@ st_bufferobj_data(struct gl_context *ctx, pipe_flags |= PIPE_RESOURCE_FLAG_MAP_PERSISTENT; if (storageFlags & GL_MAP_COHERENT_BIT) pipe_flags |= PIPE_RESOURCE_FLAG_MAP_COHERENT; + if (storageFlags & GL_SPARSE_STORAGE_BIT_ARB) + pipe_flags |= PIPE_RESOURCE_FLAG_SPARSE; pipe_resource_reference( &st_obj->buffer, NULL ); @@ -559,6 +561,23 @@ st_bufferobj_validate_usage(struct st_context *st, { } +static void +st_bufferobj_page_commitment(struct gl_context *ctx, + struct gl_buffer_object *bufferObj, + GLintptr offset, GLsizeiptr size, + GLboolean commit) +{ + struct pipe_context *pipe = st_context(ctx)->pipe; + struct st_buffer_object *buf = st_buffer_object(bufferObj); + struct pipe_box box; + + u_box_1d(offset, size, &box); + + if (!pipe->resource_commit(pipe, buf->buffer, 0, &box, commit)) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferPageCommitmentARB(out of memory)"); + return; + } +} void st_init_bufferobject_functions(struct pipe_screen *screen, @@ -577,6 +596,7 @@ st_init_bufferobject_functions(struct pipe_screen *screen, functions->UnmapBuffer = st_bufferobj_unmap; functions->CopyBufferSubData = st_copy_buffer_subdata; functions->ClearBufferSubData = st_clear_buffer_subdata; + functions->BufferPageCommitment = st_bufferobj_page_commitment; if (screen->get_param(screen, PIPE_CAP_INVALIDATE_BUFFER)) functions->InvalidateBufferSubData = st_bufferobj_invalidate; |