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