1Name 2 3 ANGLE_shader_pixel_local_storage 4 5Name Strings 6 7 GL_ANGLE_shader_pixel_local_storage 8 GL_ANGLE_shader_pixel_local_storage_coherent 9 10Contact 11 12 Chris Dalton (chris 'at' rive.app) 13 14Contributors 15 16 Chris Dalton, Rive 17 Kenneth Russell, Google Inc. 18 Shahbaz Youssefi, Google Inc. 19 Kelsey Gilbert, Mozilla Corp. 20 Geoff Lang, Google Inc. 21 Kimmo Kinnunen, Apple Inc. 22 Contributors to the EXT_shader_pixel_local_storage specification 23 Contributors to the ARB_fragment_shader_interlock specification 24 Contributors to the INTEL_fragment_shader_ordering specification 25 Contributors to the EXT_shader_framebuffer_fetch specification 26 Contributors to the ARB_shader_image_load_store specification 27 Contributors to the QCOM_tiled_rendering specification 28 Contributors to the KHR_blend_equation_advanced specification 29 Contributors to the NV_texture_barrier specification 30 Contributors to the (Vulkan) EXT_fragment_shader_interlock specification 31 Contributors to the (Vulkan) ARM_rasterization_order_attachment_access specification 32 33Status 34 35 Incomplete 36 37Version 38 39 Last Modified Date: Aug 18, 2022 40 Author Revision: 1 41 42Number 43 44 OpenGL ES Extension XX 45 46Dependencies 47 48 OpenGL ES 3.0 and GLSL ES 3.00 are required. 49 50 This extension is written against the OpenGL ES 3.0 specification and the 51 OpenGL ES Shading Language 3.00 specification. 52 53 This extension interacts with ANGLE_robust_client_memory. 54 55 This extension interacts with ANGLE_request_extension. 56 57 This extension interacts with ANGLE_polygon_mode. 58 59 This extension interacts with ANGLE_provoking_vertex. 60 61 This extension interacts with EXT_blend_func_extended. 62 63 This extension interacts with EXT_clip_control. 64 65 This extension interacts with EXT_clip_cull_distance. 66 67 This extension interacts with EXT_depth_clamp. 68 69 This extension interacts with EXT_draw_buffers_indexed. 70 71 This extension interacts with EXT_polygon_offset_clamp. 72 73 This extension interacts with KHR_blend_equation_advanced. 74 75 This extension interacts with KHR_debug. 76 77 This extension interacts with NV_polygon_mode. 78 79 This extension interacts with NV_scissor_exclusive. 80 81 This extension interacts with OES_draw_buffers_indexed. 82 83 This extension interacts with OES_sample_variables. 84 85 This extension interacts with QCOM_tiled_rendering. 86 87 This extension interacts with OpenGL ES 3.1. 88 89 This extension interacts with GLSL ES 3.10. 90 91Overview 92 93 A major feature missing from WebGL is the ability to access rendering 94 results from fragment shaders and perform tasks like programmable blending. 95 This is especially desirable on Tile-Based Deferred Rendering (TBDR) 96 architectures, as it can be implemented entirely on-chip to achieve maximum 97 performance. 98 99 Capabilities in this area vary widely, but it is the case that all major GPU 100 vendors, on all major APIs, have some mechanism, direct or indirect, whereby 101 a fragment shader can access prior rendering results. The intent of this 102 extension is to condense this myriad of hardware and API features into a 103 simple interface with straightforward implementation(s) on every graphics 104 API. 105 106 Similar to EXT_shader_pixel_local_storage, this extension provides a means 107 for fragment shaders to load and store user-defined data associated with the 108 pixel being covered. The data is accessed via GLSL built-in functions 109 pixelLocalLoadANGLE() and pixelLocalStoreANGLE(). Only the current pixel's 110 data can be accessed; data associated with other pixels is not accessible to 111 the fragment shader. Pixel local storage persists across all fragment 112 invocations and across all draws issued between OpenGL ES API calls 113 BeginPixelLocalStorageANGLE() and EndPixelLocalStorageANGLE(), even if the 114 application binds different shader programs. 115 116 Applications define custom, formatted planes of pixel local storage data, up 117 to an implementation-dependent maximum, using the OpenGL ES API functions 118 FramebufferMemorylessPixelLocalStorageANGLE() and 119 FramebufferTexturePixelLocalStorageANGLE(). These methods behave similarly 120 to FramebufferTextureLayer(). Fragment shaders access a specific local 121 storage plane using one of the opaque GLSL types {pixelLocalANGLE, 122 ipixelLocalANGLE, upixelLocalANGLE}, which are analogous to samplers or 123 images. 124 125 This extension provides two different extension string entries: 126 127 - GL_ANGLE_shader_pixel_local_storage: Provides the new pixel local 128 storage functionality, but each pixel may only be touched once in any 129 single rendering pass. The command PixelLocalStorageBarrierANGLE() is 130 provided to indicate a boundary between passes. Rendering the same 131 pixel twice without a barrier can yield incorrect results. However, 132 "incorrect" does _not_ mean they can be random, uninitialized, or 133 leaked from outside the current draw framebuffer; any artifacts are 134 strictly a result of race conditions between overlapping fragment 135 invocations involved in the current rendering pass. 136 137 - GL_ANGLE_shader_pixel_local_storage_coherent: Guarantees that pixel 138 local storage operations touching the same pixel are invoked 139 synchronously and in API primitive order. No barriers are required and 140 render passes can emit overlapping fragments. 141 142 Some implementations may support GL_ANGLE_shader_pixel_local_storage without 143 supporting GL_ANGLE_shader_pixel_local_storage_coherent. 144 145 A note on performance: On some platforms, this feature will be polyfilled 146 with shader images. While every implementation can be expected to run 147 reasonably fast, certain platforms may see some performance degradation at 148 times from using pixel local storage instead of the normal raster pipeline. 149 As always, benchmark and consider other options before using pixel local 150 storage. 151 152IP Status 153 154 No known IP claims. 155 156New Procedures and Functions 157 158 void FramebufferMemorylessPixelLocalStorageANGLE(int plane, 159 enum internalformat) 160 161 void FramebufferTexturePixelLocalStorageANGLE(int plane, 162 uint backingtexture, 163 int level, 164 int layer) 165 166 void FramebufferPixelLocalClearValue{f,i,ui}vANGLE(int plane, 167 const T value[]) 168 169 void BeginPixelLocalStorageANGLE(sizei n, const enum loadops[]) 170 171 void EndPixelLocalStorageANGLE(sizei n, const enum storeops[]) 172 173 void PixelLocalStorageBarrierANGLE() 174 175 void FramebufferPixelLocalStorageInterruptANGLE() 176 177 void FramebufferPixelLocalStorageRestoreANGLE() 178 179 void GetFramebufferPixelLocalStorageParameter{f,i}vANGLE(int plane, 180 enum pname, 181 T *params) 182 183 (the following commands are supported only if ANGLE_robust_client_memory is 184 supported) 185 186 void GetFramebufferPixelLocalStorageParameter{f,i}vRobustANGLE(int plane, 187 enum pname, 188 GLsizei bufSize, 189 GLsizei *length, 190 T *params) 191 192New Tokens 193 194 Accepted by the <pname> parameter of GetIntegerv(): 195 196 MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE 0x96E0 197 MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES_ANGLE 0x96E1 198 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE 0x96E2 199 200 Accepted as array elements in the <loadops> parameter of 201 BeginPixelLocalStorageANGLE(): 202 203 LOAD_OP_ZERO_ANGLE 0x96E3 204 LOAD_OP_CLEAR_ANGLE 0x96E4 205 LOAD_OP_LOAD_ANGLE 0x96E5 206 207 Accepted as array elements in the <storeops> parameter of 208 EndPixelLocalStorageANGLE(): 209 210 STORE_OP_STORE_ANGLE 0x96E6 211 212 Accepted by the <pname> parameter of 213 GetFramebufferPixelLocalStorageParameterivANGLE() and 214 GetFramebufferPixelLocalStorageParameterivRobustANGLE(): 215 216 PIXEL_LOCAL_FORMAT_ANGLE 0x96E7 217 PIXEL_LOCAL_TEXTURE_NAME_ANGLE 0x96E8 218 PIXEL_LOCAL_TEXTURE_LEVEL_ANGLE 0x96E9 219 PIXEL_LOCAL_TEXTURE_LAYER_ANGLE 0x96EA 220 221 Accepted by the <pname> parameter of 222 GetFramebufferPixelLocalStorageParameterfvANGLE() and 223 GetFramebufferPixelLocalStorageParameterfvRobustANGLE(): 224 225 PIXEL_LOCAL_CLEAR_VALUE_FLOAT_ANGLE 0x96EB 226 227 Accepted by the <pname> parameter of 228 GetFramebufferPixelLocalStorageParameterivANGLE() and 229 GetFramebufferPixelLocalStorageParameterivRobustANGLE(): 230 231 PIXEL_LOCAL_CLEAR_VALUE_INT_ANGLE 0x96EC 232 PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_ANGLE 0x96ED 233 234New GLSL Opaque Types 235 236 pixelLocalANGLE 237 ipixelLocalANGLE 238 upixelLocalANGLE 239 240New GLSL Built-in Functions 241 242 gvec4 pixelLocalLoadANGLE(gpixelLocalANGLE) 243 void pixelLocalStoreANGLE(gpixelLocalANGLE, gvec4 value) 244 245Additions to the OpenGL ES Specification, Version 3.0.6 246 247 Modify Chapter 2 "OpenGL ES Operation" 248 249 (Insert a new numbered section before 2.14 "Asynchronous Queries".) 250 251 Section 2.X "Pixel Local Storage" 252 253 Pixel local storage provides a means for fragment shaders to load and store 254 user-defined data associated with the pixel being covered. Pixel local 255 storage is configured on a framebuffer as described in Section 4.4.2.X 256 "Configuring Pixel Local Storage on a Framebuffer". Fragment shaders may 257 access pixel local storage data as described in OpenGL ES Shading Language 258 Specification. 259 260 Pixel local storage is activated and deactivated for the current draw 261 framebuffer using the commands: 262 263 void BeginPixelLocalStorageANGLE(sizei n, const enum loadops[]) 264 265 void EndPixelLocalStorageANGLE(sizei n, const enum storeops[]) 266 267 Parameters: 268 269 * <n> specifies the length of the <loadops> or <storeops> array. 270 271 * <loadops> specifies an array of <n> pixel local storage "Load 272 Operations", whose ith element describes the Load Operation to 273 perform on the ith pixel local storage plane. Supported Load 274 Operations are listed in Table X.1. Load Operations are 275 performed on the entire area of each plane, irrespective of 276 scissor or viewport state. 277 278 Load Operation Description 279 ----------------------------------------------------------------------- 280 LOAD_OP_ZERO_ANGLE Clear all components of the pixel local storage 281 plane to 0. This is recommended over 282 LOAD_OP_CLEAR_ANGLE, as it is more likely to be 283 performant on all implementations. 284 This clear is executed regardless of 285 RASTERIZER_DISCARD state. 286 287 LOAD_OP_CLEAR_ANGLE Clear the pixel local storage plane to its 288 framebuffer's ith clear value of corresponding 289 type. Pixel local clear values are specified 290 with 291 FramebufferPixelLocalClearValue{f,i,ui}vANGLE(), 292 as described in section 4.4.2.Y "Pixel Local 293 Clear State". If the magnitude of any component 294 of the clear value is too large to be 295 represented in the plane's internalformat, it 296 is clamped. 297 This clear is executed regardless of 298 RASTERIZER_DISCARD state. 299 300 LOAD_OP_LOAD_ANGLE Load the contents of the bound texture image 301 into pixel local storage. This Load Operation 302 is only valid for pixel local storage planes 303 that have a texture binding. Texture bindings 304 are established with 305 FramebufferTexturePixelLocalStorageANGLE() as 306 described in section 4.4.2.X "Configuring Pixel 307 Local Storage on a Framebuffer". 308 309 DONT_CARE Leave the initial contents of the pixel local 310 storage plane undefined, favoring speed, and 311 with the caveat that they are _not_ leaked from 312 outside the current draw framebuffer. 313 314 Table X.1: Pixel local storage Load Operations. 315 316 * <storeops> specifies an array of <n> pixel local storage "Store 317 Operations", whose ith element describes the Store Operation 318 to perform on the backing texture of the ith pixel local 319 storage plane. The store operation is ignored if its plane is 320 memoryless. Supported Store Operations are listed in Table 321 X.2. 322 323 Store Operation Description 324 ----------------------------------------------------------------------- 325 STORE_OP_STORE_ANGLE Update the the bound texture image to reflect 326 the pixel local storage contents. 327 328 DONT_CARE Leave the bound texture image contents 329 undefined, with the caveat that they are either 330 unchanged, or not leaked from outside the 331 current draw framebuffer. 332 333 Table X.2: Pixel local storage Store Operations. 334 335 Errors generated by BeginPixelLocalStorageANGLE(): 336 337 * INVALID_FRAMEBUFFER_OPERATION is generated if the default framebuffer 338 object name 0 is bound to DRAW_FRAMEBUFFER. 339 340 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 341 draw framebuffer is in an interrupted state. (See section 2.X.2 342 "Interrupting Pixel Local Storage") 343 344 * INVALID_OPERATION is generated if 345 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is nonzero. 346 347 * INVALID_OPERATION is generated if the value of SAMPLE_BUFFERS is 1 348 (i.e., if rendering to a multisampled framebuffer). 349 350 * INVALID_OPERATION is generated if DITHER is enabled. 351 352 * INVALID_OPERATION is generated if TRANSFORM_FEEDBACK_ACTIVE is TRUE. 353 354 * INVALID_OPERATION is generated if QCOM_tiled_rendering is active. 355 356 * INVALID_OPERATION is generated if BLEND_DST_ALPHA, BLEND_DST_RGB, 357 BLEND_SRC_ALPHA, or BLEND_SRC_RGB, for any draw buffer, is a blend 358 function requiring the secondary color input, as specified in 359 EXT_blend_func_extended (SRC1_COLOR_EXT, ONE_MINUS_SRC1_COLOR_EXT, 360 SRC1_ALPHA_EXT, ONE_MINUS_SRC1_ALPHA_EXT). 361 362 * INVALID_OPERATION is generated if BLEND_EQUATION_RGB and/or 363 BLEND_EQUATION_ALPHA is an advanced blend equation defined in 364 KHR_blend_equation_advanced. 365 366 * INVALID_VALUE is generated if 367 <n> < 1 or <n> > MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE. 368 369 * INVALID_FRAMEBUFFER_OPERATION is generated if the draw framebuffer has 370 an image attached to any color attachment point on or after: 371 372 COLOR_ATTACHMENT0 + 373 MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES_ANGLE - <n> 374 375 * INVALID_VALUE is generated if <loadops> is NULL. 376 377 * INVALID_ENUM is generated if <loadops>[0..<n>-1] is not one of the Load 378 Operations enumerated in Table X.1. 379 380 * INVALID_OPERATION is generated if a pixel local storage plane at index 381 [0..<n>-1] is in a deinitialized state. 382 383 * INVALID_OPERATION is generated if <loadops>[0..<n>-1] is 384 LOAD_OP_LOAD_ANGLE and the pixel local storage plane at that same index 385 is memoryless. 386 387 * INVALID_OPERATION is generated if all enabled, texture-backed pixel 388 local storage planes do not have the same width and height. 389 390 * INVALID_OPERATION is generated if the draw framebuffer has other 391 attachments, and its enabled, texture-backed pixel local storage planes 392 do not have identical dimensions with the rendering area. 393 394 (The rendering area is defined in section 4.4.1 "Binding and Managing 395 Framebuffer Objects" as the intersection of rectangles having a lower 396 left of [0, 0] and an upper right of [width, height] for each 397 attachment.) 398 399 * INVALID_OPERATION is generated if the draw framebuffer has no 400 attachments and no enabled, texture-backed pixel local storage planes. 401 402 * INVALID_OPERATION is generated if a single texture slice is bound to 403 more than one active pixel local storage plane. 404 405 * INVALID_OPERATION is generated if a single texture slice is 406 simultaneously bound to an active pixel local storage plane and attached 407 to an enabled drawbuffer. 408 409 Errors generated by EndPixelLocalStorageANGLE(): 410 411 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 412 draw framebuffer is in an interrupted state. (See section 2.X.2 413 "Interrupting Pixel Local Storage") 414 415 * INVALID_OPERATION is generated if 416 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is zero. 417 418 * INVALID_VALUE is generated if 419 <n> != PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE. 420 421 * INVALID_ENUM is generated if 422 <storeops>[0..PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE-1] is not one of 423 the Store Operations enumerated in Table X.2. 424 425 A successful call to BeginPixelLocalStorageANGLE() has the following side 426 effects: 427 428 * Pixel local storage planes indexed in the range [0..<n>-1] are fully 429 activated, initialized and available for fragment shaders to read and 430 write. 431 432 * PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is updated to equal <n>. 433 434 * OpenGL ES 3.1, implementation-dependent: FRAMEBUFFER_DEFAULT_WIDTH and 435 FRAMEBUFFER_DEFAULT_HEIGHT may reflect the dimensions of the pixel local 436 storage planes, instead of their original values. This will last until 437 pixel local storage ends. 438 439 Pixel local storage data will persist across all fragment invocations and 440 across all draws issued until the application calls 441 EndPixelLocalStorageANGLE(), even if the application binds different shader 442 programs. In order to make this guarantee, additional restrictions go into 443 effect while PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is nonzero: 444 445 * Calls that modify the target framebuffer in any way (including 446 READ_FRAMEBUFFER), or change any framebuffer binding, end pixel local 447 storage implicitly with <storeops> of STORE_OP_STORE_ANGLE. 448 449 e.g., BindFramebuffer, DrawBuffers, FramebufferTexture*, 450 FramebufferRenderbuffer, FramebufferParameteri, 451 FramebufferMemorylessPixelLocalStorageANGLE, etc. 452 453 * Calls that transfer pixels in or out of the framebuffer end pixel local 454 storage implicitly with <storeops> of STORE_OP_STORE_ANGLE. 455 456 e.g., ReadPixels, BlitFramebuffer, CopyTexImage2D, CopyTexSubImage*, 457 etc. 458 459 * BeginTransformFeedback() and StartTilingQCOM() end pixel local storage 460 implicitly with <storeops> of STORE_OP_STORE_ANGLE. 461 462 * INVALID_OPERATION is generated by calls that would modify an active 463 pixel local storage backing texture. 464 465 e.g., TexSubImage*, TexParameter*, GenerateMipmap, 466 InvalidateTextureANGLE, if the texture bound at 'target' is also backing 467 an active pixel local storage plane. 468 469 * INVALID_OPERATION is generated by commands that invalidate or flush 470 tiled memory, including those mentioned in 471 EXT_shader_pixel_local_storage: 472 473 ClientWaitSync, DiscardFramebufferEXT, Finish, Flush, 474 InvalidateFramebuffer, InvalidateSubFramebuffer 475 476 * INVALID_OPERATION is generated by Enable(), Disable() if <cap> is not 477 one of: BLEND, CULL_FACE, DEBUG_OUTPUT, DEBUG_OUTPUT_SYNCHRONOUS, 478 DEPTH_CLAMP_EXT, DEPTH_TEST, POLYGON_OFFSET_POINT_NV, 479 POLYGON_OFFSET_LINE_NV, POLYGON_OFFSET_LINE_ANGLE, POLYGON_OFFSET_FILL, 480 PRIMITIVE_RESTART_FIXED_INDEX, RASTERIZER_DISCARD, SCISSOR_TEST, 481 SCISSOR_TEST_EXCLUSIVE_NV, STENCIL_TEST, CLIP_DISTANCE[0..7]_EXT 482 483 * Calls to ClearBuffer{f,i,ui}v() are ignored if <buffer> is COLOR and: 484 485 <buffer> >= 486 (MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES_ANGLE - 487 ACTIVE_PIXEL_LOCAL_STORAGE_PLANES_ANGLE) 488 489 * INVALID_OPERATION is generated by Enablei*(), Disablei*() if <cap> is 490 not one of: BLEND, SCISSOR_TEST, SCISSOR_TEST_EXCLUSIVE_NV 491 492 * INVALID_OPERATION is generated by BlendFunc*() if <srcRGB>, <dstRGB>, 493 <srcAlpha>, or <dstAlpha> is a blend function requiring the secondary 494 color input, as specified in EXT_blend_func_extended (SRC1_COLOR_EXT, 495 ONE_MINUS_SRC1_COLOR_EXT, SRC1_ALPHA_EXT, ONE_MINUS_SRC1_ALPHA_EXT). 496 497 * INVALID_OPERATION is generated by BlendEquation*() if <mode> is one of 498 the advanced blend equations defined in KHR_blend_equation_advanced. 499 500 * INVALID_OPERATION is generated if a draw is issued with a fragment 501 shader that accesses a texture bound to pixel local storage. 502 503 * INVALID_OPERATION is generated if a draw is issued with a fragment 504 shader that has a pixel local uniform bound to an inactive pixel local 505 storage plane. 506 507 * INVALID_OPERATION is generated if a draw is issued with a fragment 508 shader that does _not_ have a pixel local uniform bound to an _active_ 509 pixel local storage plane (i.e., the fragment shader must declare 510 uniforms bound to every single active pixel local storage plane). 511 512 This is because many backend implementations need to account for every 513 active pixel local storage plane, even if the application code does not 514 access it during a particular shader invocation. 515 516 * INVALID_OPERATION is generated if a draw is issued with a fragment 517 shader that has a pixel local storage uniform whose format layout 518 qualifier does not identically match the internalformat of its 519 associated pixel local storage plane on the current draw framebuffer, as 520 enumerated in Table X.3. 521 522 Because of the "implementation-dependent" clause of the framebuffer 523 completeness test, and because a pixel local storage implementation may add 524 additional attachments to the underlying framebuffer object, it is strongly 525 advised that an application also check to see if the framebuffer is complete 526 after BeginPixelLocalStorageANGLE() and prior to rendering. (See section 527 4.4.4.2 "Whole Framebuffer Completeness".) 528 529 If BeginPixelLocalStorageANGLE() generates an error, 530 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is not modified, and a balancing 531 call to EndPixelLocalStorageANGLE() may therefore also generate an error. 532 533 When PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is zero, any draw issued with a 534 fragment shader that declares pixel local storage uniforms generates an 535 INVALID_FRAMEBUFFER_OPERATION error. 536 537 Section 2.X.1 "Non-coherent Pixel Local Storage" 538 539 When GL_ANGLE_shader_pixel_local_storage_coherent is _not_ supported, and 540 pixel local storage is active, applications must also split their rendering 541 of pixel local storage into separate passes, none of which touch an 542 individual pixel more than once. The command: 543 544 void PixelLocalStorageBarrierANGLE() 545 546 Errors: 547 548 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 549 draw framebuffer is in an interrupted state. (See section 2.X.2 550 "Interrupting Pixel Local Storage") 551 552 * INVALID_OPERATION is generated if 553 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is zero. 554 555 delimits a boundary between distinct, non-self-overlapping rendering passes. 556 Pixel local storage loads issued after the barrier will reflect stores 557 issued prior to the barrier, and stores issued after the barrier will not 558 execute until all accesses initiated prior to the barrier are complete. 559 560 Rendering to the same pixel more than once without a barrier in between can 561 yield incorrect results in pixel local storage, however, "incorrect" does 562 _not_ mean they can be random, uninitialized, or leaked from outside the 563 current draw framebuffer. Any artifacts are strictly a result of race 564 conditions between overlapping fragment invocations involved in the current 565 rendering pass. 566 567 Section 2.X.2 "Interrupting Pixel Local Storage" 568 569 An application may need to interrupt a pixel local storage rendering pass. 570 One example of this may be a browser implementing WebGL. The command: 571 572 void FramebufferPixelLocalStorageInterruptANGLE() 573 574 Errors: 575 576 * INVALID_FRAMEBUFFER_OPERATION is generated if the current interrupt 577 count on the draw framebuffer is equal to 255. 578 579 Increments an interrupt counter on the current draw framebuffer. When the 580 counter increments from 0 to 1, and PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE 581 is nonzero, this command also ends pixel local storage using 582 STORE_OP_STORE_ANGLE for every plane. The contents of any memoryless planes 583 are lost. The counter value cannot be incremented greater than 255. This 584 command is ignored when the default framebuffer object name 0 is bound. When 585 a framebuffer's pixel local storage interupt counter is nonzero, it is 586 considered to be in an "interrupted" state. 587 588 The command: 589 590 void FramebufferPixelLocalStorageRestoreANGLE() 591 592 Errors: 593 594 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 595 draw framebuffer is not in an interrupted state. 596 597 Decrements the pixel local storage interrupt counter on the current draw 598 framebuffer. When the counter decrements from 1 to 0, and 599 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE was nonzero at the time this 600 framebuffer entered an interrupted state, the command also begins pixel 601 local storage using LOAD_OP_LOAD_ANGLE for texture backed planes and 602 DONT_CARE for memoryless planes. The number of planes activated is equal to 603 the value of PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE at the time this 604 framebuffer entered an interrupted state. This command is ignored when the 605 default framebuffer object name 0 is bound. 606 607 Modify Section 4.4.2 "Attaching Images to Framebuffer Objects" 608 609 (Add a new paragraph to 4.4.2.3 "Attaching Renderbuffer Images to a 610 Framebuffer".) 611 612 If a renderbuffer object is deleted while its image is attached to the 613 currently bound draw framebuffer, and pixel local storage is active, then it 614 is as if EndPixelLocalStorageANGLE() had been called with 615 <n>=PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE and <storeops> of 616 STORE_OP_STORE_ANGLE. 617 618 (Add a new paragraph to 4.4.2.4 "Attaching Texture Images to a Framebuffer".) 619 620 If a texture object is deleted while its image is attached to the currently 621 bound draw framebuffer, and pixel local storage is active, then it is as if 622 EndPixelLocalStorageANGLE() had been called with 623 <n>=PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE and <storeops> of 624 STORE_OP_STORE_ANGLE. 625 626 (Insert two new numbered section after 4.4.2.4 "Attaching Texture Images to a 627 Framebuffer".) 628 629 Section 4.4.2.X "Configuring Pixel Local Storage on a Framebuffer" 630 631 The GL provides an array of configurable pixel local storage planes on 632 framebuffer objects. These planes are numbered beginning with zero, with the 633 total number of pixel local storage planes provided given by the 634 implementation-dependent constant MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE. 635 Fragment shaders may access pixel local storage data as described in OpenGL 636 ES Shading Language Specification. Initially, pixel local storage planes are 637 in a deinitialized state and are unusable. 638 639 A memoryless pixel local storage plane may be established on the current 640 draw framebuffer by calling: 641 642 void FramebufferMemorylessPixelLocalStorageANGLE(int plane, 643 enum internalformat) 644 645 Parameters: 646 647 * <plane> identifies the pixel local storage plane index. 648 649 * <internalformat> selects the data format, as enumerated in Table X.3. 650 651 internalformat Clear Value Type Pixel Local Type format qualifier 652 ----------------------------------------------------------------------- 653 RGBA8 FLOAT pixelLocalANGLE rgba8 654 RGBA8I INT ipixelLocalANGLE rgba8i 655 RGBA8UI UNSIGNED_INT upixelLocalANGLE rgba8ui 656 R32F FLOAT pixelLocalANGLE r32f 657 R32UI UNSIGNED_INT upixelLocalANGLE r32ui 658 659 Table X.3: Supported pixel local storage internalformats, with the Clear 660 Value Type used by BeginPixelLocalStorageANGLE(), and their required 661 corresponding GLSL Pixel Local Type and format layout qualifier. 662 663 Note that all pixel local storage formats consume exactly 4 bytes of 664 storage. 665 666 Note that r32i is excluded from this table because it is not supported 667 by EXT_shader_pixel_local_storage. 668 669 Errors: 670 671 * INVALID_FRAMEBUFFER_OPERATION is generated if the default framebuffer 672 object name 0 is bound to DRAW_FRAMEBUFFER. 673 674 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 675 draw framebuffer is in an interrupted state. (See section 2.X.2 676 "Interrupting Pixel Local Storage") 677 678 * INVALID_OPERATION is generated if 679 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is nonzero. 680 681 * INVALID_VALUE is generated if 682 <plane> < 0 or <plane> >= MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE. 683 684 * INVALID_ENUM is generated if <internalformat> is not one of the 685 acceptable values in Table X.3, or NONE. 686 687 If <internalformat> is NONE, the pixel local storage plane at index <plane> 688 is deinitialized and any internal storage is released. 689 690 Otherwise, this call establishes a formatted plane of pixel local storage 691 data at index <plane>, accessible exclusively to fragment shaders, whose 692 liftetime will be scoped between calls to BeginPixelLocalStorageANGLE() and 693 EndPixelLocalStorageANGLE(). The pixel local storage plane is "memoryless" 694 from the application's perspective; its contents are cleared upon calling 695 BeginPixelLocalStorageANGLE(), and its contents are lost after the 696 application calls EndPixelLocalStorageANGLE(). The implementation will make 697 a best effort to store this data exclusively in high performance local 698 caches, e.g., tiled memory, but accessing the data may still result in 699 memory transactions on some platforms. 700 701 Additionally, the GL supports binding a layer of an immutable texture object 702 to pixel local storage. In this scenario, the pixel local storage data is 703 not lost upon calling EndPixelLocalStorageANGLE(), but rather, will be 704 stored in the given texture image. Such behavior is useful for applications 705 such as blending in the fragment shader, where the application renders to 706 pixel local storage instead of a color attachment. 707 708 When a texture image is bound to pixel local storage, the application may 709 also choose to initialize the pixel local storage plane using its bound 710 texture image contents during BeginPixelLocalStorageANGLE(), by passing Load 711 Operation LOAD_OP_LOAD_ANGLE. 712 713 An immutable texture layer image may be bound to a pixel local storage plane 714 on the current draw framebuffer by calling: 715 716 void FramebufferTexturePixelLocalStorageANGLE(int plane, 717 uint backingtexture, 718 int level, 719 int layer) 720 721 Parameters: 722 723 * <plane> identifies the pixel local storage plane index. 724 725 * <backingtexture> specifies the name of an existing immutable texture 726 object to bind. 727 728 * <level> selectes the mipmap level to bind. 729 730 * <layer> specifies the texture layer to bind: 731 732 - Zero if <backingtexture> is a TEXTURE_2D 733 - The array index to bind if <backingtexture> is a TEXTURE_2D_ARRAY 734 735 Errors: 736 737 * INVALID_FRAMEBUFFER_OPERATION is generated if the default framebuffer 738 object name 0 is bound to DRAW_FRAMEBUFFER. 739 740 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 741 draw framebuffer is in an interrupted state. (See section 2.X.2 742 "Interrupting Pixel Local Storage") 743 744 * INVALID_OPERATION is generated if 745 PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is nonzero. 746 747 * INVALID_VALUE is generated if 748 <plane> < 0 or <plane> >= MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE. 749 750 * INVALID_OPERATION is generated if <backingtexture> is not the name of an 751 existing immutable texture object, or zero. 752 753 * INVALID_OPERATION is generated if <backingtexture> is nonzero and not of 754 type TEXTURE_2D or TEXTURE_2D_ARRAY. 755 756 * INVALID_VALUE is generated if <backingtexture> is nonzero and 757 <level> < 0. 758 759 * INVALID_VALUE is generated if <backingtexture> is nonzero and 760 <level> >= the immutable number of mipmap levels in <backingtexture>. 761 762 * INVALID_VALUE is generated if <backingtexture> is nonzero and 763 <layer> < 0. 764 765 * INVALID_VALUE is generated if <backingtexture> is nonzero and 766 <layer> >= the immutable number of texture layers in <backingtexture>. 767 768 * INVALID_ENUM is generated if <backingtexture> is nonzero and its 769 internalformat is not one of the acceptable values in Table X.3. 770 771 If <backingtexture> is 0, <level> and <layer> are ignored and the pixel 772 local storage plane <plane> is deinitialized. 773 774 Otherwise, this call establishes a formatted plane of pixel local storage 775 data at index <plane>, whose contents are bound to the given texture layer 776 image. 777 778 When a texture object is deleted, any pixel local storage plane to which it 779 is bound is automatically deinitialized. 780 781 If a texture object is deleted while its image is bound to a pixel local 782 storage plane on the currently bound draw framebuffer, and pixel local 783 storage is active, then it is as if EndPixelLocalStorageANGLE() had been 784 called with <n>=PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE and <storeops> of 785 STORE_OP_STORE_ANGLE. 786 787 Section 4.4.2.Y "Pixel Local Clear State" 788 789 Each pixel local storage plane on a framebuffer has state for three separate 790 clear values: a 4-component vector of type FLOAT, INT, and UNSIGNED_INT. 791 When the Load Operation LOAD_OP_CLEAR_ANGLE is executed, a pixel local 792 storage plane is cleared to the value whose type corresponds to its 793 internalformat. (See Table X.3.) Clear values are set with the commands: 794 795 void FramebufferPixelLocalClearValuefvANGLE(int plane, 796 const float value[]) 797 798 void FramebufferPixelLocalClearValueivANGLE(int plane, 799 const int value[]) 800 801 void FramebufferPixelLocalClearValueuivANGLE(int plane, 802 const uint value[]) 803 804 Parameters: 805 806 * <plane> identifies the pixel local storage plane index. 807 808 * <value> specifies the new 4-component clear value. 809 810 Description: 811 812 Sets the clear value state of specific type for a plane of pixel local 813 storage on the current draw framebuffer. 814 815 Errors: 816 817 * INVALID_FRAMEBUFFER_OPERATION is generated if the default framebuffer 818 object name 0 is bound to DRAW_FRAMEBUFFER. 819 820 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 821 draw framebuffer is in an interrupted state. (See section 2.X.2 822 "Interrupting Pixel Local Storage") 823 824 * INVALID_VALUE is generated if 825 <plane> < 0 or <plane> >= MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE. 826 827 Modify Section 6.1 "Querying GL State" 828 829 (Insert a new numbered section after 6.1.14 "Renderbuffer Object Queries".) 830 831 Section 6.1.X "Pixel Local Storage Queries" 832 833 The application may query the state of a pixel local storage plane on the 834 current draw famebuffer using the commands: 835 836 void GetFramebufferPixelLocalStorageParameterfvANGLE(int plane, 837 enum pname, 838 GLsizei bufSize, 839 GLsizei *length, 840 GLfloat *params) 841 842 void GetFramebufferPixelLocalStorageParameterivANGLE(int plane, 843 enum pname, 844 GLsizei bufSize, 845 GLsizei *length, 846 GLint *params) 847 848 Parameters: 849 850 * <plane> identifies the pixel local storage plane index. 851 852 * <pname> specifies the parameter of the plane to query. 853 854 * <params> receives the value(s) for parameter <pname> of the pixel local 855 storage plane at index <plane>. When an error is generated, nothing is 856 written to <params>. 857 858 Description: 859 860 * If <pname> is PIXEL_LOCAL_FORMAT_ANGLE, <params> will contain the 861 internalformat of the plane from Table X.3, or NONE if the selected 862 pixel local storage plane is in a deinitialized state. 863 864 * If <pname> is PIXEL_LOCAL_TEXTURE_NAME_ANGLE, <params> will contain the 865 name of the immutable texture object which contains the image bound to 866 the plane, or 0 if the plane is memoryless or deinitialized. 867 868 Note that when the texture object bound to a plane is deleted, the plane 869 is automatically converted to memoryless. See section 4.4.2.X 870 "Configuring Pixel Local Storage on a Framebuffer". 871 872 * If <pname> is PIXEL_LOCAL_TEXTURE_LEVEL_ANGLE, <params> will contain the 873 mipmap level of the bound texture object, or 0 if the plane is 874 memoryless or deinitialized. 875 876 * If <pname> is PIXEL_LOCAL_TEXTURE_LAYER_ANGLE, <params> will contain the 877 layer of the bound texture object, or 0 if the plane is memoryless or 878 deinitialized. 879 880 * If <pname> is PIXEL_LOCAL_CLEAR_VALUE_FLOAT_ANGLE, 881 PIXEL_LOCAL_CLEAR_VALUE_INT_ANGLE, or 882 PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_ANGLE, <params> will contain 4 883 values: the 4 color components of the clear value of corresponding type. 884 885 Errors: 886 887 * INVALID_FRAMEBUFFER_OPERATION is generated if the default framebuffer 888 object name 0 is bound to DRAW_FRAMEBUFFER. 889 890 * INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the 891 draw framebuffer is in an interrupted state. (See section 2.X.2 892 "Interrupting Pixel Local Storage") 893 894 * INVALID_VALUE is generated if 895 <plane> < 0 or <plane> >= MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE. 896 897 * INVALID_ENUM is generated if <pname> is not in Table 6.Y, or if the 898 command issued is not the associated "Get Command" for <pname> in Table 899 6.Y. 900 901 * INVALID_VALUE is generated if <params> is NULL. 902 903 If ANGLE_robust_client_memory is supported, the alternative query commands 904 may also be used: 905 906 void GetFramebufferPixelLocalStorageParameterfvRobustANGLE(int plane, 907 enum pname, 908 GLsizei bufSize, 909 GLsizei *length, 910 GLfloat *params) 911 912 void GetFramebufferPixelLocalStorageParameterivRobustANGLE(int plane, 913 enum pname, 914 GLsizei bufSize, 915 GLsizei *length, 916 GLint *params) 917 918 Additional Parameters: 919 920 * <bufSize> indicates the maximum number of values that can be written to 921 <params>. 922 923 * <length> may be NULL. If not NULL, it receives the number of values 924 written to <params>. When an error is generated, nothing is written to 925 <length>. 926 927 Additional Errors: 928 929 * INVALID_OPERATION is generated if <bufSize> is not large enough to 930 receive the requested parameter. 931 932 933 Modify Section 6.1 "State Tables" 934 935 (Insert two new numbered tables.) 936 937 Minimum 938 Get Value Type Get Command Value Sec. 939 ------------------------------------------------------------------------ 940 MAX_PIXEL_LOCAL_STORAGE- 941 _PLANES_ANGLE Z+ GetIntegerv 4 4.4.2.X 942 943 MAX_COMBINED_DRAW_BUFFERS_AND- 944 _PIXEL_LOCAL_STORAGE_PLANES_ANGLE Z+ GetIntegerv 4 2.X 945 946 Table 6.X: Impementation Dependent Pixel Local Storage Limits 947 948 Initial 949 Get Value Type Get Command Value Sec. 950 -------------------------------------------------------------------------- 951 PIXEL_LOCAL_STORAGE- 952 _ACTIVE_PLANES_ANGLE Z+ GetIntegerv 0 2.X 953 954 PIXEL_LOCAL_FORMAT- GetFramebufferPixelLocal- 955 _ANGLE Z+ StorageParameterivANGLE NONE 6.1.X 956 957 PIXEL_LOCAL_TEXTURE- GetFramebufferPixelLocal- 958 _NAME_ANGLE Z+ StorageParameterivANGLE 0 6.1.X 959 960 PIXEL_LOCAL_TEXTURE- GetFramebufferPixelLocal- 961 _LEVEL_ANGLE Z+ StorageParameterivANGLE 0 6.1.X 962 963 PIXEL_LOCAL_TEXTURE- GetFramebufferPixelLocal- 964 _LAYER_ANGLE Z StorageParameterivANGLE 0 6.1.X 965 966 PIXEL_LOCAL_CLEAR- GetFramebufferPixelLocal- 967 _VALUE_FLOAT_ANGLE 4*R StorageParameterfvANGLE 0,0,0,0 6.1.X 968 969 PIXEL_LOCAL_CLEAR- GetFramebufferPixelLocal- 970 _VALUE_INT_ANGLE 4*Z StorageParameterivANGLE 0,0,0,0 6.1.X 971 972 PIXEL_LOCAL_CLEAR_VALUE- GetFramebufferPixelLocal- 973 _UNSIGNED_INT_ANGLE 4*Z+ StorageParameterivANGLE 0,0,0,0 6.1.X 974 975 Table 6.Y: Pixel Local Storage State 976 977 978Interactions with the ANGLE_request_extension specification 979 980 When either ANGLE_shader_pixel_local_storage or 981 ANGLE_shader_pixel_local_storage_coherent is enabled, the following 982 extensions are all implicitly enabled, if supported: 983 984 * OES_draw_buffers_indexed 985 * EXT_draw_buffers_indexed 986 * EXT_color_buffer_float 987 * EXT_color_buffer_half_float 988 * ANGLE_shader_pixel_local_storage_coherent 989 * ANGLE_shader_pixel_local_storage 990 991Interactions with ANGLE_provoking_vertex, ANGLE_polygon_mode, 992EXT_blend_func_extended, EXT_clip_control, EXT_clip_cull_distance, 993EXT_depth_clamp, EXT_draw_buffers_indexed, EXT_polygon_offset_clamp, 994KHR_blend_equation_advanced, KHR_debug, NV_polygon_mode, 995NV_scissor_exclusive, OES_draw_buffers_indexed 996 997 If any of these extensions is not supported, ignore the applicable 998 references to the extension itself, and to BlendEquationSeparatei*, 999 BlendEquationi*, BlendFuncSeparatei*, BlendFunci*, ColorMaski*, 1000 DebugMessageCallback*, DebugMessageControl*, DebugMessageInsert*, Disablei*, 1001 ClipControlEXT, Enablei*, ObjectLabel*, PolygonMode*, PolygonOffsetClampEXT, 1002 ProvokingVertexANGLE, ObjectPtrLabel*, PopDebugGroup*, PushDebugGroup*, 1003 DEBUG_OUTPUT, DEBUG_OUTPUT_SYNCHRONOUS, SCISSOR_TEST_EXCLUSIVE_NV, 1004 CLIP_DISTANCE[0..7]_EXT, POLYGON_OFFSET_POINT_NV, POLYGON_OFFSET_LINE_NV, 1005 POLYGON_OFFSET_LINE_ANGLE symbols. 1006 1007Interactions with OpenGL ES 3.1 1008 1009 Modify Section 8.22 "Texture Image Loads and Stores" 1010 1011 (Modify the final paragraph.) 1012 1013 Add active pixel local storage planes to the list of resource types that count 1014 against MAX_COMBINED_SHADER_OUTPUT_RESOURCES. 1015 1016 1017Additions to the OpenGL ES Shading Language Specification, Version 3.00 1018 1019 Including the following line in a fragment shader controls the language 1020 features described in this extension: 1021 1022 #extension GL_ANGLE_shader_pixel_local_storage : <behavior> 1023 1024 Where <behavior> is as specified in section 3.5. 1025 1026 Whether or not the application relies on the "_coherent" extension string 1027 from the OpenGL ES API side, the language features described in this section 1028 are identical, and fragment shaders should only enable 1029 GL_ANGLE_shader_pixel_local_storage. 1030 1031 Modify Section 4.1 "Basic Types" 1032 1033 (Add the following new types.) 1034 1035 Pixel Local Types (opaque) 1036 1037 * pixelLocalANGLE 1038 a handle for accessing floating-point pixel local storage data 1039 1040 * ipixelLocalANGLE 1041 a handle for accessing integer pixel local storage data 1042 1043 * upixelLocalANGLE 1044 a handle for accessing unsigned integer pixel local storage data 1045 1046 Modify Section 4.1.7 "Opaque Types" 1047 1048 (Insert a new numbered section after 4.1.7.1 "Samplers".) 1049 1050 Section 4.1.7.X "Pixel Local Storage" 1051 1052 Pixel local types (e.g. pixelLocalANGLE) are opaque types. They are handles 1053 for accessing user-defined data that is associated with the pixel being 1054 covered. They are used with the built-in functions described in section 8.X 1055 "Pixel Local Storage Functions". 1056 1057 In addition to the limitations already imposed on opaque types, pixel local 1058 types are subject to additional constraints: 1059 1060 * They cannot be aggregated in arrays. 1061 1062 * As uniforms, they must be declared at global scope; they cannot be 1063 declared in structs or interface blocks. 1064 1065 * As uniforms, they are not visible to the OpenGL ES API and cannot be 1066 accessed via GetUniformLocation() or GetActiveUniform(). (This 1067 facilitates backends that are implemented entirely in-shader, e.g., 1068 EXT_shader_pixel_local_storage.) 1069 1070 * As uniforms, they must declare "binding" and "format" layout qualifiers, 1071 as described in section 4.3.8.X "Pixel Local Storage Layout Qualifiers". 1072 1073 * As function arguments, they cannot have layout qualifiers. Any function 1074 that accepts pixel local type(s) as arguments is inlined by the compiler, 1075 and the bindings and formats are determined at the call site. 1076 1077 * They cannot be aliased; it is a compile-time error to declare two pixel 1078 local uniforms with duplicate binding layout qualifiers. 1079 1080 * They can only be declared in a fragment shader. 1081 1082 Fragment shaders that declare pixel local storage uniforms are subject to 1083 additional shader-wide restrictions as well: 1084 1085 * discard is illegal 1086 1087 When polyfilled with shader images, pixel local storage requires 1088 early_fragment_tests, which causes discard to interact differently 1089 with the depth and stencil tests. 1090 1091 In order to ensure identical behavior across all backends (some of 1092 which may not have access to early_fragment_tests), we disallow 1093 discard if pixel local storage uniforms have been declared. 1094 1095 * return from main() is illegal 1096 1097 ARB_fragment_shader_interlock functions cannot be called within flow 1098 control, which includes any code that might execute after a return 1099 statement. To keep things simple, and since these "interlock" calls 1100 are automatically generated by the compiler inside of main(), we 1101 disallow return from main() if pixel local storage uniforms have been 1102 declared. 1103 1104 * assignment to gl_FragDepth(EXT) or gl_SampleMask is illegal 1105 1106 When polyfilled with shader images, pixel local storage requires 1107 early_fragment_tests, which causes assignments to gl_FragDepth(EXT) 1108 and gl_SampleMask to be ignored. 1109 1110 In order to ensure identical behavior across all backends, we disallow 1111 assignment to these values if pixel local storage uniforms have been 1112 declared. 1113 1114 * EXT_blend_func_extended: nonzero values of the <index> layout qualifier 1115 are illegal 1116 1117 Nonzero <index> values may restrict the number of draw buffers, which 1118 can invalidate a PLS implementation. 1119 1120 * EXT_blend_func_extended: multiple unassigned fragment output locations 1121 are illegal 1122 1123 Since PLS may use additional internal fragment outputs, we ban all 1124 implicit fragment output assignments while PLS is in use. 1125 1126 * KHR_blend_equation_advanced: "blend_support" layout qualifiers are 1127 illegal 1128 1129 KHR_blend_equation_advanced is incompatible with multiple draw 1130 buffers, which is a required feature for many PLS implementations. 1131 1132 Modify Section 4.3.8 "Layout Qualifiers" 1133 1134 (Insert a new numbered section after 4.3.8.3 "Uniform Block Layout 1135 Qualifiers") 1136 1137 Section 4.3.8.X "Pixel Local Storage Layout Qualifiers" 1138 1139 The layout qualifier identifiers for pixel local storage types are: 1140 1141 layout-qualifier-id 1142 binding = <integer-constant> 1143 <format> 1144 1145 Acceptable identifiers for <format> are enumerated in Table X.3. 1146 1147 It is a compile-time error to declare a pixel local storage uniform that 1148 does not specify both of these layout qualifiers, or to specify a format 1149 layout qualifier on any type other than that format's corresponding "Pixel 1150 Local Type", as enumerated in Table X.3. 1151 1152 Modify Section 8 "Built-in Functions" 1153 1154 (Insert a new numbered section after 8.9 "Fragment Processing Functions".) 1155 1156 Section 8.X "Pixel Local Storage Functions" 1157 1158 The built-in functions defined in this section accept pixel local storage 1159 handles (abbreviated as "PLS handles") in order to load and store data 1160 associated with the pixel being covered. 1161 1162 A reference to a specific PLS plane is established by indexing into the 1163 current draw framebuffer's PLS planes using the PLS handle's "binding" 1164 layout qualifier. If any PLS handle references an inactive PLS plane, or a 1165 PLS plane whose internalformat does not match the handle's format, the 1166 shader does not execute and a draw-time error is generated in the OpenGL ES 1167 API instead. 1168 1169 Syntax: 1170 1171 vec4 pixelLocalLoadANGLE(pixelLocalANGLE handle) 1172 ivec4 pixelLocalLoadANGLE(ipixelLocalANGLE handle) 1173 uvec4 pixelLocalLoadANGLE(upixelLocalANGLE handle) 1174 1175 Description: 1176 1177 Reads the current pixel's data from the PLS plane referenced by <handle>. 1178 1179 Syntax: 1180 1181 void pixelLocalStoreANGLE(pixelLocalANGLE handle, vec4 value) 1182 void pixelLocalStoreANGLE(ipixelLocalANGLE handle, ivec4 value) 1183 void pixelLocalStoreANGLE(upixelLocalANGLE handle, uvec4 value) 1184 1185 Description: 1186 1187 Replaces the current pixel's data with <value> in the PLS plane referenced 1188 by <handle>. If the magnitude of <value> is too large to be represented in 1189 the PLS format, it is clamped. 1190 1191 Modify Section 9 "Shading Language Grammar" 1192 1193 (Add the following tokens to the lexical analysis.) 1194 1195 PIXELLOCALANGLE IPIXELLOCALANGLE UPIXELLOCALANGLE 1196 1197 1198Interactions with GLSL ES 3.10 1199 1200 If GLSL ES 3.10 is supported, pixel local storage and images cannot be used 1201 in the same shader; it is a compile time error for a shader to declare both 1202 image uniforms and pixel local storage uniforms. 1203 1204 1205Issues 1206 1207 (1) EXT_shader_pixel_local_storage has a clause that PLS contents become 1208 undefined if an application causes color data to be flushed to the 1209 framebuffer. Can we use this extension and still guarantee the security of 1210 WebGL? 1211 1212 RESOLVED: We have confirmation that all mobile vendors guarantee there's 1213 no data leaked from outside the render pass. There can be data leaked from 1214 normal framebuffer attachments to PLS planes, but said attachments 1215 themselves are not shared between WebGL contexts, so should not be a 1216 security concern. 1217 1218 Imagination gave the caveat that we must also initialize PLS data up front 1219 in order to not get left-over data from a previous render pass, but this 1220 is exactly what our API is designed to do via load operations. If 1221 EXT_shader_pixel_local_storage2 is supported, we can clear PLS using 1222 ClearPixelLocalStorageuiEXT(). Otherwise, we can clear or load PLS data 1223 from a texture by issuing a fullscreen draw. 1224 1225 Additionally, if the browser uses virtual contexts and wishes to interrupt 1226 a PLS render pass, it must be sure to internally call 1227 FramebufferPixelLocalStorageInterruptANGLE() before handing off control to 1228 the other virtual context, and FramebufferPixelLocalStorageRestoreANGLE() 1229 again before returning control. 1230 1231 (2) Depending on the implementation, <loadops> of LOAD_OP_ZERO_ANGLE and 1232 LOAD_OP_LOAD_ANGLE can have very different performance characteristics. 1233 Would a <loadop> of DONT_CARE, which makes the PLS contents undefined, be 1234 acceptable in WebGL? 1235 1236 RESOLVED: From a security standpoint, the crucial aspect is that the data 1237 doesn't come from another context, and that needs to be specified. Similar 1238 decisions have been made previously in performance-critical areas of the 1239 spec. 1240 1241 (3) Should we support the ability to enable/disable pixel local storage 1242 planes on an individual basis? (e.g., "LOAD_OP_DISABLE_ANGLE".) 1243 1244 RESOLVED: No. Some implementations need to reserve color attachments for 1245 internal use. Allowing any combination of planes to be enabled or disabled 1246 would make this specification unnecessarily complex. Furthermore, browsers 1247 implementing WebGL will need the ability to interrupt pixel local storage 1248 rendering passes, which would also be more complicated if we were to 1249 support enabling and disabling planes individually. 1250 1251 (4) Should we support binding cube map layers to pixel local storage? 1252 1253 RESOLVED: No. There is currently a 1:1 mapping on every implementation 1254 from pixel local storage shaders to backend shaders, but binding a cube 1255 map layer would require a texelFetch() implementation to behave 1256 differently in the shader. We can always add cube map support in the 1257 future, if the need arises. 1258 1259 (5) Can we support transform feedback? 1260 1261 RESOLVED: No. Transform feedback can lead to render pass breaks in the 1262 Vulkan backend. 1263