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/mfeatures.h"
39 #include "main/transformfeedback.h"
41 #include "st_cb_xformfb.h"
44 #if FEATURE_EXT_transform_feedback
47 static struct gl_transform_feedback_object
*
48 st_new_transform_feedback(struct gl_context
*ctx
, GLuint name
)
50 struct gl_transform_feedback_object
*obj
;
51 obj
= CALLOC_STRUCT(gl_transform_feedback_object
);
62 st_delete_transform_feedback(struct gl_context
*ctx
,
63 struct gl_transform_feedback_object
*obj
)
67 for (i
= 0; i
< Elements(obj
->Buffers
); i
++) {
68 _mesa_reference_buffer_object(ctx
, &obj
->Buffers
[i
], NULL
);
77 st_begin_transform_feedback(struct gl_context
*ctx
, GLenum mode
,
78 struct gl_transform_feedback_object
*obj
)
85 st_end_transform_feedback(struct gl_context
*ctx
,
86 struct gl_transform_feedback_object
*obj
)
93 st_pause_transform_feedback(struct gl_context
*ctx
,
94 struct gl_transform_feedback_object
*obj
)
101 st_resume_transform_feedback(struct gl_context
*ctx
,
102 struct gl_transform_feedback_object
*obj
)
109 st_draw_transform_feedback(struct gl_context
*ctx
, GLenum mode
,
110 struct gl_transform_feedback_object
*obj
)
114 * Get number of vertices in obj's feedback buffer.
115 * Call ctx->Exec.DrawArrays(mode, 0, count);
121 st_init_xformfb_functions(struct dd_function_table
*functions
)
123 /* let core Mesa plug in its functions */
124 _mesa_init_transform_feedback_functions(functions
);
126 /* then override a few: */
127 functions
->BeginTransformFeedback
= st_begin_transform_feedback
;
128 functions
->EndTransformFeedback
= st_end_transform_feedback
;
129 functions
->PauseTransformFeedback
= st_pause_transform_feedback
;
130 functions
->ResumeTransformFeedback
= st_resume_transform_feedback
;
131 functions
->DrawTransformFeedback
= st_draw_transform_feedback
;
134 #endif /* FEATURE_EXT_transform_feedback */