1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
'''OpenGL extension EXT.external_buffer
This module customises the behaviour of the
OpenGL.raw.GL.EXT.external_buffer to provide a more
Python-friendly API
Overview (from the spec)
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.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/external_buffer.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.EXT.external_buffer import *
from OpenGL.raw.GL.EXT.external_buffer import _EXTENSION_NAME
def glInitExternalBufferEXT():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME )
### END AUTOGENERATED SECTION
|