Name
EXT_external_buffer
Name Strings
GL_EXT_external_buffer
Contact
Jeff Leger (jleger 'at' qti.qualcomm.com)
Contributors
Sam Holmes
Maurice Ribble
Matt Netsch
Jeremy Gebben
John Bates
Craig Donner
Jeff Leger
Rob VanReenen
Tom Kneeland
Jesse Hall
Jan-Harald Fredriksen
Daniel Koch
Mathias Heyer
Status
Complete
Version
Last Modified Date: May 29, 2017
Revision: 1.0
Number
OpenGL ES Extension #284
OpenGL Extension #508
Dependencies
OpenGL ES 3.1 and EXT_buffer_storage are required for OpenGL ES
implementations.
OpenGL 4.4 is required for OpenGL implementations.
This extension is written against the OpenGL ES 3.1 (June 4, 2014)
Specification.
This extension is written against version 3 of EXT_buffer_storage.
The definition of this extension is affected by the presence of
GL_EXT_direct_state_access, GL_ARB_direct_state_access, or OpenGL 4.5.
Overview
Extension EXT_buffer_storage introduced immutable storage buffers to
OpenGL ES. This extension allows the data store for an immutable buffer to
be sourced from an external EGLClientBuffer, allowing sharing of EGL client
buffers across APIs, across processes, and across different processing
cores such as the GPU, CPU, and DSP.
Operations can then be performed on the external buffer using standard
GL buffer object procedures. The data in the allocation is not copied to
the buffer object's data store; the external allocation represents a single
memory allocation that can be shared across multiple GL objects -- this
aspect is similar to EGL external images. On the other hand, the external
buffer does not provide lifetime guarantees including orphaning and sibling
behavior as provided by EGL external images.
The EGLClientBuffer must be allocated in a way which permits this shared
access. For example, on Android via a shareable Android hardware buffer.
This extension does not enable support for arbitrary EGLClientBuffers to be
used as an external buffer.
It is the application's responsibility to ensure synchronization between
operations performed by separate components (DSP / CPU / GPU) and processes
on the external buffer. Additionally the application is responsible for
avoiding violating existing GL spec requirements. For example, mapping a
single shared allocation to two GL buffer objects and then performing
CopyBufferSubData such that the read and write regions overlap would
violate the existing CopyBufferSubData spec regarding copies performed
with the same buffer set for source and destination.
The application must take any steps necessary to ensure memory access to
the external buffer behaves as required by the application. For example,
preventing compilation differences in data padding from causing data to be
inadvertently corrupted by using defined structure alignment methods such
as the std140 layout qualifier. The application is responsible for
managing the lifetime of the external buffer, ensuring that the external
buffer is not deleted as long as there are any GL buffer objects referring
to it.
New Types
/*
* GLeglClientBufferEXT is an opaque handle to an EGLClientBuffer
*/
typedef void* GLeglClientBufferEXT;
New Procedures and Functions
void BufferStorageExternalEXT(enum target,
intptr offset,
sizeiptr size,
eglClientBufferEXT clientBuffer,
bitfield flags);
[[ The following is only added if GL_EXT_direct_state_access,
GL_ARB_direct_state_access, or OpenGL 4.5 is supported. ]]
void NamedBufferStorageExternalEXT(uint buffer,
intptr offset,
sizeiptr size,
eglClientBufferEXT clientBuffer,
bitfield flags);
New Tokens
None
Additions to Chapter 6 of the OpenGL ES 3.1 Specification (Buffer Objects)
Modify Section 6.2, (Creating and Modifying Buffer Object Data Stores). After
the section describing BufferStorageEXT, insert the following:
The command
void BufferStorageExternalEXT(enum target, intptr offset,
sizeiptr size, eglClientBufferEXT clientBuffer,
bitfield flags);
behaves similar to BufferStorageEXT, but rather than allocate an immutable
data store, the specified client buffer is referenced as the immutable
data store. Such a store may not be modified through further calls to
BufferStorageExternalEXT, BufferStorageEXT, or BufferData.