GL_EXT_robustness

Supported Hardware

Series6, Series6XE, Series6XT

Valid APIs

OpenGL ES 1.1, 2.0, 3.x

Description

Several recent trends in how OpenGL integrates into modern computer systems have created new requirements for robustness and security for OpenGL rendering contexts. This extension introduces a number of security features to OpenGL ES which increase the safety of executing a program running untrusted content, such as in WebGL.

This extension adds two new features:

  • User Notifications: it adds user notifications for when hardware resets occur and gives indications over whether a particular context caused it by indicating if it was guilty or not. This is achieved via calls to glGetGraphicsResetStatus, which returns if any hardware resets have occurred since the last call to the function. The reset status will either be GL_NO_ERROR if no reset occurred, GL_GUILTY_CONTEXT_RESET_EXT if the current context caused a reset, GL_INNOCENT_CONTEXT_RESET_EXT if a reset was caused by another context, and GL_UNKNOWN_CONTEXT_RESET_EXT if a reset was caused with no obvious reason. This feature is only active if a context has been created with hardware reset notifications enabled, as described in EGL_EXT_create_context_robustness.
  • Robust API Calls: The other feature it adds is a number of safer entry points for the handful of functions which could potentially cause unintended buffer overruns. The new functions are glReadnPixelsEXT, glGetnUniformfvEXT and glGetnUniformivEXT, superseding glReadPixels, glGetUniformfv and glGetUniformiv respectively. These new functions add a bufSize parameter which allows the user to specify exactly how much storage space has been supplied for the result.

Registry Link

http://www.khronos.org/registry/gles/extensions/EXT/EXT_robustness.txt

Example

// Use the robust read pixels function to return a known amount of data 
#define BUFFER_SIZE 72 
struct 
{ 
	GLubyte red; 
	GLubyte green; 
	GLubyte blue; 
	GLubyte alpha; 
} colourOutputBuffer[BUFFER_SIZE]; 
// Ask for 73 RGBA pixels, but only provide storage for 72 pixels. The last pixel will be discarded rather than overrunning the buffer. 
glReadnPixelsEXT(0, 0, 73, 1, GL_RGBA, GL_UNSIGNED_BYTE, sizeof(colourOutputBuffer), (GLvoid*)colourOutputBuffer);