mesa: Validate the drawing primitive against the transform feedback mode.
[mesa.git] / src / mesa / main / transformfeedback.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2010 VMware, Inc. 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 "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24
25 #ifndef TRANSFORM_FEEDBACK_H
26 #define TRANSFORM_FEEDBACK_H
27
28 #include "compiler.h"
29 #include "glheader.h"
30 #include "mfeatures.h"
31
32 struct _glapi_table;
33 struct dd_function_table;
34 struct gl_context;
35
36 extern void
37 _mesa_init_transform_feedback(struct gl_context *ctx);
38
39 extern void
40 _mesa_free_transform_feedback(struct gl_context *ctx);
41
42 #if FEATURE_EXT_transform_feedback
43
44 extern GLboolean
45 _mesa_validate_transform_feedback_buffers(struct gl_context *ctx);
46
47
48 extern void
49 _mesa_init_transform_feedback_functions(struct dd_function_table *driver);
50
51 extern void
52 _mesa_init_transform_feedback_dispatch(struct _glapi_table *disp);
53
54
55 /*** GL_EXT_transform_feedback ***/
56
57 extern void GLAPIENTRY
58 _mesa_BeginTransformFeedback(GLenum mode);
59
60 extern void GLAPIENTRY
61 _mesa_EndTransformFeedback(void);
62
63 extern void GLAPIENTRY
64 _mesa_BindBufferRange(GLenum target, GLuint index,
65 GLuint buffer, GLintptr offset, GLsizeiptr size);
66
67 extern void GLAPIENTRY
68 _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer);
69
70 extern void GLAPIENTRY
71 _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
72 GLintptr offset);
73
74 extern void GLAPIENTRY
75 _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count,
76 const GLchar **varyings, GLenum bufferMode);
77
78 extern void GLAPIENTRY
79 _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index,
80 GLsizei bufSize, GLsizei *length,
81 GLsizei *size, GLenum *type, GLchar *name);
82
83
84
85 /*** GL_ARB_transform_feedback2 ***/
86
87 struct gl_transform_feedback_object *
88 _mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name);
89
90 extern void GLAPIENTRY
91 _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names);
92
93 extern GLboolean GLAPIENTRY
94 _mesa_IsTransformFeedback(GLuint name);
95
96 extern void GLAPIENTRY
97 _mesa_BindTransformFeedback(GLenum target, GLuint name);
98
99 extern void GLAPIENTRY
100 _mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names);
101
102 extern void GLAPIENTRY
103 _mesa_PauseTransformFeedback(void);
104
105 extern void GLAPIENTRY
106 _mesa_ResumeTransformFeedback(void);
107
108 #else /* FEATURE_EXT_transform_feedback */
109
110 static inline GLboolean
111 _mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode)
112 {
113 return GL_TRUE;
114 }
115
116 static inline GLboolean
117 _mesa_validate_transform_feedback_buffers(struct gl_context *ctx)
118 {
119 return GL_TRUE;
120 }
121
122 static inline void
123 _mesa_init_transform_feedback_functions(struct dd_function_table *driver)
124 {
125 }
126
127 static inline void
128 _mesa_init_transform_feedback_dispatch(struct _glapi_table *disp)
129 {
130 }
131
132 #endif /* FEATURE_EXT_transform_feedback */
133
134 #endif /* TRANSFORM_FEEDBACK_H */