2 * Mesa 3-D graphics library
4 * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
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:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
26 #ifndef TRANSFORM_FEEDBACK_H
27 #define TRANSFORM_FEEDBACK_H
30 #include "bufferobj.h"
36 struct dd_function_table
;
40 _mesa_init_transform_feedback(struct gl_context
*ctx
);
43 _mesa_free_transform_feedback(struct gl_context
*ctx
);
46 _mesa_init_transform_feedback_functions(struct dd_function_table
*driver
);
49 _mesa_compute_max_transform_feedback_vertices( struct gl_context
*ctx
,
50 const struct gl_transform_feedback_object
*obj
,
51 const struct gl_transform_feedback_info
*info
);
54 /*** GL_EXT_transform_feedback ***/
57 _mesa_BeginTransformFeedback_no_error(GLenum mode
);
59 extern void GLAPIENTRY
60 _mesa_BeginTransformFeedback(GLenum mode
);
63 _mesa_EndTransformFeedback_no_error(void);
65 extern void GLAPIENTRY
66 _mesa_EndTransformFeedback(void);
69 _mesa_validate_buffer_range_xfb(struct gl_context
*ctx
,
70 struct gl_transform_feedback_object
*obj
,
71 GLuint index
, struct gl_buffer_object
*bufObj
,
72 GLintptr offset
, GLsizeiptr size
, bool dsa
);
75 _mesa_bind_buffer_base_transform_feedback(struct gl_context
*ctx
,
76 struct gl_transform_feedback_object
*obj
,
78 struct gl_buffer_object
*bufObj
,
82 _mesa_BindBufferOffsetEXT_no_error(GLenum target
, GLuint index
, GLuint buffer
,
85 extern void GLAPIENTRY
86 _mesa_BindBufferOffsetEXT(GLenum target
, GLuint index
, GLuint buffer
,
90 _mesa_TransformFeedbackVaryings_no_error(GLuint program
, GLsizei count
,
91 const GLchar
*const *varyings
,
94 extern void GLAPIENTRY
95 _mesa_TransformFeedbackVaryings(GLuint program
, GLsizei count
,
96 const GLchar
* const *varyings
,
99 extern void GLAPIENTRY
100 _mesa_GetTransformFeedbackVarying(GLuint program
, GLuint index
,
101 GLsizei bufSize
, GLsizei
*length
,
102 GLsizei
*size
, GLenum
*type
, GLchar
*name
);
106 /*** GL_ARB_transform_feedback2 ***/
108 _mesa_init_transform_feedback_object(struct gl_transform_feedback_object
*obj
,
112 _mesa_delete_transform_feedback_object(struct gl_context
*ctx
,
113 struct gl_transform_feedback_object
116 struct gl_transform_feedback_object
*
117 _mesa_lookup_transform_feedback_object(struct gl_context
*ctx
, GLuint name
);
119 extern void GLAPIENTRY
120 _mesa_GenTransformFeedbacks(GLsizei n
, GLuint
*names
);
122 extern void GLAPIENTRY
123 _mesa_CreateTransformFeedbacks(GLsizei n
, GLuint
*names
);
125 extern GLboolean GLAPIENTRY
126 _mesa_IsTransformFeedback(GLuint name
);
129 _mesa_BindTransformFeedback_no_error(GLenum target
, GLuint name
);
131 extern void GLAPIENTRY
132 _mesa_BindTransformFeedback(GLenum target
, GLuint name
);
134 extern void GLAPIENTRY
135 _mesa_DeleteTransformFeedbacks(GLsizei n
, const GLuint
*names
);
138 _mesa_PauseTransformFeedback_no_error(void);
140 extern void GLAPIENTRY
141 _mesa_PauseTransformFeedback(void);
144 _mesa_ResumeTransformFeedback_no_error(void);
146 extern void GLAPIENTRY
147 _mesa_ResumeTransformFeedback(void);
150 _mesa_is_xfb_active_and_unpaused(const struct gl_context
*ctx
)
152 return ctx
->TransformFeedback
.CurrentObject
->Active
&&
153 !ctx
->TransformFeedback
.CurrentObject
->Paused
;
157 _mesa_transform_feedback_is_using_program(struct gl_context
*ctx
,
158 struct gl_shader_program
*shProg
);
161 _mesa_set_transform_feedback_binding(struct gl_context
*ctx
,
162 struct gl_transform_feedback_object
*tfObj
, GLuint index
,
163 struct gl_buffer_object
*bufObj
,
164 GLintptr offset
, GLsizeiptr size
)
166 _mesa_reference_buffer_object(ctx
, &tfObj
->Buffers
[index
], bufObj
);
168 tfObj
->BufferNames
[index
] = bufObj
->Name
;
169 tfObj
->Offset
[index
] = offset
;
170 tfObj
->RequestedSize
[index
] = size
;
172 if (bufObj
!= ctx
->Shared
->NullBufferObj
)
173 bufObj
->UsageHistory
|= USAGE_TRANSFORM_FEEDBACK_BUFFER
;
177 _mesa_bind_buffer_range_xfb(struct gl_context
*ctx
,
178 struct gl_transform_feedback_object
*obj
,
179 GLuint index
, struct gl_buffer_object
*bufObj
,
180 GLintptr offset
, GLsizeiptr size
)
182 /* Note: no need to FLUSH_VERTICES or flag NewTransformFeedback, because
183 * transform feedback buffers can't be changed while transform feedback is
187 /* The general binding point */
188 _mesa_reference_buffer_object(ctx
,
189 &ctx
->TransformFeedback
.CurrentBuffer
,
192 /* The per-attribute binding point */
193 _mesa_set_transform_feedback_binding(ctx
, obj
, index
, bufObj
, offset
, size
);
196 /*** GL_ARB_direct_state_access ***/
198 extern void GLAPIENTRY
199 _mesa_TransformFeedbackBufferBase(GLuint xfb
, GLuint index
, GLuint buffer
);
201 extern void GLAPIENTRY
202 _mesa_TransformFeedbackBufferRange(GLuint xfb
, GLuint index
, GLuint buffer
,
203 GLintptr offset
, GLsizeiptr size
);
205 extern void GLAPIENTRY
206 _mesa_GetTransformFeedbackiv(GLuint xfb
, GLenum pname
, GLint
*param
);
208 extern void GLAPIENTRY
209 _mesa_GetTransformFeedbacki_v(GLuint xfb
, GLenum pname
, GLuint index
,
212 extern void GLAPIENTRY
213 _mesa_GetTransformFeedbacki64_v(GLuint xfb
, GLenum pname
, GLuint index
,
216 #endif /* TRANSFORM_FEEDBACK_H */