return &ctx->AtomicBuffer;
}
break;
+ case GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD:
+ if (ctx->Extensions.AMD_pinned_memory) {
+ return &ctx->ExternalVirtualMemoryBuffer;
+ }
+ break;
default:
return NULL;
}
_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.
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()");
+ }
}
}
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()");
+ }
}
}
{ "GL_AMD_conservative_depth", o(ARB_conservative_depth), GL, 2009 },
{ "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 },
{ "GL_AMD_performance_monitor", o(AMD_performance_monitor), GL, 2007 },
+ { "GL_AMD_pinned_memory", o(AMD_pinned_memory), GL, 2013 },
{ "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture), GL, 2009 },
{ "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 },
{ "GL_AMD_shader_trinary_minmax", o(dummy_true), GL, 2012 },
GLboolean OES_standard_derivatives;
/* vendor extensions */
GLboolean AMD_performance_monitor;
+ GLboolean AMD_pinned_memory;
GLboolean AMD_seamless_cubemap_per_texture;
GLboolean AMD_vertex_shader_layer;
GLboolean AMD_vertex_shader_viewport_index;
*/
struct gl_buffer_object *AtomicBuffer;
+ /**
+ * Object currently associated w/ the GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD
+ * target.
+ */
+ struct gl_buffer_object *ExternalVirtualMemoryBuffer;
+
/**
* Array of atomic counter buffer binding points.
*/