1Name 2 3 EXT_window_rectangles 4 5Name Strings 6 7 GL_EXT_window_rectangles 8 9Contact 10 11 Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 12 13Contributors 14 15 Jeff Bolz, NVIDIA 16 Mark Callow, Khronos 17 Chris Dalton, NVIDIA 18 Arthur Huillet, NVIDIA 19 Ilia Mirkin 20 Kai Ninomiya, Google 21 Marek Olsak, AMD 22 Brian Paul, VMware Inc. 23 Brian Salomon, Google 24 Walt Steiner, NVIDIA 25 26Status 27 28 Complete 29 30 Implemeneted in NVIDIA late-2016 drivers 31 32Version 33 34 Last Modified Date: 2017/11/03 35 Public Revision: 3 36 37Number 38 39 OpenGL Extension #490 40 OpenGL ES Extension #263 41 42Dependencies 43 44 Written based on the wording of the OpenGL 4.5 (Compatibility Profile) 45 specification. 46 47 This extension requires OpenGL 3.0 (for glGet*i_v queries) or 48 EXT_draw_buffers2 (for glGet*IndexedvEXT queries). 49 50 This extension interacts with EXT_direct_state_access. 51 52 Also written based on the wording of the OpenGL ES 3.2 specification. 53 54 This extension requires OpenGL ES 3.0 (for glGet*i_v queries) or ES 55 2.0 with EXT_multiview_draw_buffers (for glGet*i_vEXT queries). 56 57Overview 58 59 This extension provides additional orthogonally aligned "window 60 rectangles" specified in window-space coordinates that restrict 61 rasterization of all primitive types (geometry, images, paths) 62 and framebuffer clears. 63 64 When rendering to the framebuffer of an on-screen window, these 65 window rectangles are ignored so these window rectangles apply to 66 rendering to non-zero framebuffer objects only. 67 68 From zero to an implementation-dependent limit (specified by 69 GL_MAX_WINDOW_RECTANGLES_EXT) number of window rectangles can be 70 operational at once. When one or more window rectangles are active, 71 rasterized fragments can either survive if the fragment is within 72 any of the operational window rectangles (GL_INCLUSIVE_EXT mode) or 73 be rejected if the fragment is within any of the operational window 74 rectangles (GL_EXCLUSIVE_EXT mode). 75 76 These window rectangles operate orthogonally to the existing scissor 77 test functionality. 78 79 This extension has specification language for both OpenGL and ES so 80 EXT_window_rectangles can be implemented and advertised for either 81 or both API contexts. 82 83New Procedures and Functions 84 85 void WindowRectanglesEXT(enum mode, sizei count, const int box[]); 86 87New Tokens 88 89 Accepted by the <mode> parameter of WindowRectanglesEXT: 90 91 INCLUSIVE_EXT 0x8F10 92 EXCLUSIVE_EXT 0x8F11 93 94 Accepted by the <pname> parameter of GetIntegeri_v, GetInteger64i_v, 95 GetBooleani_v, GetFloati_v, GetDoublei_v, GetIntegerIndexedvEXT, 96 GetFloatIndexedvEXT, GetDoubleIndexedvEXT, GetBooleanIndexedvEXT, and 97 GetIntegeri_vEXT: 98 99 WINDOW_RECTANGLE_EXT 0x8F12 100 101 Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 102 GetInteger64v, GetFloatv, and GetDoublev: 103 104 WINDOW_RECTANGLE_MODE_EXT 0x8F13 105 MAX_WINDOW_RECTANGLES_EXT 0x8F14 106 NUM_WINDOW_RECTANGLES_EXT 0x8F15 107 108Additions to Chapter 14 of the OpenGL 4.5 (Compatibility Profile) 109Specification (Fixed-Function Primitive Assembly and Rasterization) 110 111 -- Change the second and third paragraph of section 14.9 "Early 112 Per-Fragment Tests" to read: 113 114 "Up to five operations are performed on each fragment, in the 115 following order: 116 117 * the pixel ownership test (see section 17.3.1); 118 * the window rectangles test (see section 17.3.X); 119 * the scissor test (see section 17.3.2); 120 * the stencil test (see section 17.3.5); 121 * the depth buffer test (see section 17.3.6); and 122 * occlusion query sample counting (see section 17.3.7). 123 124 The pixel ownership, window rectangles test, and scissor tests are 125 always performed." 126 127Additions to Chapter 17 of the OpenGL 4.5 (Compatibility Profile) 128Specification (Writing Fragments and Samples to the Framebuffer) 129 130 -- Update figure 7.1 "Per-fragment operations" to insert a box labeled 131 "Window Rectangles Test" with an arrow from the "Pixel Ownership Test" 132 box and an arrow to the "Scissor Test" box. 133 134 -- Insert section 17.3.X "Window Rectangles Test" after section 17.3.1 135 "Pixel Ownership Test" 136 137 "The window rectangles test determines if window-space fragment 138 position (xw,yw) is inclusive or exclusive to a set of window-space 139 rectangles. The window rectangles are set with 140 141 void WindowRectanglesEXT(enum mode, sizei n, const int box[]); 142 143 where /mode/ is either INCLUSIVE_EXT or EXCLUSIVE_EXT (and otherwise 144 generates INVALID_ENUM), /n/ is a count of active window rectangles (and 145 generates INVALID_VALUE when /n/ is less than zero or greater than 146 the implementation-dependent value of MAX_WINDOW_RECTANGLES_EXT), and 147 an array of 4*/n/ elements. 148 149 When the WindowRectanglesEXT command is processed without error, 150 the /i/th window rectangle box is set to the corresponding four 151 parameters (box[4*i],box[4*i+1],box[4*i+2],box[4*i+3) for values 152 of /i/ less then /n/. For values of /i/ greater than /n/, each 153 window rectangle box is set to (0,0,0,0). 154 155 Each four elements (x_i,y_i,w_i,h_i) corresponds to the /i/th window 156 rectangle indicating a box of pixels specified with window-space 157 coordinates. Each window rectangle box /i/ has a lower-left origin at 158 (x_i,y_i) and upper-right corner at (x_i+w_i,y_i+h_i). 159 160 The INVALID_VALUE error is generated if any element w_i or h_i, 161 corresponding to each box's respective width and height, is negative. 162 163 Each rasterized or cleared fragment with a window-space position 164 (xw,yw) is within the /i/th window rectangle box when both of these 165 equations are satisfied for all /i/ less than /n/: 166 167 x_i <= xw < x_i+w_i 168 y_i <= yw < y_i+h_i, 169 170 When the window rectangles mode is INCLUSIVE_EXT mode and the 171 bound framebuffer object is non-zero, a fragment passes the window 172 rectangles test if the fragment's window-space position is within 173 at least one of the current /n/ active window rectangles; otherwise 174 the window rectangles test fails and the fragment is discarded. 175 176 When the window rectangles mode is EXCLUSIVE_EXT mode and the bound 177 framebuffer object is non-zero, a fragment fails the window rectangles 178 test and is discarded if the fragment's window-space position is 179 within at least one of the current /n/ active window rectangles; 180 otherwise the window rectangles test passes and the fragment passes 181 the window rectangles test. 182 183 When the bound framebuffer object is zero, the window rectangles 184 test always passes. 185 186 The state required for the window rectangles test is a bit 187 indicating if the mode is inclusive or exclusive, an array with 188 /max/ elements, each element consisting of 2 integers for (x,y) and 189 2 non-negative integers for width & height where /max/ is the value 190 of the implementation-dependent constant MAX_WINDOW_RECTANGLES_EXT, 191 and a non-negative integer indicating the number of active window 192 rectangles. This initial state is EXCLUSIVE_EXT for the bit, all 193 zero for each integer in the array of window rectangles, and zero 194 for the count." 195 196 -- Update section 17.4.3 "Clearing the Buffers" 197 198 Replace the first sentence of the seventh paragraph with: 199 200 "When Clear is called, the only per-fragment operations that are 201 applied (if enabled) are the pixel ownership test, the window 202 rectangles test (17.3.X), the scissor test, sRGB conversion (see 203 section 17.3.9), and dithering." 204 205 -- Update section 17.4.3.2 "Clearing the Multisample Buffer" 206 207 Replace the final paragraph with: 208 209 "Masking, window rectangle testing, and scissoring affect clearing 210 the multisample buffer in the same way as they affect clearing the 211 corresponding color, depth, and stencil buffers." 212 213 -- Update section 18.1.2 "Conversion to Fragments" 214 215 Change the third sentence of the second paragraph to read: 216 217 "However, the histogram and minmax tables are updated even if the 218 corresponding fragments are later rejected by the pixel ownership 219 (section 17.3.1), window rectangles test (section 17.3.X), or scissor 220 (section 17.3.2) tests." 221 222 -- Update section 18.1.4 "Writing to the Stencil or Depth/Stencil Buffers" 223 224 Change the third sentence to read: 225 226 "Each pair is then treated as a fragment for purposes of the pixel 227 ownership, window rectangle tests, and scissor tests; all other 228 per-fragment operations are bypassed." 229 230 -- Update section 18.3.2 "Blitting Pixel Rectangles" 231 232 Update the second sentence of the fourteenth paragraph to read: 233 234 "The only fragment operations which affect a blit are the pixel 235 ownership test, the window rectangles test, the scissor test, and 236 sRGB conversion (see section 17.3.9)." 237 238Additions to Chapter 7 of the OpenGL ES 3.2 Specification (Programs and 239Shaders) 240 241 -- Change the second bullet in section 7.11.1 "Shader Memory Access 242 Ordering" to read: 243 244 "For each fragment generated by the GL, the number of fragment shader 245 invocations depends on a number of factors. If the fragment fails 246 the pixel ownership test (see section 13.8.1), window rectangles 247 test (see section 13.8.X), scissor test (see section 13.8.2), or is 248 discarded by any of the multisample fragment operations (see section 249 13.8.3), the fragment shader will not be executed." 250 251Additions to Chapter 13 of the OpenGL ES 3.2 252Specification (Fixed-Function Primitive Assembly and Rasterization) 253 254 -- Update figure 13.1 "Rasterization, early per-fragment tests, and 255 fragment shading" to insert a box labeled "Window Rectangles Test" 256 with an arrow from the "Pixel Ownership Test" box and an arrow to the 257 "Scissor Test" box. 258 259 -- Change the beginning of the second of section 13.8 "Early Per-Fragment 260 Tests" to read: 261 262 "Four fragment operations are performed, and a further three are 263 optionally performed on each fragment, in the following order: 264 265 * the pixel ownership test (see section 13.8.1); 266 * the window rectangles test (see section 13.8.X); 267 * the scissor test (see section 13.8.2); 268 * multisample fragment operations (see section 13.8.3); 269 270 If early per-fragment operations ..." 271 272 -- Insert section 13.8.X "Window Rectangles Test" after section 13.8.1 273 "Pixel Ownership Test" 274 275 "The window rectangles test determines if window-space fragment 276 position (xw,yw) is inclusive or exclusive to a set of window-space 277 rectangles. The window rectangles are set with 278 279 void WindowRectanglesEXT(enum mode, sizei n, const int box[]); 280 281 where /mode/ is either INCLUSIVE_EXT or EXCLUSIVE_EXT (and otherwise 282 generates INVALID_ENUM), /n/ is a count of active window rectangles (and 283 generates INVALID_VALUE when /n/ is less than zero or greater than 284 the implementation-dependent value of MAX_WINDOW_RECTANGLES_EXT), and 285 an array of 4*/n/ elements. 286 287 When the WindowRectanglesEXT command is processed without error, 288 the /i/th window rectangle box is set to the corresponding four 289 parameters (box[4*i],box[4*i+1],box[4*i+2],box[4*i+3) for values 290 of /i/ less then /n/. For values of /i/ greater than /n/, each 291 window rectangle box is set to (0,0,0,0). 292 293 Each four elements (x_i,y_i,w_i,h_i) corresponds to the /i/th window 294 rectangle indicating a box of pixels specified with window-space 295 coordinates. Each window rectangle box /i/ has a lower-left origin at 296 (x_i,y_i) and upper-right corner at (x_i+w_i,y_i+h_i). 297 298 The INVALID_VALUE error is generated if any element w_i or h_i, 299 corresponding to each box's respective width and height, is negative. 300 301 Each rasterized or cleared fragment with a window-space position 302 (xw,yw) is within the /i/th window rectangle box when both of these 303 equations are satisfied for all /i/ less than /n/: 304 305 x_i <= xw < x_i+w_i 306 y_i <= yw < y_i+h_i, 307 308 When the window rectangles mode is INCLUSIVE_EXT mode and the 309 bound framebuffer object is non-zero, a fragment passes the window 310 rectangles test if the fragment's window-space position is within 311 at least one of the current /n/ active window rectangles; otherwise 312 the window rectangles test fails and the fragment is discarded. 313 314 When the window rectangles mode is EXCLUSIVE_EXT mode and the bound 315 framebuffer object is non-zero, a fragment fails the window rectangles 316 test and is discarded if the fragment's window-space position is 317 within at least one of the current /n/ active window rectangles; 318 otherwise the window rectangles test passes and the fragment passes 319 the window rectangles test. 320 321 When the bound framebuffer object is zero, the window rectangles 322 test always passes. 323 324 The state required for the window rectangles test is a bit 325 indicating if the mode is inclusive or exclusive, an array with 326 /max/ elements, each element consisting of 2 integers for (x,y) and 327 2 non-negative integers for width & height where /max/ is the value 328 of the implementation-dependent constant MAX_WINDOW_RECTANGLES_EXT, 329 and a non-negative integer indicating the number of active window 330 rectangles. This initial state is EXCLUSIVE_EXT for the bit, all 331 zero for each integer in the array of window rectangles, and zero 332 for the count." 333 334Additions to Chapter 15 of the OpenGL ES 3.2 Specification (Writing 335Fragments and Samples to the Framebuffer) 336 337 -- Update section 15.2.3 "Clearing the Buffers" 338 339 Replace the first sentence of the sixth paragraph with: 340 341 "When Clear is called, the only per-fragment operations that are 342 applied (if enabled) are the pixel ownership test, the window 343 rectangles test (13.8.X), the scissor test, sRGB conversion (see 344 section 15.1.6), and dithering." 345 346 -- Update section 15.2.3.2 "Clearing the Multisample Buffer" 347 348 Replace the final paragraph with: 349 350 "Masking, window rectangle testing, and scissoring affect clearing 351 the multisample buffer in the same way as they affect clearing the 352 corresponding color, depth, and stencil buffers." 353 354Additions to Chapter 16 of the OpenGL ES 3.2 Specification (Reading and 355Copying Pixels) 356 357 -- Update section 16.2.1 "Blitting Pixel Rectangles" 358 359 Update the second sentence of the thirteenth paragraph to read: 360 361 "The only fragment operations which affect a blit are the pixel 362 ownership test, the window rectangles test, the scissor test, and 363 sRGB conversion (see section 15.1.6)." 364 365Interactions with the EXT_draw_buffers2 specification 366 367 If EXT_draw_buffers2 is NOT supported, ignore references to 368 GetIntegerIndexedvEXT and GetBooleanIndexedvEXT. 369 370Interactions with the EXT_direct_state_access specification 371 372 If EXT_direct_state_access is NOT supported, ignore references to 373 GetFloatIndexedvEXT and GetDoubleIndexedvEXT. 374 375Interactions with the EXT_multiview_draw_buffers 376 377 If EXT_multiview_draw_buffers is NOT supported, ignore references to 378 GetIntegeri_vEXT. 379 380Additions to the AGL/GLX/WGL Specifications 381 382 None 383 384GLX Protocol 385 386 A new GL rendering command is added. The following command is sent to the 387 server as part of a glXRender request: 388 389 WindowRectanglesEXT 390 2 12+4*n rendering command length 391 2 XXX rendering command opcode 392 4 ENUM mode 393 4 CARD32 count 394 4*n LISTofINT32 box 395 396Errors 397 398 The error INVALID_ENUM is generated by WindowRectanglesEXT if mode 399 is not INCLUSIVE_EXT or EXCLUSIVE_EXT. 400 401 The error INVALID_VALUE is generated by WindowRectanglesEXT if count 402 is negative. 403 404 The error INVALID_VALUE is generated by WindowRectanglesEXT if 405 count is greater than the value of the implementation-dependent 406 limit MAX_WINDOW_RECTANGLES_EXT. 407 408 The error INVALID_VALUE is generated by WindowRectanglesEXT if any 409 of the w_i or h_i elements of the box array are negative. 410 411 The error INVALID_VALUE is generated by GetIntegeri_v, 412 GetInteger64i_v, GetBooleani_v, GetFloati_v, and GetDoublei_v when 413 pname is WINDOW_RECTANGLE_EXT and index is greater or equal to the 414 implementation-dependent value of MAX_WINDOW_RECTANGLES_EXT. 415 416New State 417 418(table 23.26, p724) add the following entry: 419 420 Get Value Type Get Command Initial Value Description Sec Attribute 421 ------------------------- ------- ------------- ------------- ------------------------ ------ --------- 422 NUM_WINDOW_RECTANGLE_EXT Z+ GetIntegerv 0 Active window rectangles 17.3.X scissor 423 count 424 WINDOW_RECTANGLE_EXT 4*x4xZ+ GetIntegeri_v 4*x(0,0,0,0) Window rectangle box 17.3.X scissor 425 WINDOW_RECTANGLE_MODE_EXT Z2 GetIntegerv EXCLUSIVE_EXT Window rectangle mode 17.3.X scissor 426 427New Implementation Dependent State 428 429(table 23.66, p764) add the following entry: 430 431 Get Value Type Get Command Minimum Value Description Sec Attribute 432 ------------------------- ---- ----------- ------------- ----------------- ------ -------------- 433 MAX_WINDOW_RECTANGLES_EXT Z+ GetIntegerv 4 Maximum num of 17.3.X - 434 window rectangles 435 436Issues 437 438 1) What should this extension be called? 439 440 RESOLVED: EXT_window_rectangles as this extension introduces 441 a new per-fragment test, called the window rectangles test, 442 that operates on (x,y) window-space coordinates of the fragment, 443 testing those coordinates against a set of rectangles. 444 445 We avoid the term "scissor" because that describes preexisting 446 OpenGL functionality orthogonal to this extension's 447 functionality. 448 449 We also avoid the term "clip" because clipping operates on 450 primitives (triangles, lines, points) rather than fragments 451 as the window rectangles test does. 452 453 The "window" in the name does not refer to the often rectangular 454 surface for managing application rendering within a desktop user 455 interface metaphor. "window" refers to window-space following 456 the precedent of the ARB_window_pos extension. 457 458 Each rectangle is specified as a box in (integer) window-space 459 coordinates. Multiple such rectangles are supported hence 460 "rectangles" in the name. 461 462 Intuitively, we can think of the rectangles carving out by 463 exclusion (or selecting by inclusion) rectangular boxes in 464 the region of window space either not allowed (or allowed) for 465 rasterization. 466 467 2) Should there be an enable? 468 469 RESOLVED: No, configuring zero exclusive window rectangles is 470 the same as disabling window rectangles. Example: 471 472 // disable window rectangles 473 glWindowRectanglesEXT(GL_EXCLUSIVE, 0, NULL); 474 475 3) Should all the window rectangles be specified in a single call 476 with the mode? 477 478 RESOLVED: Yes. 479 480 The expectation is that the configuration of window rectangles 481 is typically updated once per frame. Hence it makes sense to 482 have a single API call that takes an array of window rectangle 483 boxes rather than requiring one call to specify each window 484 rectangle box. This means all the window rectangles must be 485 specified "as a unit" but this is likely an advantage. 486 487 4) What performance expectations should applications have when 488 window rectangles are configured? 489 490 RESOLVED: Applications should assume window rectangles 491 discard work (rasterized fragments) and there is effectively 492 no cost to enable the window rectangles, even including the 493 implementation-dependent limit number of window rectangles. 494 495 5) How does this extension's window rectangles interact with OpenGL's 496 existing scissor test functionality? 497 498 RESOLVED: The scissor test and window rectangles are orthogonal. 499 500 In window rectangle inclusive mode, a fragment survives the 501 scissor test and window rectangles when the fragment's window space 502 position is within any one of the window rectangles and also 503 inside the scissor box. 504 505 In window rectangle exclusive mode, a fragment survives the 506 scissor test and window rectangles when the fragment's window 507 space position is within the scissor box and NOT within any of 508 the window rectangles. 509 510 6) What should an application do if it needs more than the 511 implementation-dependent maximum number of window rectangles? 512 513 RESOLVED: The application can use stencil testing as a way to 514 simulate more than the implementation-dependent maximum. 515 516 The application may find it is possible to express a more complex 517 clipping region by merging or overlapping window rectangles. 518 519 7) What are some intended applications for this extension? 520 521 RESOLVED: There are several envisioned applications: 522 523 a) For a simple user interface managed in OpenGL, the window 524 rectangles in exclusive mode can be used to avoid rendering 525 into one or more rectangular sub-windows, dialog boxes, 526 or menus "overlapping" some rendering window. 527 528 While stencil testing could be used in this application, 529 that requires rendering the extents of all the windows into 530 the stencil buffer. Managing exclusive window rectangles 531 is simpler for simple configurations and leaves the stencil 532 buffer for other purposes. 533 534 b) Minimizing rasterization to non-animating regions of a 535 framebuffer. Say much of the background of a game is not 536 actually updating; for example, a board game or puzzle game 537 where rendering updates are highly localized. Inclusive 538 rectangles can restrict rendering to just the rectangles 539 of the screen that require updates. 540 541 The scissor could be used for this purpose but would 542 only represent a single rectangle so the application would 543 have to repeat the rendering process multiple times at 544 different scissor locations. 545 546 8) Does the window rectangles test affect rasterization of geometric 547 primitive (polygons, lines, points), image rectangles (glBitmap, 548 glDrawPixels, glCopyPixels), and path rendering? 549 550 RESOLVED: Yes. 551 552 9) Does the window rectangles test affect clears? 553 554 RESOLVED: Yes. 555 556 10) If you specify a subset (or none) of the window rectangles, 557 what happens to the state of the unspecified window rectangles? 558 559 RESOLVED: The state of such boxes is set to (0,0,0,0). 560 561 This only matters to the extent that you can query that state 562 with glGetIntegerv_i, etc. and get reliable values returned. 563 564 11) What if negative values are specified for box coordinates? 565 566 RESOLVED: The values of the window rectangles box elements are 567 typed GLint, however the width and height parameters of each 568 box are required to be non-negative (otherwise GL_INVALID_VALUE 569 results). 570 571 This matches the behavior of existing commands such 572 as glScissorArrayv and glViewportArrayv, part of the 573 ARB_viewport_array extension. 574 575 12) What about really huge values for the box coordinates? 576 577 RESOLVED: That should be fine. In theory, OpenGL has an 578 implementation-dependent limit GL_MAX_VIEWPORT_DIMS so there is 579 a bound on the (xw,yw) of rasterized fragments. 580 581 There is not any implicit or explicit clamping of the box 582 coordinates. 583 584 13) What happens when the window rectangles mode is GL_INCLUSIVE_EXT but 585 zero window rectangles are specified? 586 587 RESOLVED: All rasterization and clearing is discarded. Effectively 588 there's no way for a fragment to be "inside" the window clips 589 if there are none. 590 591 This is just one of many ways to throw away all rasterized 592 fragments in OpenGL. A similiar effect could be accomplished with 593 a zero width or height scissor (or zero width and height inclusive 594 window rectangles for that matter). 595 596 This behavior is why GL_EXCLUSIVE_EXT is the initial context state. 597 598 14) Should this work when rendering to windows? 599 600 RESOLVED: No, the hardware functionality for window rectangles 601 may be used by the window system for pixel-ownership tests. Instead 602 this functionality is limited to FBOs. 603 604 15) Should this work when rendering to non-FBO off-screen rendering 605 resources such pbuffers, GLX bitmaps, and Windows 606 device-independent bitmaps? 607 608 RESOLVED: No. 609 610 For simplicity of specification, the language is written to 611 refer only to non-zero framebuffer objects supporting the window 612 rectangles test so pbuffers, etc. wouldn't support the window 613 rectangles test. 614 615 Off-screen rendering mechanisms such as pbuffers are legacy 616 mechanisms that predated FBOs so it makes sense to not aggrandize 617 them. This eases the implementation and testing burden for 618 supporting the window rectangles test. 619 620 16) Should the viewport index index into an array of window rectangle 621 arrays, similar to viewport and scissor arrays? 622 623 RESOLVED: No. This functionality is disconnected from the 624 viewport index (see ARB_viewport_array) but orthogonal to that 625 functionality. 626 627 The current set of window rectangles applies to rasterization 628 independent of the viewport index. 629 630 17) Does the window rectangles test affect glBlitFramebuffer and 631 similar blit operations? 632 633 RESOLVED: Yes. 634 635 One of the key applications is limiting opaque compositing so 636 clipping blit framebuffer operations is important to support. 637 638 18) Does the window rectangles test affect glAccum operations? 639 640 RESOLVED: No, because framebuffer objects do not support 641 accumulation buffer attachments and the window rectangles test 642 only operates on FBOs (see issue 15). 643 644 If support for accumulation buffer bindings were supported for 645 FBOs (as unlikely though would be), it would make sense for 646 language to be added to support window rectangles on FBOs. 647 That language would read: 648 649 -- Update section 17.4.5 "The Accumulation Buffer" 650 651 Change the second paragraph's first sentence to read: 652 653 "When the scissor test is enabled (section 17.3.2), then only those 654 pixels within the current scissor box are updated by any Accum 655 operation; otherwise, all pixels in the window that survive the 656 window rectangles test (section 17.3.X) are updated." 657 658 Change the second sentence of the fifth paragraph to read: 659 660 "If fragment color clamping is enabled, the results are then clamped 661 to the range [0,1]. The resulting color value is placed in the 662 buffers currently enabled for color writing as if it were a fragment 663 produced from rasterization, except that the only per-fragment 664 operations that are applied (if enabled) are the pixel ownership 665 test, the window rectangles test (section 17.3.X), the scissor test 666 (section 17.3.2), sRGB conversion (see section 17.3.9), and dithering 667 (section 17.3.10)." 668 669 19) Is glInvalidateSubFramebuffer affected by window rectangles test? 670 671 RESOLVED: No. The window rectangles test applies to 672 rasterization, and invalidating a region of the framebuffer is 673 not a rasterization operation. 674 675 20) Should the window rectangles state be subject to 676 glPushAttrib/glPopAttrib? 677 678 RESOLVED: Yes, as part of the GL_SCISSOR_BIT state. 679 680 Being able to push/pop window rectangles is a natural notion for 681 hierachical clipping. The scissor state group is most similar 682 to window rectangles. 683 684 21) Since shader memory accesses are possible from a fragment shader, 685 can side effects from shader execution occur before the window 686 rectangles test discards fragments? 687 688 RESOLVED: No. 689 690 No changes are made to section 7.12.1 "Shader Memory Access 691 Ordering" when the window rectangles test is supported. 692 An implementation could implement the window rectangles test 693 as a fragment shader prologue, but if so, it needs to happen 694 before any fragment shader side-effects that might occur if the 695 fragment was not discarded by the window rectangles test. 696 697 22) Can a software rasterizer efficiently exploit this functionality? 698 699 RESOLVED: Yes. For an existing software rasterizer, the window 700 rectangles test could be implementing naively, just testing every 701 pixel position against all the active inclusive or exclusive 702 window rectanges. 703 704 For a bit more sophisticated software rasterizer, the nice thing 705 is the window rectangles are "known up front" so they can be 706 statically Y-sorted and then X-sorted for primitives bounding 707 boxes to minimize the window rectangle intersection costs. In a 708 smart scan-line rasterizer, once you detect and excluded pixel 709 position, you can skip over pixels to advance past exclusive 710 window rectangles rather than naively testing every fragment. 711 MMX should be useful for it. 712 713 23) Is this functionality useful for rendering virtual reality eye 714 views? 715 716 RESOLVED: Yes. Often when rendering to a view frustum for a 717 virtual reality eye view, the edges of the field of view are 718 not do not contribute to the warped version of the image to be 719 displayed on the Head Mounted Display (HMD). 720 721 By overlapping multiple inclusive window rectangles, the shape 722 of an stair-stepped approximate circle or ellipse can be formed 723 so rasterization to the corners is skipped. 724 725 24) Can the glWindowRectanglesEXT command be compiled into a display 726 list? 727 728 RESOLVED: Yes (as the specification language does not say 729 otherwise) and the command is a rendering state command logically 730 similar to glScissor and glViewport. 731 732 25) How does the window rectangles test operated in layered 733 framebuffer (see section 9.8) rendering? 734 735 RESOLVED: The window rectangles test affects rendering to any 736 and all layers. The test itself just depends on the window 737 coordinates of a pixel, not its layer. 738 739 26) Does the window rectangles state affect glReadPixels or the 740 reading of pixels by glCopyPixels or glBlitFramebuffer? 741 742 RESOLVED: No. The window rectangles test is a fragment operation 743 for pixel updates. Pixel values are read irrespective of the 744 window rectangles test state. This is matches the behavior of 745 the existing scissor test. 746 747 That said, the window rectangles test does affect the 748 blitted/copied pixel written by glBlitFramebuffer and glCopyPixels 749 operations. This could allow an implementation to skip reading 750 pixels that will be discarded by the window rectangles test on 751 the pixel update operations that are discarded by the window 752 rectangles test on a blit or copy operation. 753 754 27) Is this extension functionally and interface identical in its 755 OpenGL and ES versions? 756 757 RESOLVED: Yes, the API and functionality is identical. 758 759 28) What should the minimum implementation-dependent limit for 760 GL_MAX_WINDOW_RECTANGLES_EXT be? 761 762 RESOLVED: 4 (was 8 originally). 763 764 While NVIDIA GPUs can support 8 window rectangles, feedback from 765 AMD is they could support the extension if the limit was 4. 766 767 29) Is there a Vulkan version of this functionality? 768 769 RESOLVED: Yes, VK_EXT_discard_rectangles. See: 770 771 https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VK_EXT_discard_rectangles 772 773Revision History 774 775 Rev. Date Author Changes 776 ---- -------- --------- ------------------------------------------------ 777 1 06/09/16 mjk Public release 778 2 06/27/16 mjk Change limit to 4 based on AMD feedback 779 3 11/03/17 mjk Fix state table for limit of 4, add issue 29 780