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