1 /**************************************************************************
3 * Copyright 2010 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Transform feedback functions.
36 #include "main/imports.h"
37 #include "main/context.h"
38 #include "main/transformfeedback.h"
40 #include "st_cb_xformfb.h"
43 #if FEATURE_EXT_transform_feedback
46 static struct gl_transform_feedback_object
*
47 st_new_transform_feedback(GLcontext
*ctx
, GLuint name
)
49 struct gl_transform_feedback_object
*obj
;
50 obj
= CALLOC_STRUCT(gl_transform_feedback_object
);
61 st_delete_transform_feedback(GLcontext
*ctx
,
62 struct gl_transform_feedback_object
*obj
)
66 for (i
= 0; i
< Elements(obj
->Buffers
); i
++) {
67 _mesa_reference_buffer_object(ctx
, &obj
->Buffers
[i
], NULL
);
76 st_begin_transform_feedback(GLcontext
*ctx
, GLenum mode
,
77 struct gl_transform_feedback_object
*obj
)
84 st_end_transform_feedback(GLcontext
*ctx
,
85 struct gl_transform_feedback_object
*obj
)
92 st_pause_transform_feedback(GLcontext
*ctx
,
93 struct gl_transform_feedback_object
*obj
)
100 st_resume_transform_feedback(GLcontext
*ctx
,
101 struct gl_transform_feedback_object
*obj
)
108 st_draw_transform_feedback(GLcontext
*ctx
, GLenum mode
,
109 struct gl_transform_feedback_object
*obj
)
113 * Get number of vertices in obj's feedback buffer.
114 * Call ctx->Exec.DrawArrays(mode, 0, count);
120 st_init_xformfb_functions(struct dd_function_table
*functions
)
122 /* let core Mesa plug in its functions */
123 _mesa_init_transform_feedback_functions(functions
);
125 /* then override a few: */
126 functions
->BeginTransformFeedback
= st_begin_transform_feedback
;
127 functions
->EndTransformFeedback
= st_end_transform_feedback
;
128 functions
->PauseTransformFeedback
= st_pause_transform_feedback
;
129 functions
->ResumeTransformFeedback
= st_resume_transform_feedback
;
130 functions
->DrawTransformFeedback
= st_draw_transform_feedback
;
133 #endif /* FEATURE_EXT_transform_feedback */