public class KHRRobustness
extends java.lang.Object
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:
Requires OpenGL 3.2.
| Modifier and Type | Field and Description |
|---|---|
static int |
GL_CONTEXT_LOST
Returned by
GetError. |
static int |
GL_CONTEXT_ROBUST_ACCESS
Accepted by the
value parameter of GetBooleanv, GetIntegerv, and GetFloatv. |
static int |
GL_GUILTY_CONTEXT_RESET
Returned by
GetGraphicsResetStatus. |
static int |
GL_INNOCENT_CONTEXT_RESET
Returned by
GetGraphicsResetStatus. |
static int |
GL_LOSE_CONTEXT_ON_RESET
Returned by GetIntegerv and related simple queries when
value is RESET_NOTIFICATION_STRATEGY. |
static int |
GL_NO_ERROR
Returned by
GetGraphicsResetStatus. |
static int |
GL_NO_RESET_NOTIFICATION
Returned by GetIntegerv and related simple queries when
value is RESET_NOTIFICATION_STRATEGY. |
static int |
GL_RESET_NOTIFICATION_STRATEGY
Accepted by the
value parameter of GetBooleanv, GetIntegerv, and GetFloatv. |
static int |
GL_UNKNOWN_CONTEXT_RESET
Returned by
GetGraphicsResetStatus. |
| Modifier and Type | Method and Description |
|---|---|
static int |
glGetGraphicsResetStatus()
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 indicates that a reset has been detected that is attributable to the current GL context.
INNOCENT_CONTEXT_RESET indicates a reset has been detected that is not attributable to the current GL context.
UNKNOWN_CONTEXT_RESET indicates a detected graphics reset whose cause is unknown.
|
static float |
glGetnUniformf(int program,
int location)
Returns the value or values of a uniform of the default uniform block.
|
static void |
glGetnUniformfv(int program,
int location,
float[] params)
Array version of:
GetnUniformfv |
static void |
glGetnUniformfv(int program,
int location,
java.nio.FloatBuffer params)
Returns the value or values of a uniform of the default uniform block.
|
static int |
glGetnUniformi(int program,
int location)
Integer version of
GetnUniformfv. |
static void |
glGetnUniformiv(int program,
int location,
int[] params)
Array version of:
GetnUniformiv |
static void |
glGetnUniformiv(int program,
int location,
java.nio.IntBuffer params)
Integer version of
GetnUniformfv. |
static int |
glGetnUniformui(int program,
int location)
Unsigned version of
GetnUniformiv. |
static void |
glGetnUniformuiv(int program,
int location,
int[] params)
Array version of:
GetnUniformuiv |
static void |
glGetnUniformuiv(int program,
int location,
java.nio.IntBuffer params)
Unsigned version of
GetnUniformiv. |
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.ByteBuffer pixels)
|
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
float[] pixels)
Array version of:
ReadnPixels |
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.FloatBuffer pixels)
|
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
int[] pixels)
Array version of:
ReadnPixels |
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.IntBuffer pixels)
|
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
int bufSize,
long pixels)
|
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
short[] pixels)
Array version of:
ReadnPixels |
static void |
glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.ShortBuffer pixels)
|
static void |
nglGetnUniformfv(int program,
int location,
int bufSize,
long params)
Unsafe version of:
GetnUniformfv |
static void |
nglGetnUniformiv(int program,
int location,
int bufSize,
long params)
Unsafe version of:
GetnUniformiv |
static void |
nglGetnUniformuiv(int program,
int location,
int bufSize,
long params)
Unsafe version of:
GetnUniformuiv |
static void |
nglReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
int bufSize,
long pixels)
Unsafe version of:
ReadnPixels |
public static final int GL_NO_ERROR
GetGraphicsResetStatus.public static final int GL_GUILTY_CONTEXT_RESET
GetGraphicsResetStatus.public static final int GL_INNOCENT_CONTEXT_RESET
GetGraphicsResetStatus.public static final int GL_UNKNOWN_CONTEXT_RESET
GetGraphicsResetStatus.public static final int GL_CONTEXT_ROBUST_ACCESS
value parameter of GetBooleanv, GetIntegerv, and GetFloatv.public static final int GL_RESET_NOTIFICATION_STRATEGY
value parameter of GetBooleanv, GetIntegerv, and GetFloatv.public static final int GL_LOSE_CONTEXT_ON_RESET
value is RESET_NOTIFICATION_STRATEGY.public static final int GL_NO_RESET_NOTIFICATION
value is RESET_NOTIFICATION_STRATEGY.public static final int GL_CONTEXT_LOST
GetError.public static int glGetGraphicsResetStatus()
NO_ERROR indicates that the GL context has not been in a reset state since the last call.GUILTY_CONTEXT_RESET indicates that a reset has been detected that is attributable to the current GL context.INNOCENT_CONTEXT_RESET indicates a reset has been detected that is not attributable to the current GL context.UNKNOWN_CONTEXT_RESET 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.
If the reset notification behavior is NO_RESET_NOTIFICATION, 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, 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 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 and GetGraphicsResetStatus 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.public static void nglReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
int bufSize,
long pixels)
ReadnPixelsbufSize - the maximum number of bytes to write into datapublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
int bufSize,
long pixels)
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 format. One of:type - the pixel type. One of:bufSize - the maximum number of bytes to write into datapixels - a buffer in which to place the returned pixel datapublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.ByteBuffer pixels)
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 format. One of:type - the pixel type. One of:pixels - a buffer in which to place the returned pixel datapublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.ShortBuffer pixels)
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 format. One of:type - the pixel type. One of:pixels - a buffer in which to place the returned pixel datapublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.IntBuffer pixels)
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 format. One of:type - the pixel type. One of:pixels - a buffer in which to place the returned pixel datapublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
java.nio.FloatBuffer pixels)
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 format. One of:type - the pixel type. One of:pixels - a buffer in which to place the returned pixel datapublic static void nglGetnUniformfv(int program,
int location,
int bufSize,
long params)
GetnUniformfvbufSize - the maximum number of bytes to write to paramspublic static void glGetnUniformfv(int program,
int location,
java.nio.FloatBuffer params)
program - the program objectlocation - the uniform locationparams - the buffer in which to place the returned datapublic static float glGetnUniformf(int program,
int location)
program - the program objectlocation - the uniform locationpublic static void nglGetnUniformiv(int program,
int location,
int bufSize,
long params)
GetnUniformivbufSize - the maximum number of bytes to write to paramspublic static void glGetnUniformiv(int program,
int location,
java.nio.IntBuffer params)
GetnUniformfv.program - the program objectlocation - the uniform locationparams - the buffer in which to place the returned datapublic static int glGetnUniformi(int program,
int location)
GetnUniformfv.program - the program objectlocation - the uniform locationpublic static void nglGetnUniformuiv(int program,
int location,
int bufSize,
long params)
GetnUniformuivbufSize - the maximum number of bytes to write to paramspublic static void glGetnUniformuiv(int program,
int location,
java.nio.IntBuffer params)
GetnUniformiv.program - the program objectlocation - the uniform locationparams - the buffer in which to place the returned datapublic static int glGetnUniformui(int program,
int location)
GetnUniformiv.program - the program objectlocation - the uniform locationpublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
short[] pixels)
ReadnPixelspublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
int[] pixels)
ReadnPixelspublic static void glReadnPixels(int x,
int y,
int width,
int height,
int format,
int type,
float[] pixels)
ReadnPixelspublic static void glGetnUniformfv(int program,
int location,
float[] params)
GetnUniformfvpublic static void glGetnUniformiv(int program,
int location,
int[] params)
GetnUniformivpublic static void glGetnUniformuiv(int program,
int location,
int[] params)
GetnUniformuivCopyright LWJGL. All Rights Reserved. License terms.