diff options
author | marha <marha@users.sourceforge.net> | 2015-02-22 21:39:56 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2015-02-22 21:39:56 +0100 |
commit | 462f18c7b25fe3e467f837647d07ab0a78aa8d2b (patch) | |
tree | fc8013c0a1bac05a1945846c1697e973f4c35013 /mesalib/src/mesa/main/bufferobj.c | |
parent | 36f711ee12b6dd5184198abed3aa551efb585587 (diff) | |
download | vcxsrv-462f18c7b25fe3e467f837647d07ab0a78aa8d2b.tar.gz vcxsrv-462f18c7b25fe3e467f837647d07ab0a78aa8d2b.tar.bz2 vcxsrv-462f18c7b25fe3e467f837647d07ab0a78aa8d2b.zip |
Merged origin/release (checked in because wanted to merge new stuff)
Diffstat (limited to 'mesalib/src/mesa/main/bufferobj.c')
-rwxr-xr-x | mesalib/src/mesa/main/bufferobj.c | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 011e7be3f..303b268a8 100755 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -117,6 +117,11 @@ get_buffer_target(struct gl_context *ctx, GLenum target) return &ctx->AtomicBuffer; } break; + case GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD: + if (ctx->Extensions.AMD_pinned_memory) { + return &ctx->ExternalVirtualMemoryBuffer; + } + break; default: return NULL; } @@ -1226,7 +1231,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) } } - if (ctx->UniformBuffer == bufObj) { + if (ctx->AtomicBuffer == bufObj) { _mesa_BindBuffer( GL_ATOMIC_COUNTER_BUFFER, 0 ); } @@ -1242,6 +1247,10 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) _mesa_BindBuffer( GL_TEXTURE_BUFFER, 0 ); } + if (ctx->ExternalVirtualMemoryBuffer == bufObj) { + _mesa_BindBuffer(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, 0); + } + /* The ID is immediately freed for re-use */ _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]); /* Make sure we do not run into the classic ABA problem on bind. @@ -1381,7 +1390,16 @@ _mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data, ASSERT(ctx->Driver.BufferData); if (!ctx->Driver.BufferData(ctx, target, size, data, GL_DYNAMIC_DRAW, flags, bufObj)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferStorage()"); + if (target == GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD) { + /* Even though the interaction between AMD_pinned_memory and + * glBufferStorage is not described in the spec, Graham Sellers + * said that it should behave the same as glBufferData. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferStorage()"); + } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferStorage()"); + } } } @@ -1465,7 +1483,18 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size, GL_MAP_WRITE_BIT | GL_DYNAMIC_STORAGE_BIT, bufObj)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB()"); + if (target == GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD) { + /* From GL_AMD_pinned_memory: + * + * INVALID_OPERATION is generated by BufferData if <target> is + * EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, and the store cannot be + * mapped to the GPU address space. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferData()"); + } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferData()"); + } } } @@ -2887,7 +2916,7 @@ static void unbind_uniform_buffers(struct gl_context *ctx, GLuint first, GLsizei count) { struct gl_buffer_object *bufObj = ctx->Shared->NullBufferObj; - GLuint i; + GLint i; for (i = 0; i < count; i++) set_ubo_binding(ctx, &ctx->UniformBufferBindings[first + i], @@ -2898,7 +2927,7 @@ static void bind_uniform_buffers_base(struct gl_context *ctx, GLuint first, GLsizei count, const GLuint *buffers) { - GLuint i; + GLint i; if (!error_check_bind_uniform_buffers(ctx, first, count, "glBindBuffersBase")) return; @@ -2965,7 +2994,7 @@ bind_uniform_buffers_range(struct gl_context *ctx, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes) { - GLuint i; + GLint i; if (!error_check_bind_uniform_buffers(ctx, first, count, "glBindBuffersRange")) @@ -3122,7 +3151,7 @@ unbind_xfb_buffers(struct gl_context *ctx, GLuint first, GLsizei count) { struct gl_buffer_object * const bufObj = ctx->Shared->NullBufferObj; - GLuint i; + GLint i; for (i = 0; i < count; i++) _mesa_set_transform_feedback_binding(ctx, tfObj, first + i, @@ -3136,7 +3165,7 @@ bind_xfb_buffers_base(struct gl_context *ctx, { struct gl_transform_feedback_object *tfObj = ctx->TransformFeedback.CurrentObject; - GLuint i; + GLint i; if (!error_check_bind_xfb_buffers(ctx, tfObj, first, count, "glBindBuffersBase")) @@ -3204,7 +3233,7 @@ bind_xfb_buffers_range(struct gl_context *ctx, { struct gl_transform_feedback_object *tfObj = ctx->TransformFeedback.CurrentObject; - GLuint i; + GLint i; if (!error_check_bind_xfb_buffers(ctx, tfObj, first, count, "glBindBuffersRange")) @@ -3342,7 +3371,7 @@ static void unbind_atomic_buffers(struct gl_context *ctx, GLuint first, GLsizei count) { struct gl_buffer_object * const bufObj = ctx->Shared->NullBufferObj; - GLuint i; + GLint i; for (i = 0; i < count; i++) set_atomic_buffer_binding(ctx, &ctx->AtomicBufferBindings[first + i], @@ -3355,7 +3384,7 @@ bind_atomic_buffers_base(struct gl_context *ctx, GLsizei count, const GLuint *buffers) { - GLuint i; + GLint i; if (!error_check_bind_atomic_buffers(ctx, first, count, "glBindBuffersBase")) @@ -3422,7 +3451,7 @@ bind_atomic_buffers_range(struct gl_context *ctx, const GLintptr *offsets, const GLsizeiptr *sizes) { - GLuint i; + GLint i; if (!error_check_bind_atomic_buffers(ctx, first, count, "glBindBuffersRange")) |