Class KHRRobustness
Several recent trends in how OpenGL ES integrates into modern computer systems have created new requirements for robustness and security for GL rendering contexts.
Additionally GPU architectures now support hardware fault detection; for example, video memory supporting ECC (error correcting codes) and error detection. GL contexts should be capable of recovering from hardware faults such as uncorrectable memory errors. Along with recovery from such hardware faults, the recovery mechanism can also allow recovery from video memory access exceptions and system software failures. System software failures can be due to device changes or driver failures.
GL queries that return (write) some number of bytes to a buffer indicated by a pointer parameter introduce risk of buffer overflows that might be exploitable by malware. To address this, queries with return value sizes that are not expressed directly by the parameters to the query itself are given additional API functions with an additional parameter that specifies the number of bytes in the buffer and never writing bytes beyond that limit. This is particularly useful for multi-threaded usage of GL contexts in a "share group" where one context can change objects in ways that can cause buffer overflows for another context's GL queries.
The original ARB_vertex_buffer_object extension includes an issue that explicitly states program termination is allowed when out-of-bounds vertex buffer object fetches occur. Modern graphics hardware is capable of well-defined behavior in the case of out-of- bounds vertex buffer object fetches. Older hardware may require extra checks to enforce well-defined (and termination free) behavior, but this expense is warranted when processing potentially untrusted content.
The intent of this extension is to address some specific robustness goals:
- For all existing GL queries, provide additional "safe" APIs that limit data written to user pointers to a buffer size in bytes that is an explicit additional parameter of the query.
- Provide a mechanism for a GL application to learn about graphics resets that affect the context. When a graphics reset occurs, the GL context becomes unusable and the application must create a new context to continue operation. Detecting a graphics reset happens through an inexpensive query.
- Define behavior of OpenGL calls made after a graphics reset.
- Provide an enable to guarantee that out-of-bounds buffer object accesses by the GPU will have deterministic behavior and preclude application instability or termination due to an incorrect buffer access. Such accesses include vertex buffer fetches of attributes and indices, and indexed reads of uniforms or parameters from buffers.
Requires GLES 2.0
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Returned byGetError
.static final int
Accepted by thevalue
parameter of GetBooleanv, GetIntegerv, and GetFloatv.static final int
Returned byGetGraphicsResetStatusKHR
.static final int
Returned byGetGraphicsResetStatusKHR
.static final int
Returned by GetIntegerv and related simple queries whenvalue
isRESET_NOTIFICATION_STRATEGY_KHR
.static final int
Returned by GetIntegerv and related simple queries whenvalue
isRESET_NOTIFICATION_STRATEGY_KHR
.static final int
Accepted by thevalue
parameter of GetBooleanv, GetIntegerv, and GetFloatv.static final int
Returned byGetGraphicsResetStatusKHR
. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
Indicates if the GL context has been in a reset state at any point since the last call to GetGraphicsResetStatus:NO_ERROR
indicates that the GL context has not been in a reset state since the last call.GUILTY_CONTEXT_RESET_KHR
indicates that a reset has been detected that is attributable to the current GL context.INNOCENT_CONTEXT_RESET_KHR
indicates a reset has been detected that is not attributable to the current GL context.UNKNOWN_CONTEXT_RESET_KHR
indicates a detected graphics reset whose cause is unknown.static float
glGetnUniformfKHR
(int program, int location) Returns the value or values of a uniform of the default uniform block.static void
glGetnUniformfvKHR
(int program, int location, float[] params) Array version of:GetnUniformfvKHR
static void
glGetnUniformfvKHR
(int program, int location, FloatBuffer params) Returns the value or values of a uniform of the default uniform block.static float
glGetnUniformiKHR
(int program, int location) Integer version ofGetnUniformfvKHR
.static void
glGetnUniformivKHR
(int program, int location, float[] params) Array version of:GetnUniformivKHR
static void
glGetnUniformivKHR
(int program, int location, FloatBuffer params) Integer version ofGetnUniformfvKHR
.static float
glGetnUniformuiKHR
(int program, int location) Unsigned version ofGetnUniformivKHR
.static void
glGetnUniformuivKHR
(int program, int location, float[] params) Array version of:GetnUniformuivKHR
static void
glGetnUniformuivKHR
(int program, int location, FloatBuffer params) Unsigned version ofGetnUniformivKHR
.static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, float[] pixels) Array version of:ReadnPixelsKHR
static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, int[] pixels) Array version of:ReadnPixelsKHR
static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, int bufSize, long pixels) static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, short[] pixels) Array version of:ReadnPixelsKHR
static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, FloatBuffer pixels) static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, IntBuffer pixels) static void
glReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, ShortBuffer pixels) static void
nglGetnUniformfvKHR
(int program, int location, int bufSize, long params) Unsafe version of:GetnUniformfvKHR
static void
nglGetnUniformivKHR
(int program, int location, int bufSize, long params) Unsafe version of:GetnUniformivKHR
static void
nglGetnUniformuivKHR
(int program, int location, int bufSize, long params) Unsafe version of:GetnUniformuivKHR
static void
nglReadnPixelsKHR
(int x, int y, int width, int height, int format, int type, int bufSize, long pixels) Unsafe version of:ReadnPixelsKHR
-
Field Details
-
GL_GUILTY_CONTEXT_RESET_KHR
public static final int GL_GUILTY_CONTEXT_RESET_KHRReturned byGetGraphicsResetStatusKHR
.- See Also:
-
GL_INNOCENT_CONTEXT_RESET_KHR
public static final int GL_INNOCENT_CONTEXT_RESET_KHRReturned byGetGraphicsResetStatusKHR
.- See Also:
-
GL_UNKNOWN_CONTEXT_RESET_KHR
public static final int GL_UNKNOWN_CONTEXT_RESET_KHRReturned byGetGraphicsResetStatusKHR
.- See Also:
-
GL_CONTEXT_ROBUST_ACCESS_KHR
public static final int GL_CONTEXT_ROBUST_ACCESS_KHRAccepted by thevalue
parameter of GetBooleanv, GetIntegerv, and GetFloatv.- See Also:
-
GL_RESET_NOTIFICATION_STRATEGY_KHR
public static final int GL_RESET_NOTIFICATION_STRATEGY_KHRAccepted by thevalue
parameter of GetBooleanv, GetIntegerv, and GetFloatv.- See Also:
-
GL_LOSE_CONTEXT_ON_RESET_KHR
public static final int GL_LOSE_CONTEXT_ON_RESET_KHRReturned by GetIntegerv and related simple queries whenvalue
isRESET_NOTIFICATION_STRATEGY_KHR
.- See Also:
-
GL_NO_RESET_NOTIFICATION_KHR
public static final int GL_NO_RESET_NOTIFICATION_KHRReturned by GetIntegerv and related simple queries whenvalue
isRESET_NOTIFICATION_STRATEGY_KHR
.- See Also:
-
GL_CONTEXT_LOST_KHR
public static final int GL_CONTEXT_LOST_KHRReturned byGetError
.- See Also:
-
-
Method Details
-
glGetGraphicsResetStatusKHR
public static int glGetGraphicsResetStatusKHR()Indicates if the GL context has been in a reset state at any point since the last call to GetGraphicsResetStatus:NO_ERROR
indicates that the GL context has not been in a reset state since the last call.GUILTY_CONTEXT_RESET_KHR
indicates that a reset has been detected that is attributable to the current GL context.INNOCENT_CONTEXT_RESET_KHR
indicates a reset has been detected that is not attributable to the current GL context.UNKNOWN_CONTEXT_RESET_KHR
indicates a detected graphics reset whose cause is unknown.
If a reset status other than NO_ERROR is returned and subsequent calls return NO_ERROR, the context reset was encountered and completed. If a reset status is repeatedly returned, the context may be in the process of resetting.
Reset notification behavior is determined at context creation time, and may be queried by calling GetIntegerv with the symbolic constant
RESET_NOTIFICATION_STRATEGY_KHR
.If the reset notification behavior is
NO_RESET_NOTIFICATION_KHR
, then the implementation will never deliver notification of reset events, and GetGraphicsResetStatus will always return NO_ERROR.If the behavior is
LOSE_CONTEXT_ON_RESET_KHR
, a graphics reset will result in a lost context and require creating a new context as described above. In this case GetGraphicsResetStatus will return an appropriate value from those described above.If a graphics reset notification occurs in a context, a notification must also occur in all other contexts which share objects with that context.
After a graphics reset has occurred on a context, subsequent GL commands on that context (or any context which shares with that context) will generate a
CONTEXT_LOST_KHR
error. Such commands will not have side effects (in particular, they will not modify memory passed by pointer for query results, and may not block indefinitely or cause termination of the application. Exceptions to this behavior include:GetError
andGetGraphicsResetStatusKHR
behave normally following a graphics reset, so that the application can determine a reset has occurred, and when it is safe to destroy and recreate the context.- Any commands which might cause a polling application to block indefinitely will generate a
CONTEXT_LOST_KHR
error, but will also return a value indicating completion to the application.
-
nglReadnPixelsKHR
public static void nglReadnPixelsKHR(int x, int y, int width, int height, int format, int type, int bufSize, long pixels) Unsafe version of:ReadnPixelsKHR
- Parameters:
bufSize
- the maximum number of bytes to write intodata
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, int bufSize, long pixels) - Parameters:
x
- the left pixel coordinatey
- the lower pixel coordinatewidth
- the number of pixels to read in the x-dimensionheight
- the number of pixels to read in the y-dimensionformat
- the pixel formattype
- the pixel typebufSize
- the maximum number of bytes to write intodata
pixels
- a buffer in which to place the returned pixel data
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) - Parameters:
x
- the left pixel coordinatey
- the lower pixel coordinatewidth
- the number of pixels to read in the x-dimensionheight
- the number of pixels to read in the y-dimensionformat
- the pixel formattype
- the pixel typepixels
- a buffer in which to place the returned pixel data
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, ShortBuffer pixels) - Parameters:
x
- the left pixel coordinatey
- the lower pixel coordinatewidth
- the number of pixels to read in the x-dimensionheight
- the number of pixels to read in the y-dimensionformat
- the pixel formattype
- the pixel typepixels
- a buffer in which to place the returned pixel data
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, IntBuffer pixels) - Parameters:
x
- the left pixel coordinatey
- the lower pixel coordinatewidth
- the number of pixels to read in the x-dimensionheight
- the number of pixels to read in the y-dimensionformat
- the pixel formattype
- the pixel typepixels
- a buffer in which to place the returned pixel data
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, FloatBuffer pixels) - Parameters:
x
- the left pixel coordinatey
- the lower pixel coordinatewidth
- the number of pixels to read in the x-dimensionheight
- the number of pixels to read in the y-dimensionformat
- the pixel formattype
- the pixel typepixels
- a buffer in which to place the returned pixel data
-
nglGetnUniformfvKHR
public static void nglGetnUniformfvKHR(int program, int location, int bufSize, long params) Unsafe version of:GetnUniformfvKHR
- Parameters:
bufSize
- the maximum number of bytes to write toparams
-
glGetnUniformfvKHR
Returns the value or values of a uniform of the default uniform block.- Parameters:
program
- the program objectlocation
- the uniform locationparams
- the buffer in which to place the returned data
-
glGetnUniformfKHR
public static float glGetnUniformfKHR(int program, int location) Returns the value or values of a uniform of the default uniform block.- Parameters:
program
- the program objectlocation
- the uniform location
-
nglGetnUniformivKHR
public static void nglGetnUniformivKHR(int program, int location, int bufSize, long params) Unsafe version of:GetnUniformivKHR
- Parameters:
bufSize
- the maximum number of bytes to write toparams
-
glGetnUniformivKHR
Integer version ofGetnUniformfvKHR
.- Parameters:
program
- the program objectlocation
- the uniform locationparams
- the buffer in which to place the returned data
-
glGetnUniformiKHR
public static float glGetnUniformiKHR(int program, int location) Integer version ofGetnUniformfvKHR
.- Parameters:
program
- the program objectlocation
- the uniform location
-
nglGetnUniformuivKHR
public static void nglGetnUniformuivKHR(int program, int location, int bufSize, long params) Unsafe version of:GetnUniformuivKHR
- Parameters:
bufSize
- the maximum number of bytes to write toparams
-
glGetnUniformuivKHR
Unsigned version ofGetnUniformivKHR
.- Parameters:
program
- the program objectlocation
- the uniform locationparams
- the buffer in which to place the returned data
-
glGetnUniformuiKHR
public static float glGetnUniformuiKHR(int program, int location) Unsigned version ofGetnUniformivKHR
.- Parameters:
program
- the program objectlocation
- the uniform location
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, short[] pixels) Array version of:ReadnPixelsKHR
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, int[] pixels) Array version of:ReadnPixelsKHR
-
glReadnPixelsKHR
public static void glReadnPixelsKHR(int x, int y, int width, int height, int format, int type, float[] pixels) Array version of:ReadnPixelsKHR
-
glGetnUniformfvKHR
public static void glGetnUniformfvKHR(int program, int location, float[] params) Array version of:GetnUniformfvKHR
-
glGetnUniformivKHR
public static void glGetnUniformivKHR(int program, int location, float[] params) Array version of:GetnUniformivKHR
-
glGetnUniformuivKHR
public static void glGetnUniformuivKHR(int program, int location, float[] params) Array version of:GetnUniformuivKHR
-