e415b186aa73369fe373c71e74a9e52a9186ac4f
[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/mfeatures.h"
39 #include "main/transformfeedback.h"
40
41 #include "st_cb_xformfb.h"
42
43
44 #if FEATURE_EXT_transform_feedback
45
46 #if 0
47 static struct gl_transform_feedback_object *
48 st_new_transform_feedback(struct gl_context *ctx, GLuint name)
49 {
50 struct gl_transform_feedback_object *obj;
51 obj = CALLOC_STRUCT(gl_transform_feedback_object);
52 if (obj) {
53 obj->Name = name;
54 obj->RefCount = 1;
55 }
56 return obj;
57 }
58 #endif
59
60 #if 0
61 static void
62 st_delete_transform_feedback(struct gl_context *ctx,
63 struct gl_transform_feedback_object *obj)
64 {
65 GLuint i;
66
67 for (i = 0; i < Elements(obj->Buffers); i++) {
68 _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL);
69 }
70
71 free(obj);
72 }
73 #endif
74
75
76 static void
77 st_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
78 struct gl_transform_feedback_object *obj)
79 {
80 /* to-do */
81 }
82
83
84 static void
85 st_end_transform_feedback(struct gl_context *ctx,
86 struct gl_transform_feedback_object *obj)
87 {
88 /* to-do */
89 }
90
91
92 static void
93 st_pause_transform_feedback(struct gl_context *ctx,
94 struct gl_transform_feedback_object *obj)
95 {
96 /* to-do */
97 }
98
99
100 static void
101 st_resume_transform_feedback(struct gl_context *ctx,
102 struct gl_transform_feedback_object *obj)
103 {
104 /* to-do */
105 }
106
107
108 static void
109 st_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
110 struct gl_transform_feedback_object *obj)
111 {
112 /* XXX to do */
113 /*
114 * Get number of vertices in obj's feedback buffer.
115 * Call ctx->Exec.DrawArrays(mode, 0, count);
116 */
117 }
118
119
120 void
121 st_init_xformfb_functions(struct dd_function_table *functions)
122 {
123 /* let core Mesa plug in its functions */
124 _mesa_init_transform_feedback_functions(functions);
125
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;
132 }
133
134 #endif /* FEATURE_EXT_transform_feedback */