diff options
author | Marek Olšák <[email protected]> | 2015-02-10 14:00:57 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-02-17 17:31:48 +0100 |
commit | 8b587ee7011aee900fd84f6203467ba899f2ed01 (patch) | |
tree | 8cd327663f977a8993098b2dcb86802827c94bae /src/mesa | |
parent | 11ebb03c26a7af4e975f5611303f6caf98f8a315 (diff) |
gallium: add interface and state tracker support for GL_AMD_pinned_memory
v2: add alignment restrictions to docs, fix indentation in headers
Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 18 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 1 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 90f786cc1f2..f24805cf5dd 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -186,7 +186,8 @@ st_bufferobj_data(struct gl_context *ctx, struct st_buffer_object *st_obj = st_buffer_object(obj); unsigned bind, pipe_usage, pipe_flags = 0; - if (size && data && st_obj->buffer && + if (target != GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD && + size && data && st_obj->buffer && st_obj->Base.Size == size && st_obj->Base.Usage == usage && st_obj->Base.StorageFlags == storageFlags) { @@ -287,6 +288,7 @@ st_bufferobj_data(struct gl_context *ctx, } if (size != 0) { + struct pipe_screen *screen = pipe->screen; struct pipe_resource buffer; memset(&buffer, 0, sizeof buffer); @@ -300,16 +302,22 @@ st_bufferobj_data(struct gl_context *ctx, buffer.depth0 = 1; buffer.array_size = 1; - st_obj->buffer = pipe->screen->resource_create(pipe->screen, &buffer); + if (target == GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD) { + st_obj->buffer = + screen->resource_from_user_memory(screen, &buffer, (void*)data); + } + else { + st_obj->buffer = screen->resource_create(screen, &buffer); + + if (st_obj->buffer && data) + pipe_buffer_write(pipe, st_obj->buffer, 0, size, data); + } if (!st_obj->buffer) { /* out of memory */ st_obj->Base.Size = 0; return GL_FALSE; } - - if (data) - pipe_buffer_write(pipe, st_obj->buffer, 0, size, data); } /* BufferData may change an array or uniform buffer, need to update it */ diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 2b5cde28041..036fac71a0c 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -446,6 +446,7 @@ void st_init_extensions(struct pipe_screen *screen, { o(EXT_texture_swizzle), PIPE_CAP_TEXTURE_SWIZZLE }, { o(EXT_transform_feedback), PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS }, + { o(AMD_pinned_memory), PIPE_CAP_RESOURCE_FROM_USER_MEMORY }, { o(AMD_seamless_cubemap_per_texture), PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE }, { o(ATI_separate_stencil), PIPE_CAP_TWO_SIDED_STENCIL }, { o(ATI_texture_mirror_once), PIPE_CAP_TEXTURE_MIRROR_CLAMP }, |