1Name 2 3 ARB_transform_feedback2 4 5Name Strings 6 7 GL_ARB_transform_feedback2 8 9Contributors 10 11 Eric Zolnowski 12 13Contact 14 15 Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com) 16 Eric Zolnowski, AMD (eric.zolnowski 'at' amd.com) 17 18Notice 19 20 Copyright (c) 2010-2013 The Khronos Group Inc. Copyright terms at 21 http://www.khronos.org/registry/speccopyright.html 22 23Specification Update Policy 24 25 Khronos-approved extension specifications are updated in response to 26 issues and bugs prioritized by the Khronos OpenGL Working Group. For 27 extensions which have been promoted to a core Specification, fixes will 28 first appear in the latest version of that core Specification, and will 29 eventually be backported to the extension document. This policy is 30 described in more detail at 31 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 32 33Status 34 35 Complete. Approved by the ARB at the 2010/01/22 F2F meeting. 36 Approved by the Khronos Board of Promoters on March 10, 2010. 37 38Version 39 40 Last Modified Date: 2012/06/28 41 Author Revision: 7 42 43Number 44 45 ARB Extension #93 46 47Dependencies 48 49 The OpenGL Shading Language (GLSL) is required. OpenGL 2.0 or the 50 ARB_shader_objects extension is required. 51 52 NV_transform_feedback or EXT_transform_feedback is required. 53 54 EXT_geometry_shader4 trivially interacts with this extension. 55 56 This extension is written against the OpenGL 2.1 Specification. 57 58 This extension is written against the EXT_transform_feedback extension 59 specification. 60 61Overview 62 63 The EXT_transform_feedback extension allows applications to capture 64 primitives to one or more buffer objects when transformed by the GL. 65 This extension provides a few additional capabilities to these extensions, 66 making transform feedback mode more useful. 67 68 First, it provides transform feedback objects which encapsulate transform 69 feedback-related state, allowing applications to replace the entire 70 transform feedback configuration in a single bind call. Second, it 71 provides the ability to pause and resume transform feedback operations. 72 When transform feedback is paused, applications may render without 73 transform feedback or may use transform feedback with different state and 74 a different transform feedback object. When transform feedback is 75 resumed, additional primitives are captured and appended to previously 76 captured primitives for the object. 77 78 Additionally, this extension provides the ability to draw primitives 79 captured in transform feedback mode without querying the captured 80 primitive count. The command DrawTransformFeedback() is equivalent to 81 glDrawArrays(<mode>, 0, <count>), where <count> is the number of vertices 82 captured to buffer objects during the last transform feedback capture 83 operation on the transform feedback object used. This draw operation only 84 provides a vertex count -- it does not automatically set up vertex array 85 state or vertex buffer object bindings, which must be done separately by 86 the application. 87 88IP Status 89 90 No known IP claims. 91 92New Procedures and Functions 93 94 void BindTransformFeedback(enum target, uint id); 95 void DeleteTransformFeedbacks(sizei n, const uint *ids); 96 void GenTransformFeedbacks(sizei n, uint *ids); 97 boolean IsTransformFeedback(uint id); 98 99 void PauseTransformFeedback(void); 100 void ResumeTransformFeedback(void); 101 102 void DrawTransformFeedback(enum mode, uint id); 103 104New Tokens 105 106 Accepted by the <target> parameter of BindTransformFeedback: 107 108 TRANSFORM_FEEDBACK 0x8E22 109 110 Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, 111 and GetFloatv: 112 113 TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 114 TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 115 TRANSFORM_FEEDBACK_BINDING 0x8E25 116 117Additions to Chapter 2 of the OpenGL 2.1 Specification (OpenGL Operation) 118 119 (Replace the "Section 2.Y" introduced by the EXT_transform_feedback 120 specification.) 121 122 In transform feedback mode, attributes of the vertices of transformed 123 primitives are written out to one or more buffer objects. The vertices are 124 fed back after vertex color clamping but before clipping. If a geometry 125 shader is active, the vertices recorded are those emitted from the geometry 126 shader. The transformed vertices may be optionally discarded after being 127 stored into one or more buffer objects, or they can be passed on down to 128 the clipping stage for further processing. 129 130 131 Section 2.Y.1, Transform Feedback Objects 132 133 The set of buffer objects used to capture vertex attributes and related 134 state are stored in a transform feedback object. If a vertex or geometry 135 shader is active, the set of attributes captured in transform feedback 136 mode is determined using the state of the active program object; 137 otherwise, it is taken from the state of the currently bound transform 138 feedback object, as described below. The name space for transform 139 feedback objects is the unsigned integers. The name zero designates the 140 default transform feedback object. 141 142 The command 143 144 void GenTransformFeedbacks(sizei n, uint *ids) 145 146 returns <n> previously unused transform feedback object names in <ids>. 147 These names are marked as used, for the purposes of 148 GenTransformFeedbacks only, but they acquire transform feedback state 149 only when they are first bound. 150 151 Transform feedback objects are deleted by calling 152 153 void DeleteTransformFeedbacks(sizei n, const uint *ids) 154 155 <ids> contains <n> names of transform feedback objects to be deleted. 156 After a transform feedback object is deleted it has no contents, and its 157 name is again unused. Unused names in <ids> are silently ignored, as is 158 the value zero. The default transform feedback object cannot be 159 deleted. If an active transform feedback object is deleted its name 160 immediately becomes unused, but the underlying object is not deleted 161 until it is no longer active 162 [This should be cited with a reference to appendix D.3 of the 163 OpenGL 3.3 Specification, but this extension is instead written 164 against OpenGL 2.1] 165 166 The error INVALID_OPERATION is generated by DeleteTransformFeedbacks 167 if the transform feedback operation for any object named by <ids> is 168 currently active. 169 170 A transform feedback object is created by binding a name 171 returned by GenTransformFeedbacks with the command 172 173 void BindTransformFeedback(enum target, uint id) 174 175 <target> must be TRANSFORM_FEEDBACK and <id> is the transform 176 feedback object name. The resulting transform feedback object is a new 177 state vector, initialized to the default state values described in Table 178 6.X. Additionally, the new object is bound to the GL state vector and 179 is used for subsequent transform feedback operations. 180 181 BindTransformFeedback can also be used to bind an existing transform 182 feedback object to the GL state for subsequent use. If the bind is 183 successful, no change is made to the state of the newly bound transform 184 feedback object and any previous binding to <target> is broken. 185 186 While a transform feedback buffer object is bound, GL operations on the 187 target to which it is bound affect the bound transform feedback object, 188 and queries of the target to which a transform feedback object is bound 189 return state from the bound object. When buffer objects are bound for 190 transform feedback, they are attached to the currently bound transform 191 feedback object. Buffer objects are used for transform feedback only if 192 they are attached to the currently bound transform feedback object. 193 194 In the initial state, a default transform feedback object is bound and 195 treated as a transform feedback object with a name of zero. That object 196 is bound any time BindTransformFeedback() is called with <id> of zero. 197 198 The error INVALID_OPERATION is generated by BindTransformFeedback if the 199 transform feedback operation is active on the currently bound transform 200 feedback object, and that operation is not paused (as described below). 201 202 BindTransformFeedback fails and an INVALID_OPERATION error is 203 generated if <id> is not zero or a name returned from a previous 204 call to GenTransformFeedbacks, or if such a name has since been 205 deleted with DeleteTransformFeedbacks. 206 207 208 Section 2.Y.2, Transform Feedback Primitive Capture 209 210 Transform feedback for the currently bound transform feedback object is 211 started and finished by calling 212 213 void BeginTransformFeedback(enum primitiveMode) 214 215 and 216 217 void EndTransformFeedback(void), 218 219 respectively. Transform feedback is said to be active after a call to 220 BeginTransformFeedback and inactive after a call to EndTransformFeedback. 221 <primitiveMode> is one of TRIANGLES, LINES, or POINTS, and specifies the 222 output type of primitives that will be recorded into the buffer objects 223 bound for transform feedback (see below). 224 225 Transform feedback commands must be paired; the error INVALID_OPERATION is 226 generated by BeginTransformFeedback if transform feedback is active, and 227 by EndTransformFeedback if transform feedback is inactive. Transform 228 feedback is initially inactive. 229 230 Transform feedback operations for the currently bound transform feedback 231 object may be paused and resumed by calling 232 233 void PauseTransformFeedback(void) 234 235 and 236 237 void ResumeTransformFeedback(void), 238 239 respectively. When transform feedback operations are paused, transform 240 feedback is still considered active and changing most transform feedback 241 state related to the object results in an error. However, a new transform 242 feedback object may be bound while transform feedback is paused. The 243 error INVALID_OPERATION is generated by PauseTransformFeedback if the 244 currently bound transform feedback is not active or is paused. The error 245 INVALID_OPERATION is generated by ResumeTransformFeedback if the 246 currently bound transform feedback is not active or is not paused. 247 248 When transform feedback is active and not paused, all geometric primitives 249 generated must be compatible with the value of <primitiveMode> passed to 250 BeginTransformFeedback. The error INVALID_OPERATION is generated by Begin 251 or any operation that implicitly calls Begin (such as DrawElements) if 252 <mode> is not one of the allowed modes in Table X.1. If a geometry shader 253 is active, its output primitive type is used instead of the <mode> 254 parameter passed to Begin for the purposes of this error check. Any 255 primitive type may be used while transform feedback is paused. 256 257 Transform Feedback 258 primitiveMode allowed render primitive modes 259 ---------------------- --------------------------------- 260 POINTS POINTS 261 LINES LINES, LINE_LOOP, and LINE_STRIP 262 TRIANGLES TRIANGLES, TRIANGLE_STRIP, 263 TRIANGLE_FAN, QUADS, QUAD_STRIP, 264 and POLYGON 265 266 Table X.1 Legal combinations between the transform feedback primitive 267 mode, as passed to BeginTransformFeedback and the current primitive 268 mode. 269 270 Transform feedback mode captures the values of varying variables written by an 271 active vertex or geometry shader. The error INVALID_OPERATION is 272 generated by BeginTransformFeedback if no vertex or geometry shader is 273 active. 274 275 Buffer objects are made to be targets of transform feedback by calling one 276 of the commands 277 278 void BindBufferRange(enum target, uint index, uint buffer, 279 intptr offset, sizeiptr size), 280 void BindBufferBase(enum target, uint index, uint buffer), 281 282 with <target> set to TRANSFORM_FEEDBACK_BUFFER. There is an array of 283 buffer object binding points that are used while transform feedback is 284 active, plus a single general binding point that can be used by other 285 buffer object manipulation functions (e.g., BindBuffer, MapBuffer). All 286 three commands bind the buffer object named by <buffer> to the general 287 binding point, and additionally bind the buffer object to the binding 288 point in the array given by <index>. An INVALID_VALUE error is 289 generated if <index> is greater than or equal to the value of 290 MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS. 291 292 For BindBufferRange, <offset> specifies a starting offset into the 293 buffer object <buffer> and <size> specifies the amount of data that can 294 be written to the buffer object while transform feedback mode is active. 295 Both <offset> and <size> are in basic machine units. An INVALID_VALUE 296 error is generated if <size> is less than or equal to zero, or if either 297 <offset> or <size> are not word-aligned. 298 299 BindBufferBase binds the entire buffer, even when the size of the buffer 300 is changed after the binding is established. It is equivalent to calling 301 BindBufferRange with <offset> zero, while <size> is determined by the 302 size of the bound buffer at the time the binding is used. 303 304 Regardless of the size specified with BindBufferRange, or indirectly 305 with BindBufferBase, the GL will never read or write beyond the end of a 306 bound buffer. This may result in visibly different behavior when a 307 buffer overflow would otherwise result, as described below. 308 309 The set of buffer objects used by a transform feedback object may not 310 change while transform feedback is active. The error INVALID_OPERATION 311 is generated by BindBufferRange, BindBufferOffsetEXT, or BindBufferBase 312 if <target> is TRANSFORM_FEEDBACK_BUFFER and transform feedback is 313 currently active. 314 315 When an individual point, line, or triangle primitive reaches the 316 transform feedback stage while transform feedback is active and not 317 paused, the values of the specified varying variables of each vertex are 318 appended to the buffer objects bound to the transform feedback binding 319 points. The attributes of the first vertex received after 320 BeginTransformFeedback are written at the starting offsets of the bound 321 buffer objects set by BindBufferRange, and subsequent vertex attributes 322 are appended to the buffer object. When capturing line and triangle 323 primitives, all attributes of the first vertex are written first, followed 324 by attributes of the subsequent vertices. When writing varying variables 325 that are arrays, individual array elements are written in order. For 326 multi-component varying variables, elements of varying arrays, or 327 transformed vertex attributes, the individual components are written in 328 order. The value for any attribute specified to be streamed to a buffer 329 object but not actually written by a vertex or geometry shader is 330 undefined. 331 332 When transform feedback is paused, no vertices are recorded. When 333 transform feedback is resumed, subsequent vertices are appended to the 334 buffer objects bound immediately following the last vertex written while 335 transform feedback was paused. 336 337 When quads and polygons are provided to transform feedback with a 338 primitive mode of TRIANGLES, they will be tessellated and recorded as 339 triangles (the order of tessellation within a primitive is undefined). 340 Individual lines or triangles of a strip or fan primitive will be 341 extracted and recorded separately. Incomplete primitives are not 342 recorded. 343 344 Transform feedback can operate in either INTERLEAVED_ATTRIBS or 345 SEPARATE_ATTRIBS mode. In INTERLEAVED_ATTRIBS mode, the values of one or 346 more varyings or transformed vertex attributes are written interleaved, 347 into the buffer object bound to the first transform feedback binding point 348 (index = 0). If more than one varying variable is written, they will be 349 recorded in the order specified by TransformFeedbackVaryings 350 (EXT_transform_feedback specification, section 2.15.3). In 351 SEPARATE_ATTRIBS mode, the first varying variable or transformed vertex 352 attribute specified is written to the first transform feedback binding 353 point; subsequent varying variables are written to the subsequent 354 transform feedback binding points. The total number of variables or 355 transformed attributes that may be captured in SEPARATE_ATTRIBS mode is 356 given by MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS. 357 358 If recording the vertices of a primitive to the buffer objects being used 359 for transform feedback purposes would result in either exceeding the 360 limits of any buffer object's size, or in exceeding the end position 361 <offset> + <size> - 1, as set by BindBufferRange, then no vertices of 362 that primitive are recorded in any buffer object, and the counter 363 corresponding to the asynchronous query target 364 TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN (see Section 2.Z) is not 365 incremented. 366 367 In either separate or interleaved modes, all transform feedback binding 368 points that will be written to must have buffer objects bound when 369 BeginTransformFeedback is called. The error INVALID_OPERATION is 370 generated by BeginTransformFeedback if any binding point used in 371 transform feedback mode does not have a buffer object bound. In 372 interleaved mode, only the first buffer object binding point is ever 373 written to. 374 375 (add error paragraph describing conditions where it is illegal to change 376 transform feedback-related state) 377 378 When BeginTransformFeedback is called with an active program object 379 containing a vertex or geometry shader, the set of varying variables 380 captured during transform feedback is taken from the active program object 381 and may not be changed while transform feedback is active. That program 382 object must be active until the EndTransformFeedback is called, except 383 while the transform feedback object is paused. The error 384 INVALID_OPERATION is generated: 385 386 * by TransformFeedbackVaryings if the current transform feedback 387 object is active, even if paused; 388 389 * by UseProgram if the current transform feedback object is active and 390 not paused; 391 392 * by LinkProgram if <program> is the name of a program being used by one 393 or more transform feedback objects, even if the objects are not 394 currently bound or are paused; or 395 396 * by ResumeTransformFeedback if the program object being used by the 397 current transform feedback object is not active. 398 399 400 Section 2.Y.3, Transform Feedback Draw Operations 401 402 When transform feedback is active, the values of varyings or transformed 403 vertex attributes are captured into the buffer objects attached to the 404 current transform feedback object. After transform feedback is complete, 405 subsequent rendering operations may use the contents of these buffer 406 objects (section 2.9). The number of vertices captured during transform 407 feedback is stored in the corresponding transform feedback object and may 408 be used in conjunction with the command 409 410 void DrawTransformFeedback(enum mode, uint id) 411 412 to replay the captured vertices. This command is equivalent to calling 413 DrawArrays with <mode> set to <mode>, <first> set to zero, and <count> set 414 to the number of vertices captured the last time transform feedback was 415 active on the transform feedback object named by <id>. The error 416 INVALID_VALUE is generated if <id> is not the name of a transform feedback 417 object. The error INVALID_OPERATION is generated if 418 EndTransformFeedback has never been called while the object named by <id> 419 was bound. No error is generated if the transform feedback object named 420 by <id> is active; the vertex count used for the rendering operation is 421 set by the previous EndTransformFeedback command. 422 423 424Additions to Chapter 3 of the OpenGL 2.1 Specification (Rasterization) 425 426 None. 427 428Additions to Chapter 4 of the OpenGL 2.1 Specification (Per-Fragment 429Operations and the Frame Buffer) 430 431 None. 432 433Additions to Chapter 5 of the OpenGL 2.1 Specification (Special Functions) 434 435 On p. 244, add a new set of commands to the list of commands not compiled 436 into a display list: 437 438 Transform feedback objects: GenTransformFeedbacks, 439 DeleteTransformFeedbacks, 440 441 (note: IsTransformFeedback is covered by the "Other queries" rule.) 442 443Additions to Chapter 6 of the OpenGL 2.1 Specification (State and 444State Requests) 445 446 (Add to the "Transform Feedback" query section added by the 447 EXT_transform_feedback extension.) 448 449 The command 450 451 boolean IsTransformFeedback(uint id) 452 453 returns TRUE if <id> is the name of a transform feedback object. If <id> 454 is a non-zero value that is not the name of a transform feedback object, 455 IsTransformFeedback() return FALSE. 456 457Additions to Appendix A of the OpenGL 2.1 Specification (Invariance) 458 459 None. 460 461Additions to the AGL/GLX/WGL Specifications 462 463 None. 464 465GLX Protocol 466 467 TBD (Protocol support needs to be added for the new functions.) 468 469Dependencies on NV_transform_feedback2 470 471Dependencies on EXT_transform_feedback 472 473 This language is written against the EXT_transform_feedback 474 specification. 475 476Dependencies on EXT_geometry_shader4 477 478 If EXT_geometry_shader4 is not supported, remove all references to 479 geometry shaders. 480 481Errors 482 483 The error INVALID_OPERATION is generated by BindTransformFeedback if a 484 transform feedback operation is active on the currently bound transform 485 feedback object, and that operation is not paused (as described below). 486 487 The error INVALID_OPERATION is generated by DeleteTransformFeedbacks if 488 the transform feedback operation for any object named by <ids> is 489 currently active. 490 491 The error INVALID_OPERATION is generated by BeginTransformFeedback if 492 transform feedback is active. 493 494 The error INVALID_OPERATION is generated by EndTransformFeedback if 495 transform feedback is inactive. 496 497 The error INVALID_OPERATION is generated by PauseTransformFeedback if 498 the currently bound transform feedback is not active or is paused. 499 500 The error INVALID_OPERATION is generated by ResumeTransformFeedback 501 if the currently bound transform feedback is not active or is not paused. 502 503 The error INVALID_OPERATION is generated by Begin or any operation that 504 implicitly calls Begin (such as DrawElements) if transform feedback is 505 active and not paused and if <mode> is incompatible with the 506 <primitiveMode> parameter supplied to BeginTransformFeedback. 507 508 The error INVALID_VALUE is generated by BindBufferRange, 509 BindBufferOffsetEXT, or BindBufferBase if <target> is 510 TRANSFORM_FEEDBACK_BUFFER and <index> is greater than or equal to the 511 value of MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS. 512 513 The error INVALID_VALUE is generated by BindBufferRange if <size> is 514 less than or equal to zero or either <offset> or <size> are not 515 word-aligned. 516 517 The error INVALID_VALUE is generated by BindBufferOffsetEXT if <offset> 518 is not word-aligned. 519 520 The error INVALID_OPERATION is generated by BindBufferRange, 521 BindBufferOffsetEXT, or BindBufferBase if <target> is 522 TRANSFORM_FEEDBACK_BUFFER and transform feedback is currently active. 523 524 The error INVALID_OPERATION is generated by BeginTransformFeedback if 525 any binding point used in transform feedback mode does not have a buffer 526 object bound. 527 528 The error INVALID_OPERATION is generated by TransformFeedbackVaryings 529 if the current transform feedback object is active, even if paused. 530 531 The error INVALID_OPERATION is generated by UseProgram if the current 532 transform feedback object is active and not paused. 533 534 The error INVALID_OPERATION is generated by LinkProgram if <program> is 535 the name of a program being used by one or more transform feedback 536 objects, even if the objects are not currently bound or are paused. 537 538 The error INVALID_OPERATION is generated by ResumeTransformFeedback if 539 the program object being used by the current transform feedback object is 540 not active. 541 542 The error INVALID_VALUE is generated by DrawTransformFeedback if <id> 543 is not the name of a transform feedback object. 544 545 The error INVALID_OPERATION is generated by DrawTransformFeedback if 546 EndTransformFeedback has never been called while the object named by 547 <id> was bound. 548 549 550New State 551 552 (Add a new table: Table 6.X, Transform Feedback Object State) 553 554 Get Value Type Get Command Init. Value Description Sec Attrib 555 ------------------ ------ -------------- ------------ ------------------------- ----- ------ 556 TRANSFORM_FEEDBACK_ Z+ GetIntegerv 0 Buffer object bound to 6.1.13 - 557 BUFFER_BINDING generic bind point for 558 transform feedback. 559 TRANSFORM_FEEDBACK_ nxZ+ GetIntegeri_v 0 Buffer object bound to 6.1.13 - 560 BUFFER_BINDING each transform feedback 561 attribute stream. 562 TRANSFORM_FEEDBACK_ nxZ+ GetIntegeri_v 0 Start offset of binding 6.1.13 - 563 BUFFER_START range for each transform 564 feedback attrib. stream 565 TRANSFORM_FEEDBACK_ nxZ+ GetIntegeri_v 0 Size of binding range 6.1.13 - 566 BUFFER_SIZE for each transform 567 TRANSFORM_FEEDBACK_ B GetBooleanv FALSE Is transform feedback 6.1.13 - 568 BUFFER_PAUSED paused on this object? 569 TRANSFORM_FEEDBACK_ B GetBooleanv FALSE Is transform feedback 6.1.13 - 570 BUFFER_ACTIVE active on this object? 571 572 [[ Note: This table includes all transform feedback state provided by 573 EXT_transform_feedback, except for transform feedback-related state 574 belonging to query objects and GLSL program objects. The only other 575 transform feedback-related state not present in these objects is the 576 object binding (below) and implementation-dependent limits. ]] 577 578 (Modify table 6.10: Transformation State, p. 275) 579 580 Get Value Type Get Command Init. Value Description Sec Attrib 581 ------------------ ------ -------------- ------------ ------------------------- ----- ------ 582 TRANSFORM_FEEDBACK_ Z+ GetIntegerv 0 Object bound for transform 2.Y - 583 BINDING feedback operations 584 585New Implementation Dependent State 586 587 None. 588 589Issues 590 591 1. How should we provide the ability to automatically render primitives 592 captured in transform feedback mode? 593 594 RESOLVED: Adding a new transform feedback state object provides 595 encapsulation for two useful operations: pause/resume and automatic 596 rendering. 597 598 When applications pause and possibly switch to different transform 599 feedback state, it is necessary to save the state of the paused 600 transform feedback operation somewhere. The transform feedback object 601 provides a convenient entity to hold this saved state. The transform 602 feedback object is also a convenient place to store final counts for 603 use by actual drawing. 604 605 Additionally, the transform feedback object is helpful in ensuring 606 that the transform feedback state used when resuming transform 607 feedback is the same as when it was paused without a complicated error 608 check. We simply disallow changing the state in an object while 609 transform feedback is active (even when paused), so the state can't 610 become inconsistent while paused. The same basic consistency rules 611 apply to transform feedback state stored separately in a GLSL program 612 object; you can't change them while transform feedback is active in 613 the original extensions, and this extension treats the paused state as 614 active for the purposes of these restrictions. 615 616 Alternately, the in-progress transform feedback state (e.g., vertex 617 counts, pointers into buffer objects) could have been stored with the 618 buffer objects used to capture the primitives. 619 620 2. Are transform feedback objects shared between contexts? 621 622 RESOLVED: No. The amount of state present in one of these objects is 623 fairly small -- there is not a lot of memory saved by avoiding 624 multiple copies through sharing. Additionally, sharing transform 625 feedback objects between contexts doesn't seem particularly useful -- 626 an object could only really be used by one context at a time and 627 explicit synchronization would be required to use the results of one 628 object. 629 630 Note that this resolution is consistent with query objects, which is 631 the primary type of object used in the original transform feedback 632 specification. 633 634 3. How do the new transform feedback objects interact with GLSL program 635 objects? 636 637 RESOLVED: The set of varyings captured during transform feedback and 638 the buffer mode (interleaved or separate) were assigned to the program 639 object in the original EXT_transform_feedback specification. That 640 seems sensible given that the varyings themselves belong to the 641 program object. 642 643 In the original extension, implementations are forbidden to unbind or 644 relink a program object or reassign the set of varyings to capture 645 while transform feedback is active. The same basic restrictions apply 646 in this extension, except that than an application may unbind a 647 program object while transform feedback is paused. In order to resume 648 transform feedback, the same program object must be active. 649 Applications may not relink a program or reassign its captured 650 varyings while it is being actively used for capture in any transform 651 feedback object. 652 653 The actual buffer objects bound in transform feedback mode were bound 654 to the context (not the program object) in the original transform 655 feedback extension. 656 657 4. Should we provide any behavior to "cancel" paused transform feedback 658 operations? If an application fails to assign the correct state 659 (e.g., GLSL program object), a resume operation may fail and the XFB 660 object might get stuck in a paused state indefinitely. 661 662 RESOLVED: Yes. EndTransformFeedback is defined to cancel an active 663 transform feedback operation, even if it is currently paused. 664 665 5. Should buffer object bindings be encapsulated in the new transform 666 feedback object? 667 668 RESOLVED: Yes. This allows applications the convenience of updating 669 all the transform feedback state in one call. Additionally, it 670 ensures that the set of buffer bindings remains consistent while 671 transform feedback is active -- even if we switch objects while 672 paused. 673 674 6. Should we be able to use two different sets of transform feedback 675 state (one for capture, a second for rendering - via 676 DrawTransformFeedback)? 677 678 RESOLVED: Yes. We should support the ability to capture primitives 679 in transform feedback that are produced by DrawTransformFeedback. 680 Requiring that applications use the a single transform feedback object 681 for both operations (if even possible) seems inconvenient. As a 682 result, we provide the ability to use separate objects for capture and 683 rendering. 684 685 7. How should the second transform feedback object used for rendering be 686 provided to the GL? 687 688 RESOLVED: The approach chosen by this extension is to have 689 DrawTransformFeedback() accept a transform feedback object ID. 690 691 An alternate approach would have been to provide a second binding 692 point (TRANSFORM_FEEDBACK_RENDER?) whose bound object would be used 693 by any DrawTransformFeedback() call. 694 695 696 8. Can a single transform feedback object be used for both capture and 697 drawing (via DrawTransformFeedback) at the same time? 698 699 RESOLVED: Yes. 700 701 DrawTransformFeedback is defined to use the vertex count established 702 when the previous transform feedback operation on that object 703 completes (by an EndTransformFeedback call). If transform feedback 704 is active for an object (paused or not), the accumulated vertex count 705 for the in-progress operation is never used by 706 DrawTransformFeedback. 707 708 9. Does DrawTransformFeedback() automatically use the buffer objects 709 from the previous transform feedback operation? If not, does it 710 require that applications set up and use only those buffer manually? 711 712 RESOLVED: DrawTransformFeedback() couldn't automatically set up 713 buffer objects, even if we wanted to (which we don't). No mechanism 714 exists to automatically line up per-vertex outputs captured during 715 transform feedback against the inputs of a different vertex shader. 716 717 Applications are thus required to manually set up their vertex arrays 718 appropriately prior to calling DrawTransformFeedback(). 719 Applications are not required to use any of the buffer objects 720 written to during the previous transform feedback operation, and are 721 allowed to use other buffer objects (OK) or vertex arrays not stored 722 in a buffer object at all (legal, but not recommended). The only 723 information the draw call uses from the previous transform feedback 724 operation is the total number of vertices captured. 725 726 10. Does DrawTransformFeedback() require that an application use the 727 same primitive type for drawing that was used during the previous 728 transform feedback operation? 729 730 RESOLVED: No. We do expect that will be the common case, however. 731 732 11. What happens on if DrawTransformFeedback() uses a transform feedback 733 object whose last capture operation overflowed, and started dropping 734 primitives. 735 736 RESOLVED: Any primitives discarded during a transform feedback 737 operation will not affect the vertex count extracted by 738 DrawTransformFeedback(), as though those primitives never existed. 739 740 12. How does the ability to pause/resume transform feedback interact with 741 the TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN query object? 742 743 RESOLVED: There is no explicit interaction in this case. 744 745 The transform feedback-related query objects and transform feedback 746 objects are completely independent. If multiple transform feedback 747 objects are used between BeginQuery() and EndQuery() calls, the query 748 result reflects the number of primitives written using *any* transform 749 feedback object. 750 751 Note that the primitives written counter is never incremented when 752 transform feedback is paused, because no primitives will be written to 753 buffers while transform feedback is paused. 754 755 13. Should we provide a mechanism to query the number of vertices or 756 primitives recorded in the last transform feedback operation on an 757 object? If so, how? 758 759 RESOLVED: No, not in this spec. The existing TRANSFORM_FEEDBACK_ 760 PRIMITIVES_WRITTEN queries can be used to obtain this information. 761 762 14. Can a buffer object be attached to more than one transform feedback 763 object at the same time? 764 765 RESOLVED: Yes. Applications using transform feedback should avoid 766 cases where transform feedback operations can conflict, including: 767 768 * using multiple threads that simultaneously write to overlapping 769 regions of a single buffer object; or 770 771 * using one or multiple threads, where a portion of a buffer object 772 is written using one transform feedback object while another 773 transform feedback operation writing to an overlapping region of 774 the same buffer is paused. 775 776 15. When a transform feedback object is active and not paused, binding a 777 different transform feedback object without pausing is specified to 778 result in an INVALID_OPERATION error. Should we instead define the 779 bind to implicitly pause and resume as required? 780 781 RESOLVED: No. While implicit pauses and resumes would be convenient, 782 they have interaction issues with the current transform feedback API. 783 784 In particular, transform feedback forbids applications from changing 785 various pieces of relevant state (e.g., transform feedback buffer 786 bindings, active GLSL program object) during an active transform 787 feedback operation. The active GLSL program object may be changed 788 while transform feedback is paused, but it must be restored prior to 789 resuming. 790 791 Consider two active transform feedback objects (A and B) using two 792 different program objects (C and D, respectively). With the current 793 API, you can switch back and forth as follows: 794 795 // Perform first half of transform feedback for object A. 796 UseProgram(C); 797 BindTransformFeedback(TRANSFORM_FEEDBACK, A); 798 BeginTransformFeedback(...); 799 ... 800 PauseTransformFeedback(); 801 802 // Perform first half of transform feedback for object B. 803 UseProgram(D); 804 BindTransformFeedback(TRANSFORM_FEEDBACK, B); 805 BeginTransformFeedback(...); 806 ... 807 PauseTransformFeedback(); 808 809 // Perform second half of transform feedback for object A. 810 UseProgram(C); 811 BindTransformFeedback(TRANSFORM_FEEDBACK, A); 812 ResumeTransformFeedback(); 813 ... 814 EndTransformFeedback(); 815 816 // Perform second half of transform feedback for object B. 817 UseProgram(D); 818 BindTransformFeedback(TRANSFORM_FEEDBACK, B); 819 ResumeTransformFeedback(); 820 ... 821 EndTransformFeedback(); 822 823 Implicit pauses and resumes would allow applications to omit the 824 PauseTransformFeedback() and ResumeTransformFeedback() calls. The 825 problem with this approach is that it's not clear when to change 826 program objects. In the example above, the second call to 827 UseProgram(C) is legal because the bound transform feedback object (B) 828 is paused. If the pause call were removed in favor of implicit 829 pauses, that UseProgram(C) call would be illegal because there is an 830 active transform feedback object. Assume the UseProgram(C) call were 831 moved to be after the BindTransformFeedback(..., A) call on the next 832 line instead. In that case, the implicit resume on the bind call 833 would be the problem instead -- we'd be resuming a transform feedback 834 operation while the wrong program object (D) is active. 835 836 837Revision History 838 839 Rev. Date Author Changes 840 ---- -------- -------- ----------------------------------------- 841 7 06/28/12 Jon Leech Remove INVALID_VALUE error for 842 BindBufferRange when specifying a range 843 beyond the current end of buffer. Define 844 BindBufferBase as specifying a range as 845 large as the actual buffer size at time of 846 use, and return zero when querying the 847 buffer size as a sentinel value for the 848 buffer size indicating this behavior. 849 Specify that the GL will never read from or 850 write to beyond the end of a bound buffer 851 (Bugs 7318 and 7329, matching OpenGL 4.2 852 core spec behavior). Reflow paragraphs that 853 were too wide. Replace references to 854 nonexistent BindBufferOffset command with 855 BindBufferOffsetEXT from 856 EXT_transform_feedback. 857 858 6 02/11/10 Jon Leech Specify delayed-deletion behavior for 859 active XFB objects (Bug 5768). 860 861 5 01/19/10 Jon Leech Reorder object management section to match 862 other types of objects and require Gen'ned 863 names be used for binding objects (Bug 5846). 864 865 4 12/07/09 jbolz Rename EXT->ARB. 866 867 3 10/12/09 ericz Removed some state that was part of 868 NV_transform_feedback and only applied to 869 fixed function. 870 871 2 09/10/09 ericz Updated issues that were previously UNRESOLVED, 872 based on the latest NV_transform_feedback2 873 spec. Allow EndTransformFeedbackEXT to be 874 called while transform feedback is paused. 875 876 1 06/13/09 ericz Created an initial EXT_transform_feedback2 877 spec by forking off the existing 878 NV_transform_feedback 2 spec. 879