2 * Mesa 3-D graphics library
4 * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * Vertex transform feedback support.
34 #include "bufferobj.h"
37 #include "transformfeedback.h"
38 #include "shaderapi.h"
39 #include "shaderobj.h"
40 #include "main/dispatch.h"
42 #include "program/prog_parameter.h"
43 //#include "program/shader_api.h"
46 #if FEATURE_EXT_transform_feedback
50 * Do reference counting of transform feedback buffers.
53 reference_transform_feedback_object(struct gl_transform_feedback_object
**ptr
,
54 struct gl_transform_feedback_object
*obj
)
60 /* Unreference the old object */
61 struct gl_transform_feedback_object
*oldObj
= *ptr
;
63 ASSERT(oldObj
->RefCount
> 0);
66 if (oldObj
->RefCount
== 0) {
67 GET_CURRENT_CONTEXT(ctx
);
69 ctx
->Driver
.DeleteTransformFeedback(ctx
, oldObj
);
77 /* reference new object */
78 if (obj
->RefCount
== 0) {
79 _mesa_problem(NULL
, "referencing deleted transform feedback object");
91 * Check if the given primitive mode (as in glBegin(mode)) is compatible
92 * with the current transform feedback mode (if it's enabled).
93 * This is to be called from glBegin(), glDrawArrays(), glDrawElements(), etc.
95 * \return GL_TRUE if the mode is OK, GL_FALSE otherwise.
98 _mesa_validate_primitive_mode(GLcontext
*ctx
, GLenum mode
)
100 if (ctx
->TransformFeedback
.CurrentObject
->Active
) {
103 return ctx
->TransformFeedback
.Mode
== GL_POINTS
;
107 return ctx
->TransformFeedback
.Mode
== GL_LINES
;
109 return ctx
->TransformFeedback
.Mode
== GL_TRIANGLES
;
117 * Check that all the buffer objects currently bound for transform
118 * feedback actually exist. Raise a GL_INVALID_OPERATION error if
119 * any buffers are missing.
120 * \return GL_TRUE for success, GL_FALSE if error
123 _mesa_validate_transform_feedback_buffers(GLcontext
*ctx
)
132 * Per-context init for transform feedback.
135 _mesa_init_transform_feedback(GLcontext
*ctx
)
137 if (!ctx
->Driver
.NewTransformFeedback
) {
138 /* this feature/extension may not be supported by the driver */
142 ctx
->TransformFeedback
.DefaultObject
=
143 ctx
->Driver
.NewTransformFeedback(ctx
, 0);
145 assert(ctx
->TransformFeedback
.DefaultObject
->RefCount
== 1);
147 reference_transform_feedback_object(&ctx
->TransformFeedback
.CurrentObject
,
148 ctx
->TransformFeedback
.DefaultObject
);
150 assert(ctx
->TransformFeedback
.DefaultObject
->RefCount
== 2);
152 ctx
->TransformFeedback
.Objects
= _mesa_NewHashTable();
154 _mesa_reference_buffer_object(ctx
,
155 &ctx
->TransformFeedback
.CurrentBuffer
,
156 ctx
->Shared
->NullBufferObj
);
162 * Callback for _mesa_HashDeleteAll().
165 delete_cb(GLuint key
, void *data
, void *userData
)
167 GLcontext
*ctx
= (GLcontext
*) userData
;
168 struct gl_transform_feedback_object
*obj
=
169 (struct gl_transform_feedback_object
*) data
;
171 ctx
->Driver
.DeleteTransformFeedback(ctx
, obj
);
176 * Per-context free/clean-up for transform feedback.
179 _mesa_free_transform_feedback(GLcontext
*ctx
)
181 if (!ctx
->Driver
.NewTransformFeedback
) {
182 /* this feature/extension may not be supported by the driver */
186 _mesa_reference_buffer_object(ctx
,
187 &ctx
->TransformFeedback
.CurrentBuffer
,
190 /* Delete all feedback objects */
191 _mesa_HashDeleteAll(ctx
->TransformFeedback
.Objects
, delete_cb
, ctx
);
192 _mesa_DeleteHashTable(ctx
->TransformFeedback
.Objects
);
194 /* Delete the default feedback object */
195 assert(ctx
->Driver
.DeleteTransformFeedback
);
196 ctx
->Driver
.DeleteTransformFeedback(ctx
,
197 ctx
->TransformFeedback
.DefaultObject
);
199 ctx
->TransformFeedback
.CurrentObject
= NULL
;
203 /** Default fallback for ctx->Driver.NewTransformFeedback() */
204 static struct gl_transform_feedback_object
*
205 new_transform_feedback(GLcontext
*ctx
, GLuint name
)
207 struct gl_transform_feedback_object
*obj
;
208 obj
= CALLOC_STRUCT(gl_transform_feedback_object
);
216 /** Default fallback for ctx->Driver.DeleteTransformFeedback() */
218 delete_transform_feedback(GLcontext
*ctx
,
219 struct gl_transform_feedback_object
*obj
)
223 for (i
= 0; i
< Elements(obj
->Buffers
); i
++) {
224 _mesa_reference_buffer_object(ctx
, &obj
->Buffers
[i
], NULL
);
230 /** Default fallback for ctx->Driver.BeginTransformFeedback() */
232 begin_transform_feedback(GLcontext
*ctx
, GLenum mode
,
233 struct gl_transform_feedback_object
*obj
)
238 /** Default fallback for ctx->Driver.EndTransformFeedback() */
240 end_transform_feedback(GLcontext
*ctx
,
241 struct gl_transform_feedback_object
*obj
)
246 /** Default fallback for ctx->Driver.PauseTransformFeedback() */
248 pause_transform_feedback(GLcontext
*ctx
,
249 struct gl_transform_feedback_object
*obj
)
254 /** Default fallback for ctx->Driver.ResumeTransformFeedback() */
256 resume_transform_feedback(GLcontext
*ctx
,
257 struct gl_transform_feedback_object
*obj
)
262 /** Default fallback for ctx->Driver.DrawTransformFeedback() */
264 draw_transform_feedback(GLcontext
*ctx
, GLenum mode
,
265 struct gl_transform_feedback_object
*obj
)
269 * Get number of vertices in obj's feedback buffer.
270 * Call ctx->Exec.DrawArrays(mode, 0, count);
276 * Plug in default device driver functions for transform feedback.
277 * Most drivers will override some/all of these.
280 _mesa_init_transform_feedback_functions(struct dd_function_table
*driver
)
282 driver
->NewTransformFeedback
= new_transform_feedback
;
283 driver
->DeleteTransformFeedback
= delete_transform_feedback
;
284 driver
->BeginTransformFeedback
= begin_transform_feedback
;
285 driver
->EndTransformFeedback
= end_transform_feedback
;
286 driver
->PauseTransformFeedback
= pause_transform_feedback
;
287 driver
->ResumeTransformFeedback
= resume_transform_feedback
;
288 driver
->DrawTransformFeedback
= draw_transform_feedback
;
293 _mesa_init_transform_feedback_dispatch(struct _glapi_table
*disp
)
295 SET_BeginTransformFeedbackEXT(disp
, _mesa_BeginTransformFeedback
);
296 SET_EndTransformFeedbackEXT(disp
, _mesa_EndTransformFeedback
);
297 SET_BindBufferRangeEXT(disp
, _mesa_BindBufferRange
);
298 SET_BindBufferBaseEXT(disp
, _mesa_BindBufferBase
);
299 SET_BindBufferOffsetEXT(disp
, _mesa_BindBufferOffsetEXT
);
300 SET_TransformFeedbackVaryingsEXT(disp
, _mesa_TransformFeedbackVaryings
);
301 SET_GetTransformFeedbackVaryingEXT(disp
, _mesa_GetTransformFeedbackVarying
);
306 ** Begin API functions
311 _mesa_BeginTransformFeedback(GLenum mode
)
313 struct gl_transform_feedback_object
*obj
;
314 GET_CURRENT_CONTEXT(ctx
);
316 obj
= ctx
->TransformFeedback
.CurrentObject
;
325 _mesa_error(ctx
, GL_INVALID_ENUM
, "glBeginTransformFeedback(mode)");
330 _mesa_error(ctx
, GL_INVALID_OPERATION
,
331 "glBeginTransformFeedback(already active)");
335 obj
->Active
= GL_TRUE
;
336 ctx
->TransformFeedback
.Mode
= mode
;
338 assert(ctx
->Driver
.BeginTransformFeedback
);
339 ctx
->Driver
.BeginTransformFeedback(ctx
, mode
, obj
);
344 _mesa_EndTransformFeedback(void)
346 struct gl_transform_feedback_object
*obj
;
347 GET_CURRENT_CONTEXT(ctx
);
349 obj
= ctx
->TransformFeedback
.CurrentObject
;
352 _mesa_error(ctx
, GL_INVALID_OPERATION
,
353 "glEndTransformFeedback(not active)");
357 ctx
->TransformFeedback
.CurrentObject
->Active
= GL_FALSE
;
359 assert(ctx
->Driver
.EndTransformFeedback
);
360 ctx
->Driver
.EndTransformFeedback(ctx
, obj
);
365 * Helper used by BindBufferRange() and BindBufferBase().
368 bind_buffer_range(GLcontext
*ctx
, GLuint index
,
369 struct gl_buffer_object
*bufObj
,
370 GLintptr offset
, GLsizeiptr size
)
372 struct gl_transform_feedback_object
*obj
=
373 ctx
->TransformFeedback
.CurrentObject
;
375 /* The general binding point */
376 _mesa_reference_buffer_object(ctx
,
377 &ctx
->TransformFeedback
.CurrentBuffer
,
380 /* The per-attribute binding point */
381 _mesa_reference_buffer_object(ctx
,
382 &obj
->Buffers
[index
],
385 obj
->BufferNames
[index
] = bufObj
->Name
;
387 obj
->Offset
[index
] = offset
;
388 obj
->Size
[index
] = size
;
393 * Specify a buffer object to receive vertex shader results. Plus,
394 * specify the starting offset to place the results, and max size.
397 _mesa_BindBufferRange(GLenum target
, GLuint index
,
398 GLuint buffer
, GLintptr offset
, GLsizeiptr size
)
400 struct gl_transform_feedback_object
*obj
;
401 struct gl_buffer_object
*bufObj
;
402 GET_CURRENT_CONTEXT(ctx
);
404 if (target
!= GL_TRANSFORM_FEEDBACK_BUFFER
) {
405 _mesa_error(ctx
, GL_INVALID_ENUM
, "glBindBufferRange(target)");
409 obj
= ctx
->TransformFeedback
.CurrentObject
;
412 _mesa_error(ctx
, GL_INVALID_OPERATION
,
413 "glBindBufferRange(transform feedback active)");
417 if (index
>= ctx
->Const
.MaxTransformFeedbackSeparateAttribs
) {
418 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindBufferRange(index=%d)", index
);
422 if ((size
<= 0) || (size
& 0x3)) {
423 /* must be positive and multiple of four */
424 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindBufferRange(size%d)", size
);
429 /* must be multiple of four */
430 _mesa_error(ctx
, GL_INVALID_VALUE
,
431 "glBindBufferRange(offset=%d)", offset
);
435 bufObj
= _mesa_lookup_bufferobj(ctx
, buffer
);
437 _mesa_error(ctx
, GL_INVALID_OPERATION
,
438 "glBindBufferRange(invalid buffer=%u)", buffer
);
442 if (offset
+ size
>= bufObj
->Size
) {
443 _mesa_error(ctx
, GL_INVALID_VALUE
,
444 "glBindBufferRange(offset + size > buffer size)", size
);
448 bind_buffer_range(ctx
, index
, bufObj
, offset
, size
);
453 * Specify a buffer object to receive vertex shader results.
454 * As above, but start at offset = 0.
457 _mesa_BindBufferBase(GLenum target
, GLuint index
, GLuint buffer
)
459 struct gl_transform_feedback_object
*obj
;
460 struct gl_buffer_object
*bufObj
;
462 GET_CURRENT_CONTEXT(ctx
);
464 if (target
!= GL_TRANSFORM_FEEDBACK_BUFFER
) {
465 _mesa_error(ctx
, GL_INVALID_ENUM
, "glBindBufferBase(target)");
469 obj
= ctx
->TransformFeedback
.CurrentObject
;
472 _mesa_error(ctx
, GL_INVALID_OPERATION
,
473 "glBindBufferRange(transform feedback active)");
477 if (index
>= ctx
->Const
.MaxTransformFeedbackSeparateAttribs
) {
478 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindBufferBase(index=%d)", index
);
482 bufObj
= _mesa_lookup_bufferobj(ctx
, buffer
);
484 _mesa_error(ctx
, GL_INVALID_OPERATION
,
485 "glBindBufferBase(invalid buffer=%u)", buffer
);
489 /* default size is the buffer size rounded down to nearest
492 size
= bufObj
->Size
& ~0x3;
494 bind_buffer_range(ctx
, index
, bufObj
, 0, size
);
499 * Specify a buffer object to receive vertex shader results, plus the
500 * offset in the buffer to start placing results.
501 * This function is part of GL_EXT_transform_feedback, but not GL3.
504 _mesa_BindBufferOffsetEXT(GLenum target
, GLuint index
, GLuint buffer
,
507 struct gl_transform_feedback_object
*obj
;
508 struct gl_buffer_object
*bufObj
;
509 GET_CURRENT_CONTEXT(ctx
);
512 if (target
!= GL_TRANSFORM_FEEDBACK_BUFFER
) {
513 _mesa_error(ctx
, GL_INVALID_ENUM
, "glBindBufferOffsetEXT(target)");
517 obj
= ctx
->TransformFeedback
.CurrentObject
;
520 _mesa_error(ctx
, GL_INVALID_OPERATION
,
521 "glBindBufferRange(transform feedback active)");
525 if (index
>= ctx
->Const
.MaxTransformFeedbackSeparateAttribs
) {
526 _mesa_error(ctx
, GL_INVALID_VALUE
,
527 "glBindBufferOffsetEXT(index=%d)", index
);
531 bufObj
= _mesa_lookup_bufferobj(ctx
, buffer
);
533 _mesa_error(ctx
, GL_INVALID_OPERATION
,
534 "glBindBufferOffsetEXT(invalid buffer=%u)", buffer
);
538 /* default size is the buffer size rounded down to nearest
541 size
= (bufObj
->Size
- offset
) & ~0x3;
543 bind_buffer_range(ctx
, index
, bufObj
, offset
, size
);
548 * This function specifies the vertex shader outputs to be written
549 * to the feedback buffer(s), and in what order.
552 _mesa_TransformFeedbackVaryings(GLuint program
, GLsizei count
,
553 const GLchar
**varyings
, GLenum bufferMode
)
555 struct gl_shader_program
*shProg
;
557 GET_CURRENT_CONTEXT(ctx
);
559 switch (bufferMode
) {
560 case GL_INTERLEAVED_ATTRIBS
:
562 case GL_SEPARATE_ATTRIBS
:
565 _mesa_error(ctx
, GL_INVALID_ENUM
,
566 "glTransformFeedbackVaryings(bufferMode)");
570 if (count
< 0 || count
> ctx
->Const
.MaxTransformFeedbackSeparateAttribs
) {
571 _mesa_error(ctx
, GL_INVALID_VALUE
,
572 "glTransformFeedbackVaryings(count=%d)", count
);
576 shProg
= _mesa_lookup_shader_program(ctx
, program
);
578 _mesa_error(ctx
, GL_INVALID_VALUE
,
579 "glTransformFeedbackVaryings(program=%u)", program
);
583 /* free existing varyings, if any */
584 for (i
= 0; i
< shProg
->TransformFeedback
.NumVarying
; i
++) {
585 free(shProg
->TransformFeedback
.VaryingNames
[i
]);
587 free(shProg
->TransformFeedback
.VaryingNames
);
589 /* allocate new memory for varying names */
590 shProg
->TransformFeedback
.VaryingNames
=
591 (GLchar
**) malloc(count
* sizeof(GLchar
*));
593 if (!shProg
->TransformFeedback
.VaryingNames
) {
594 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTransformFeedbackVaryings()");
598 /* Save the new names and the count */
599 for (i
= 0; i
< (GLuint
) count
; i
++) {
600 shProg
->TransformFeedback
.VaryingNames
[i
] = _mesa_strdup(varyings
[i
]);
602 shProg
->TransformFeedback
.NumVarying
= count
;
604 shProg
->TransformFeedback
.BufferMode
= bufferMode
;
606 /* The varyings won't be used until shader link time */
611 * Get info about the vertex shader's outputs which are to be written
612 * to the feedback buffer(s).
615 _mesa_GetTransformFeedbackVarying(GLuint program
, GLuint index
,
616 GLsizei bufSize
, GLsizei
*length
,
617 GLsizei
*size
, GLenum
*type
, GLchar
*name
)
619 const struct gl_shader_program
*shProg
;
620 const GLchar
*varyingName
;
622 GET_CURRENT_CONTEXT(ctx
);
624 shProg
= _mesa_lookup_shader_program(ctx
, program
);
626 _mesa_error(ctx
, GL_INVALID_VALUE
,
627 "glGetTransformFeedbackVaryings(program=%u)", program
);
631 if (index
>= shProg
->TransformFeedback
.NumVarying
) {
632 _mesa_error(ctx
, GL_INVALID_VALUE
,
633 "glGetTransformFeedbackVaryings(index=%u)", index
);
637 varyingName
= shProg
->TransformFeedback
.VaryingNames
[index
];
639 v
= _mesa_lookup_parameter_index(shProg
->Varying
, -1, varyingName
);
641 struct gl_program_parameter
*param
= &shProg
->Varying
->Parameters
[v
];
643 /* return the varying's name and length */
644 _mesa_copy_string(name
, bufSize
, length
, varyingName
);
646 /* return the datatype and value's size (in datatype units) */
648 *type
= param
->DataType
;
665 static struct gl_transform_feedback_object
*
666 lookup_transform_feedback_object(GLcontext
*ctx
, GLuint name
)
669 return ctx
->TransformFeedback
.DefaultObject
;
672 return (struct gl_transform_feedback_object
*)
673 _mesa_HashLookup(ctx
->TransformFeedback
.Objects
, name
);
678 * Create new transform feedback objects. Transform feedback objects
679 * encapsulate the state related to transform feedback to allow quickly
680 * switching state (and drawing the results, below).
681 * Part of GL_ARB_transform_feedback2.
684 _mesa_GenTransformFeedbacks(GLsizei n
, GLuint
*names
)
687 GET_CURRENT_CONTEXT(ctx
);
689 ASSERT_OUTSIDE_BEGIN_END(ctx
);
692 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenTransformFeedbacks(n < 0)");
699 /* we don't need contiguous IDs, but this might be faster */
700 first
= _mesa_HashFindFreeKeyBlock(ctx
->TransformFeedback
.Objects
, n
);
703 for (i
= 0; i
< n
; i
++) {
704 struct gl_transform_feedback_object
*obj
705 = ctx
->Driver
.NewTransformFeedback(ctx
, first
+ i
);
707 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glGenTransformFeedbacks");
710 names
[i
] = first
+ i
;
711 _mesa_HashInsert(ctx
->TransformFeedback
.Objects
, first
+ i
, obj
);
715 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glGenTransformFeedbacks");
721 * Is the given ID a transform feedback object?
722 * Part of GL_ARB_transform_feedback2.
725 _mesa_IsTransformFeedback(GLuint name
)
727 GET_CURRENT_CONTEXT(ctx
);
729 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
731 if (name
&& lookup_transform_feedback_object(ctx
, name
))
739 * Bind the given transform feedback object.
740 * Part of GL_ARB_transform_feedback2.
743 _mesa_BindTransformFeedback(GLenum target
, GLuint name
)
745 struct gl_transform_feedback_object
*obj
;
746 GET_CURRENT_CONTEXT(ctx
);
748 if (target
!= GL_TRANSFORM_FEEDBACK
) {
749 _mesa_error(ctx
, GL_INVALID_ENUM
, "glBindTransformFeedback(target)");
753 if (ctx
->TransformFeedback
.CurrentObject
->Active
&&
754 !ctx
->TransformFeedback
.CurrentObject
->Paused
) {
755 _mesa_error(ctx
, GL_INVALID_OPERATION
,
756 "glBindTransformFeedback(transform is active, or not paused)");
760 obj
= lookup_transform_feedback_object(ctx
, name
);
762 _mesa_error(ctx
, GL_INVALID_OPERATION
,
763 "glBindTransformFeedback(name=%u)", name
);
767 reference_transform_feedback_object(&ctx
->TransformFeedback
.CurrentObject
,
773 * Delete the given transform feedback objects.
774 * Part of GL_ARB_transform_feedback2.
777 _mesa_DeleteTransformFeedbacks(GLsizei n
, const GLuint
*names
)
780 GET_CURRENT_CONTEXT(ctx
);
782 ASSERT_OUTSIDE_BEGIN_END(ctx
);
785 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteTransformFeedbacks(n < 0)");
792 for (i
= 0; i
< n
; i
++) {
794 struct gl_transform_feedback_object
*obj
795 = lookup_transform_feedback_object(ctx
, names
[i
]);
798 _mesa_error(ctx
, GL_INVALID_OPERATION
,
799 "glDeleteTransformFeedbacks(object %u is active)",
803 _mesa_HashRemove(ctx
->TransformFeedback
.Objects
, names
[i
]);
804 /* unref, but object may not be deleted until later */
805 reference_transform_feedback_object(&obj
, NULL
);
813 * Pause transform feedback.
814 * Part of GL_ARB_transform_feedback2.
817 _mesa_PauseTransformFeedback(void)
819 struct gl_transform_feedback_object
*obj
;
820 GET_CURRENT_CONTEXT(ctx
);
822 obj
= ctx
->TransformFeedback
.CurrentObject
;
824 if (!obj
->Active
|| obj
->Paused
) {
825 _mesa_error(ctx
, GL_INVALID_OPERATION
,
826 "glPauseTransformFeedback(feedback not active or already paused)");
830 obj
->Paused
= GL_TRUE
;
832 assert(ctx
->Driver
.PauseTransformFeedback
);
833 ctx
->Driver
.PauseTransformFeedback(ctx
, obj
);
838 * Resume transform feedback.
839 * Part of GL_ARB_transform_feedback2.
842 _mesa_ResumeTransformFeedback(void)
844 struct gl_transform_feedback_object
*obj
;
845 GET_CURRENT_CONTEXT(ctx
);
847 obj
= ctx
->TransformFeedback
.CurrentObject
;
849 if (!obj
->Active
|| !obj
->Paused
) {
850 _mesa_error(ctx
, GL_INVALID_OPERATION
,
851 "glPauseTransformFeedback(feedback not active or not paused)");
855 obj
->Paused
= GL_FALSE
;
857 assert(ctx
->Driver
.ResumeTransformFeedback
);
858 ctx
->Driver
.ResumeTransformFeedback(ctx
, obj
);
863 * Draw the vertex data in a transform feedback object.
864 * \param mode GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
865 * \param name the transform feedback object
866 * The number of vertices comes from the transform feedback object.
867 * User still has to setup of the vertex attribute info with
868 * glVertexPointer, glColorPointer, etc.
869 * Part of GL_ARB_transform_feedback2.
872 _mesa_DrawTransformFeedback(GLenum mode
, GLuint name
)
874 GET_CURRENT_CONTEXT(ctx
);
875 struct gl_transform_feedback_object
*obj
=
876 lookup_transform_feedback_object(ctx
, name
);
878 if (mode
> GL_POLYGON
) {
879 _mesa_error(ctx
, GL_INVALID_ENUM
,
880 "glDrawTransformFeedback(mode=0x%x)", mode
);
884 _mesa_error(ctx
, GL_INVALID_VALUE
,
885 "glDrawTransformFeedback(name = %u)", name
);
889 /* XXX check if EndTransformFeedback has never been called while
890 * the object was bound
893 assert(ctx
->Driver
.DrawTransformFeedback
);
894 ctx
->Driver
.DrawTransformFeedback(ctx
, mode
, obj
);
903 GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED
904 GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE
905 GL_TRANSFORM_FEEDBACK_BINDING
909 #endif /* FEATURE_EXT_transform_feedback */