mesa: more transform feedback infrastructure
[mesa.git] / src / mesa / state_tracker / st_cb_xformfb.c
1 /**************************************************************************
2 *
3 * Copyright 2010 VMware, Inc.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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.
25 *
26 **************************************************************************/
27
28
29 /**
30 * Transform feedback functions.
31 *
32 * \author Brian Paul
33 */
34
35
36 #include "main/imports.h"
37 #include "main/context.h"
38 #include "main/transformfeedback.h"
39
40 #include "st_cb_xformfb.h"
41
42
43 #if 0
44 static struct gl_transform_feedback_object *
45 st_new_transform_feedback(GLcontext *ctx, GLuint name)
46 {
47 struct gl_transform_feedback_object *obj;
48 obj = CALLOC_STRUCT(gl_transform_feedback_object);
49 if (obj) {
50 obj->Name = name;
51 obj->RefCount = 1;
52 }
53 return obj;
54 }
55 #endif
56
57 #if 0
58 static void
59 st_delete_transform_feedback(GLcontext *ctx,
60 struct gl_transform_feedback_object *obj)
61 {
62 GLuint i;
63
64 for (i = 0; i < Elements(obj->Buffers); i++) {
65 _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL);
66 }
67
68 free(obj);
69 }
70 #endif
71
72
73 static void
74 st_begin_transform_feedback(GLcontext *ctx, GLenum mode,
75 struct gl_transform_feedback_object *obj)
76 {
77 /* to-do */
78 }
79
80
81 static void
82 st_end_transform_feedback(GLcontext *ctx,
83 struct gl_transform_feedback_object *obj)
84 {
85 /* to-do */
86 }
87
88
89 static void
90 st_pause_transform_feedback(GLcontext *ctx,
91 struct gl_transform_feedback_object *obj)
92 {
93 /* to-do */
94 }
95
96
97 static void
98 st_resume_transform_feedback(GLcontext *ctx,
99 struct gl_transform_feedback_object *obj)
100 {
101 /* to-do */
102 }
103
104
105 static void
106 st_draw_transform_feedback(GLcontext *ctx, GLenum mode,
107 struct gl_transform_feedback_object *obj)
108 {
109 /* XXX to do */
110 /*
111 * Get number of vertices in obj's feedback buffer.
112 * Call ctx->Exec.DrawArrays(mode, 0, count);
113 */
114 }
115
116
117 void
118 st_init_xformfb_functions(struct dd_function_table *functions)
119 {
120 /* let core Mesa plug in its functions */
121 _mesa_init_transform_feedback_functions(functions);
122
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;
129 }