unsigned size; /* Size of the whole buffer, in bytes. */
unsigned bind; /* Bitmask of PIPE_BIND_* flags. */
enum pipe_resource_usage usage;
+ unsigned flags; /* pipe_resource::flags */
boolean zero_buffer_memory; /* If the buffer contents should be zeroed. */
struct pipe_resource *buffer; /* The buffer we suballocate from. */
*/
struct u_suballocator *
u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
- enum pipe_resource_usage usage,
+ enum pipe_resource_usage usage, unsigned flags,
boolean zero_buffer_memory)
{
struct u_suballocator *allocator = CALLOC_STRUCT(u_suballocator);
allocator->size = size;
allocator->bind = bind;
allocator->usage = usage;
+ allocator->flags = flags;
allocator->zero_buffer_memory = zero_buffer_memory;
return allocator;
}
/* Allocate a new buffer. */
pipe_resource_reference(&allocator->buffer, NULL);
allocator->offset = 0;
- allocator->buffer =
- pipe_buffer_create(allocator->pipe->screen, allocator->bind,
- allocator->usage, allocator->size);
+
+ struct pipe_resource templ;
+ memset(&templ, 0, sizeof(templ));
+ templ.target = PIPE_BUFFER;
+ templ.format = PIPE_FORMAT_R8_UNORM;
+ templ.bind = allocator->bind;
+ templ.usage = allocator->usage;
+ templ.flags = allocator->flags;
+ templ.width0 = allocator->size;
+ templ.height0 = 1;
+ templ.depth0 = 1;
+ templ.array_size = 1;
+
+ struct pipe_screen *screen = allocator->pipe->screen;
+ allocator->buffer = screen->resource_create(screen, &templ);
if (!allocator->buffer)
goto fail;
r600_context_gfx_flush, rctx);
rctx->b.gfx.flush = r600_context_gfx_flush;
- rctx->allocator_fetch_shader = u_suballocator_create(&rctx->b.b, 64 * 1024,
- 0, PIPE_USAGE_DEFAULT, FALSE);
+ rctx->allocator_fetch_shader =
+ u_suballocator_create(&rctx->b.b, 64 * 1024,
+ 0, PIPE_USAGE_DEFAULT, 0, FALSE);
if (!rctx->allocator_fetch_shader)
goto fail;
rctx->allocator_zeroed_memory =
u_suballocator_create(&rctx->b, rscreen->info.gart_page_size,
- 0, PIPE_USAGE_DEFAULT, true);
+ 0, PIPE_USAGE_DEFAULT, 0, true);
if (!rctx->allocator_zeroed_memory)
return false;