gfx/angle/extensions/EXT_robustness.txt

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 Name
michael@0 2
michael@0 3 EXT_robustness
michael@0 4
michael@0 5 Name Strings
michael@0 6
michael@0 7 GL_EXT_robustness
michael@0 8
michael@0 9 Contributors
michael@0 10
michael@0 11 Daniel Koch, TransGaming
michael@0 12 Nicolas Capens, TransGaming
michael@0 13 Contributors to ARB_robustness
michael@0 14
michael@0 15 Contact
michael@0 16
michael@0 17 Greg Roth, NVIDIA (groth 'at' nvidia.com)
michael@0 18
michael@0 19 Status
michael@0 20
michael@0 21 Complete.
michael@0 22
michael@0 23 Version
michael@0 24
michael@0 25 Version 3, 2011/10/31
michael@0 26
michael@0 27 Number
michael@0 28
michael@0 29 OpenGL ES Extension #107
michael@0 30
michael@0 31 Dependencies
michael@0 32
michael@0 33 This extension is written against the OpenGL ES 2.0 Specification
michael@0 34 but can apply to OpenGL ES 1.1 and up.
michael@0 35
michael@0 36 EGL_EXT_create_context_robustness is used to determine if a context
michael@0 37 implementing this extension supports robust buffer access, and if it
michael@0 38 supports reset notification.
michael@0 39
michael@0 40 Overview
michael@0 41
michael@0 42 Several recent trends in how OpenGL integrates into modern computer
michael@0 43 systems have created new requirements for robustness and security
michael@0 44 for OpenGL rendering contexts.
michael@0 45
michael@0 46 Additionally GPU architectures now support hardware fault detection;
michael@0 47 for example, video memory supporting ECC (error correcting codes)
michael@0 48 and error detection. OpenGL contexts should be capable of recovering
michael@0 49 from hardware faults such as uncorrectable memory errors. Along with
michael@0 50 recovery from such hardware faults, the recovery mechanism can
michael@0 51 also allow recovery from video memory access exceptions and system
michael@0 52 software failures. System software failures can be due to device
michael@0 53 changes or driver failures.
michael@0 54
michael@0 55 OpenGL queries that that return (write) some number of bytes to a
michael@0 56 buffer indicated by a pointer parameter introduce risk of buffer
michael@0 57 overflows that might be exploitable by malware. To address this,
michael@0 58 queries with return value sizes that are not expressed directly by
michael@0 59 the parameters to the query itself are given additional API
michael@0 60 functions with an additional parameter that specifies the number of
michael@0 61 bytes in the buffer and never writing bytes beyond that limit. This
michael@0 62 is particularly useful for multi-threaded usage of OpenGL contexts
michael@0 63 in a "share group" where one context can change objects in ways that
michael@0 64 can cause buffer overflows for another context's OpenGL queries.
michael@0 65
michael@0 66 The original ARB_vertex_buffer_object extension includes an issue
michael@0 67 that explicitly states program termination is allowed when
michael@0 68 out-of-bounds vertex buffer object fetches occur. Modern graphics
michael@0 69 hardware is capable well-defined behavior in the case of out-of-
michael@0 70 bounds vertex buffer object fetches. Older hardware may require
michael@0 71 extra checks to enforce well-defined (and termination free)
michael@0 72 behavior, but this expense is warranted when processing potentially
michael@0 73 untrusted content.
michael@0 74
michael@0 75 The intent of this extension is to address some specific robustness
michael@0 76 goals:
michael@0 77
michael@0 78 * For all existing OpenGL queries, provide additional "safe" APIs
michael@0 79 that limit data written to user pointers to a buffer size in
michael@0 80 bytes that is an explicit additional parameter of the query.
michael@0 81
michael@0 82 * Provide a mechanism for an OpenGL application to learn about
michael@0 83 graphics resets that affect the context. When a graphics reset
michael@0 84 occurs, the OpenGL context becomes unusable and the application
michael@0 85 must create a new context to continue operation. Detecting a
michael@0 86 graphics reset happens through an inexpensive query.
michael@0 87
michael@0 88 * Provide an enable to guarantee that out-of-bounds buffer object
michael@0 89 accesses by the GPU will have deterministic behavior and preclude
michael@0 90 application instability or termination due to an incorrect buffer
michael@0 91 access. Such accesses include vertex buffer fetches of
michael@0 92 attributes and indices, and indexed reads of uniforms or
michael@0 93 parameters from buffers.
michael@0 94
michael@0 95 New Procedures and Functions
michael@0 96
michael@0 97 enum GetGraphicsResetStatusEXT();
michael@0 98
michael@0 99 void ReadnPixelsEXT(int x, int y, sizei width, sizei height,
michael@0 100 enum format, enum type, sizei bufSize,
michael@0 101 void *data);
michael@0 102
michael@0 103 void GetnUniformfvEXT(uint program, int location, sizei bufSize,
michael@0 104 float *params);
michael@0 105 void GetnUniformivEXT(uint program, int location, sizei bufSize,
michael@0 106 int *params);
michael@0 107
michael@0 108 New Tokens
michael@0 109
michael@0 110 Returned by GetGraphicsResetStatusEXT:
michael@0 111
michael@0 112 NO_ERROR 0x0000
michael@0 113 GUILTY_CONTEXT_RESET_EXT 0x8253
michael@0 114 INNOCENT_CONTEXT_RESET_EXT 0x8254
michael@0 115 UNKNOWN_CONTEXT_RESET_EXT 0x8255
michael@0 116
michael@0 117 Accepted by the <value> parameter of GetBooleanv, GetIntegerv,
michael@0 118 and GetFloatv:
michael@0 119
michael@0 120 CONTEXT_ROBUST_ACCESS_EXT 0x90F3
michael@0 121 RESET_NOTIFICATION_STRATEGY_EXT 0x8256
michael@0 122
michael@0 123 Returned by GetIntegerv and related simple queries when <value> is
michael@0 124 RESET_NOTIFICATION_STRATEGY_EXT :
michael@0 125
michael@0 126 LOSE_CONTEXT_ON_RESET_EXT 0x8252
michael@0 127 NO_RESET_NOTIFICATION_EXT 0x8261
michael@0 128
michael@0 129 Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
michael@0 130
michael@0 131 Add a new subsection after 2.5 "GL Errors" and renumber subsequent
michael@0 132 sections accordingly.
michael@0 133
michael@0 134 2.6 "Graphics Reset Recovery"
michael@0 135
michael@0 136 Certain events can result in a reset of the GL context. Such a reset
michael@0 137 causes all context state to be lost. Recovery from such events
michael@0 138 requires recreation of all objects in the affected context. The
michael@0 139 current status of the graphics reset state is returned by
michael@0 140
michael@0 141 enum GetGraphicsResetStatusEXT();
michael@0 142
michael@0 143 The symbolic constant returned indicates if the GL context has been
michael@0 144 in a reset state at any point since the last call to
michael@0 145 GetGraphicsResetStatusEXT. NO_ERROR indicates that the GL context
michael@0 146 has not been in a reset state since the last call.
michael@0 147 GUILTY_CONTEXT_RESET_EXT indicates that a reset has been detected
michael@0 148 that is attributable to the current GL context.
michael@0 149 INNOCENT_CONTEXT_RESET_EXT indicates a reset has been detected that
michael@0 150 is not attributable to the current GL context.
michael@0 151 UNKNOWN_CONTEXT_RESET_EXT indicates a detected graphics reset whose
michael@0 152 cause is unknown.
michael@0 153
michael@0 154 If a reset status other than NO_ERROR is returned and subsequent
michael@0 155 calls return NO_ERROR, the context reset was encountered and
michael@0 156 completed. If a reset status is repeatedly returned, the context may
michael@0 157 be in the process of resetting.
michael@0 158
michael@0 159 Reset notification behavior is determined at context creation time,
michael@0 160 and may be queried by calling GetIntegerv with the symbolic constant
michael@0 161 RESET_NOTIFICATION_STRATEGY_EXT.
michael@0 162
michael@0 163 If the reset notification behavior is NO_RESET_NOTIFICATION_EXT,
michael@0 164 then the implementation will never deliver notification of reset
michael@0 165 events, and GetGraphicsResetStatusEXT will always return
michael@0 166 NO_ERROR[fn1].
michael@0 167 [fn1: In this case it is recommended that implementations should
michael@0 168 not allow loss of context state no matter what events occur.
michael@0 169 However, this is only a recommendation, and cannot be relied
michael@0 170 upon by applications.]
michael@0 171
michael@0 172 If the behavior is LOSE_CONTEXT_ON_RESET_EXT, a graphics reset will
michael@0 173 result in the loss of all context state, requiring the recreation of
michael@0 174 all associated objects. In this case GetGraphicsResetStatusEXT may
michael@0 175 return any of the values described above.
michael@0 176
michael@0 177 If a graphics reset notification occurs in a context, a notification
michael@0 178 must also occur in all other contexts which share objects with that
michael@0 179 context[fn2].
michael@0 180 [fn2: The values returned by GetGraphicsResetStatusEXT in the
michael@0 181 different contexts may differ.]
michael@0 182
michael@0 183 Add to Section 2.8 "Vertex Arrays" before subsection "Transferring
michael@0 184 Array Elements"
michael@0 185
michael@0 186 Robust buffer access is enabled by creating a context with robust
michael@0 187 access enabled through the window system binding APIs. When enabled,
michael@0 188 indices within the vertex array that lie outside the arrays defined
michael@0 189 for enabled attributes result in undefined values for the
michael@0 190 corresponding attributes, but cannot result in application failure.
michael@0 191 Robust buffer access behavior may be queried by calling GetIntegerv
michael@0 192 with the symbolic constant CONTEXT_ROBUST_ACCESS_EXT.
michael@0 193
michael@0 194 Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
michael@0 195 Operations and the Frame Buffer)
michael@0 196
michael@0 197 Modify section 4.3.1 "Reading Pixels"
michael@0 198
michael@0 199 Pixels are read using
michael@0 200
michael@0 201 void ReadPixels(int x, int y, sizei width, sizei height,
michael@0 202 enum format, enum type, void *data);
michael@0 203 void ReadnPixelsEXT(int x, int y, sizei width, sizei height,
michael@0 204 enum format, enum type, sizei bufSize,
michael@0 205 void *data);
michael@0 206
michael@0 207 Add to the description of ReadPixels:
michael@0 208
michael@0 209 ReadnPixelsEXT behaves identically to ReadPixels except that it does
michael@0 210 not write more than <bufSize> bytes into <data>. If the buffer size
michael@0 211 required to fill all the requested data is greater than <bufSize> an
michael@0 212 INVALID_OPERATION error is generated and <data> is not altered.
michael@0 213
michael@0 214 Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special
michael@0 215 Functions):
michael@0 216
michael@0 217 None
michael@0 218
michael@0 219 Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and
michael@0 220 State Requests)
michael@0 221
michael@0 222 Modify Section 6.1.8 "Shader and Program Queries"
michael@0 223
michael@0 224 The commands
michael@0 225
michael@0 226 void GetUniformfv(uint program, int location, float *params);
michael@0 227 void GetnUniformfvEXT(uint program, int location, sizei bufSize,
michael@0 228 float *params);
michael@0 229 void GetUniformiv(uint program, int location, int *params);
michael@0 230 void GetnUniformivEXT(uint program, int location, sizei bufSize,
michael@0 231 int *params);
michael@0 232
michael@0 233 return the value or values of the uniform at location <location>
michael@0 234 for program object <program> in the array <params>. Calling
michael@0 235 GetnUniformfvEXT or GetnUniformivEXT ensures that no more than
michael@0 236 <bufSize> bytes are written into <params>. If the buffer size
michael@0 237 required to fill all the requested data is greater than <bufSize> an
michael@0 238 INVALID_OPERATION error is generated and <params> is not altered.
michael@0 239 ...
michael@0 240
michael@0 241 Additions to The OpenGL ES Shading Language Specification, Version 1.
michael@0 242
michael@0 243 Append to the third paragraph of section 4.1.9 "Arrays"
michael@0 244
michael@0 245 If robust buffer access is enabled via the OpenGL ES API, such
michael@0 246 indexing must not result in abnormal program termination. The
michael@0 247 results are still undefined, but implementations are encouraged to
michael@0 248 produce zero values for such accesses.
michael@0 249
michael@0 250 Interactions with EGL_EXT_create_context_robustness
michael@0 251
michael@0 252 If the EGL window-system binding API is used to create a context,
michael@0 253 the EGL_EXT_create_context_robustness extension is supported, and
michael@0 254 the attribute EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT is set to
michael@0 255 EGL_TRUE when eglCreateContext is called, the resulting context will
michael@0 256 perform robust buffer access as described above in section 2.8, and
michael@0 257 the CONTEXT_ROBUST_ACCESS_EXT query will return GL_TRUE as described
michael@0 258 above in section 6.1.5.
michael@0 259
michael@0 260 If the EGL window-system binding API is used to create a context and
michael@0 261 the EGL_EXT_create_context_robustness extension is supported, then
michael@0 262 the value of attribute EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT
michael@0 263 determines the reset notification behavior and the value of
michael@0 264 RESET_NOTIFICATION_STRATEGY_EXT, as described in section 2.6.
michael@0 265
michael@0 266 Errors
michael@0 267
michael@0 268 ReadnPixelsEXT, GetnUniformfvEXT, and GetnUniformivEXT share all the
michael@0 269 errors of their unsized buffer query counterparts with the addition
michael@0 270 that INVALID_OPERATION is generated if the buffer size required to
michael@0 271 fill all the requested data is greater than <bufSize>.
michael@0 272
michael@0 273 New Implementation Dependent State
michael@0 274
michael@0 275 Get Value Type Get Command Minimum Value Description Sec. Attribute
michael@0 276 --------- ---- ----------- ------------- --------------------------- ----- ---------
michael@0 277 CONTEXT_ROBUST_ACCESS_EXT B GetIntegerv - Robust access enabled 6.1.5 -
michael@0 278 RESET_NOTIFICATION_STRATEGY_EXT Z_2 GetIntegerv See sec. 2.6 Reset notification behavior 2.6 -
michael@0 279
michael@0 280 Issues
michael@0 281
michael@0 282
michael@0 283 1. What should this extension be called?
michael@0 284
michael@0 285 RESOLVED: EXT_robustness
michael@0 286
michael@0 287 Since this is intended to be a version of ARB_robustness for
michael@0 288 OpenGL ES, it should be named accordingly.
michael@0 289
michael@0 290 2. How does this extension differ from Desktop GL's ARB_robustness?
michael@0 291
michael@0 292 RESOLVED: Because EGL_EXT_create_context_robustness uses a
michael@0 293 separate attribute to enable robust buffer access, a
michael@0 294 corresponding query is added here.
michael@0 295
michael@0 296 3. Should we provide a context creation mechanism to enable this extension?
michael@0 297
michael@0 298 RESOLVED. Yes.
michael@0 299
michael@0 300 Currently, EGL_EXT_create_context_robustness provides this
michael@0 301 mechanism via two unique attributes. These attributes differ
michael@0 302 from those specified by KHR_create_context to allow for
michael@0 303 differences in what functionality those attributes define.
michael@0 304
michael@0 305 4. What can cause a graphics reset?
michael@0 306
michael@0 307 Either user or implementor errors may result in a graphics reset.
michael@0 308 If the application attempts to perform a rendering that takes too long
michael@0 309 whether due to an infinite loop in a shader or even just a rendering
michael@0 310 operation that takes too long on the given hardware. Implementation
michael@0 311 errors may produce badly formed hardware commands. Memory access errors
michael@0 312 may result from user or implementor mistakes. On some systems, power
michael@0 313 management events such as system sleep, screen saver activation, or
michael@0 314 pre-emption may also context resets to occur. Any of these events may
michael@0 315 result in a graphics reset event that will be detectable by the
michael@0 316 mechanism described in this extension.
michael@0 317
michael@0 318 5. How should the application react to a reset context event?
michael@0 319
michael@0 320 RESOLVED: For this extension, the application is expected to query
michael@0 321 the reset status until NO_ERROR is returned. If a reset is encountered,
michael@0 322 at least one *RESET* status will be returned. Once NO_ERROR is again
michael@0 323 encountered, the application can safely destroy the old context and
michael@0 324 create a new one.
michael@0 325
michael@0 326 After a reset event, apps should not use a context for any purpose
michael@0 327 other than determining its reset status, and then destroying it. If a
michael@0 328 context receives a reset event, all other contexts in its share group
michael@0 329 will also receive reset events, and should be destroyed and
michael@0 330 recreated.
michael@0 331
michael@0 332 Apps should be cautious in interpreting the GUILTY and INNOCENT reset
michael@0 333 statuses. These are guidelines to the immediate cause of a reset, but
michael@0 334 not guarantees of the ultimate cause.
michael@0 335
michael@0 336 6. If a graphics reset occurs in a shared context, what happens in
michael@0 337 shared contexts?
michael@0 338
michael@0 339 RESOLVED: A reset in one context will result in a reset in all other
michael@0 340 contexts in its share group.
michael@0 341
michael@0 342 7. How can an application query for robust buffer access support,
michael@0 343 since this is now determined at context creation time?
michael@0 344
michael@0 345 RESOLVED. The application can query the value of ROBUST_ACCESS_EXT
michael@0 346 using GetIntegerv. If true, this functionality is enabled.
michael@0 347
michael@0 348 8. How is the reset notification behavior controlled?
michael@0 349
michael@0 350 RESOLVED: Reset notification behavior is determined at context
michael@0 351 creation time using EGL/GLX/WGL/etc. mechanisms. In order that shared
michael@0 352 objects be handled predictably, a context cannot share with
michael@0 353 another context unless both have the same reset notification
michael@0 354 behavior.
michael@0 355
michael@0 356
michael@0 357 Revision History
michael@0 358
michael@0 359 Rev. Date Author Changes
michael@0 360 ---- ------------ --------- ----------------------------------------
michael@0 361 3 31 Oct 2011 groth Reverted to attribute for robust access. Now it's a
michael@0 362 companion to rather than subset of KHR_create_context
michael@0 363 2 11 Oct 2011 groth Merged ANGLE and NV extensions.
michael@0 364 Convert to using flag to indicate robust access.
michael@0 365 1 15 July 2011 groth Initial version

mercurial