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"
44 static struct gl_transform_feedback_object
*
45 st_new_transform_feedback(GLcontext
*ctx
, GLuint name
)
47 struct gl_transform_feedback_object
*obj
;
48 obj
= CALLOC_STRUCT(gl_transform_feedback_object
);
59 st_delete_transform_feedback(GLcontext
*ctx
,
60 struct gl_transform_feedback_object
*obj
)
64 for (i
= 0; i
< Elements(obj
->Buffers
); i
++) {
65 _mesa_reference_buffer_object(ctx
, &obj
->Buffers
[i
], NULL
);
74 st_begin_transform_feedback(GLcontext
*ctx
, GLenum mode
,
75 struct gl_transform_feedback_object
*obj
)
82 st_end_transform_feedback(GLcontext
*ctx
,
83 struct gl_transform_feedback_object
*obj
)
90 st_pause_transform_feedback(GLcontext
*ctx
,
91 struct gl_transform_feedback_object
*obj
)
98 st_resume_transform_feedback(GLcontext
*ctx
,
99 struct gl_transform_feedback_object
*obj
)
106 st_draw_transform_feedback(GLcontext
*ctx
, GLenum mode
,
107 struct gl_transform_feedback_object
*obj
)
111 * Get number of vertices in obj's feedback buffer.
112 * Call ctx->Exec.DrawArrays(mode, 0, count);
118 st_init_xformfb_functions(struct dd_function_table
*functions
)
120 /* let core Mesa plug in its functions */
121 _mesa_init_transform_feedback_functions(functions
);
123 /* then override a few: */
124 functions
->BeginTransformFeedback
= st_begin_transform_feedback
;
125 functions
->EndTransformFeedback
= st_end_transform_feedback
;
126 functions
->PauseTransformFeedback
= st_pause_transform_feedback
;
127 functions
->ResumeTransformFeedback
= st_resume_transform_feedback
;
128 functions
->DrawTransformFeedback
= st_draw_transform_feedback
;