tfeedback_decl *tfeedback_decls)
{
unsigned total_tfeedback_components = 0;
+ bool separate_attribs_mode =
+ prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS;
memset(&prog->LinkedTransformFeedback, 0,
sizeof(prog->LinkedTransformFeedback));
+ prog->LinkedTransformFeedback.NumBuffers =
+ separate_attribs_mode ? num_tfeedback_decls : 1;
for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
- unsigned buffer =
- prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS ? i : 0;
+ unsigned buffer = separate_attribs_mode ? i : 0;
if (!tfeedback_decls[i].store(prog, &prog->LinkedTransformFeedback,
buffer))
return false;
struct gl_transform_feedback_info {
unsigned NumOutputs;
+ /**
+ * Number of transform feedback buffers in use by this program.
+ */
+ unsigned NumBuffers;
+
struct {
unsigned OutputRegister;
unsigned OutputBuffer;
_mesa_BeginTransformFeedback(GLenum mode)
{
struct gl_transform_feedback_object *obj;
+ struct gl_transform_feedback_info *info;
+ int i;
GET_CURRENT_CONTEXT(ctx);
obj = ctx->TransformFeedback.CurrentObject;
+ info = &ctx->Shader.CurrentVertexProgram->LinkedTransformFeedback;
switch (mode) {
case GL_POINTS:
return;
}
+ for (i = 0; i < info->NumBuffers; ++i) {
+ if (obj->BufferNames[i] == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(binding point %d does not have "
+ "a buffer object bound)", i);
+ return;
+ }
+ }
+
FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
obj->Active = GL_TRUE;
ctx->TransformFeedback.Mode = mode;