/**
* Configure vertex buffer and vertex array objects for tests
*
- * Regardless of whether a new VAO and new VBO are created, the objects
- * referenced by \c VAO and \c VBO will be bound into the GL state vector
- * when this function terminates.
+ * Regardless of whether a new VAO is created, the object referenced by \c VAO
+ * will be bound into the GL state vector when this function terminates. The
+ * object referenced by \c VBO will \b not be bound.
*
* \param VAO Storage for vertex array object handle. If 0, a new VAO
* will be created.
* Use \c texcoord_size instead.
*/
void
-_mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
+_mesa_meta_setup_vertex_objects(struct gl_context *ctx,
+ GLuint *VAO, GLuint *VBO,
bool use_generic_attributes,
unsigned vertex_size, unsigned texcoord_size,
unsigned color_size)
_mesa_EnableClientState(GL_COLOR_ARRAY);
}
}
+
+ /* Restore the old VBO. This is done because we don't want the new VBO
+ * to be bound on exit. It would be nicer to use DSA type functions,
+ * but there are no DSA functions to bind a VBO to a VAO for
+ * fixed-function vertex attributes.
+ */
+ {
+ struct save_state *save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth - 1];
+ _mesa_BindBuffer(GL_ARRAY_BUFFER, save->ArrayBufferObj->Name);
+ }
} else {
_mesa_BindVertexArray(*VAO);
- _mesa_BindBuffer(GL_ARRAY_BUFFER, *VBO);
}
}
}
void
-_mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO,
+_mesa_meta_setup_ff_tnl_for_blit(struct gl_context *ctx,
+ GLuint *VAO, GLuint *VBO,
unsigned texcoord_size)
{
- _mesa_meta_setup_vertex_objects(VAO, VBO, false, 2, texcoord_size, 0);
+ _mesa_meta_setup_vertex_objects(ctx, VAO, VBO, false, 2, texcoord_size, 0);
/* setup projection matrix */
_mesa_MatrixMode(GL_PROJECTION);
GLuint vs, fs;
bool has_integer_textures;
- _mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, true, 3, 0, 0);
+ _mesa_meta_setup_vertex_objects(ctx, &clear->VAO, &clear->VBO, true,
+ 3, 0, 0);
if (clear->ShaderProg != 0)
return;
y1 = ((float) fb->_Ymax / fb->Height) * 2.0f - 1.0f;
z = -invert_z(ctx->Depth.Clear);
} else {
- _mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, false, 3, 0, 4);
+ _mesa_meta_setup_vertex_objects(ctx, &clear->VAO, &clear->VBO, false,
+ 3, 0, 4);
x0 = (float) fb->_Xmin;
y0 = (float) fb->_Ymin;
MESA_META_VERTEX |
MESA_META_VIEWPORT));
- _mesa_meta_setup_vertex_objects(©pix->VAO, ©pix->VBO, false,
+ _mesa_meta_setup_vertex_objects(ctx, ©pix->VAO, ©pix->VBO, false,
3, 2, 0);
/* Silence valgrind warnings about reading uninitialized stack. */
newTex = _mesa_meta_alloc_texture(tex, width, height, texIntFormat);
- _mesa_meta_setup_vertex_objects(&drawpix->VAO, &drawpix->VBO, false,
+ _mesa_meta_setup_vertex_objects(ctx, &drawpix->VAO, &drawpix->VBO, false,
3, 2, 0);
/* Silence valgrind warnings about reading uninitialized stack. */
MESA_META_VERTEX |
MESA_META_VIEWPORT));
- _mesa_meta_setup_vertex_objects(&bitmap->VAO, &bitmap->VBO, false, 3, 2, 4);
+ _mesa_meta_setup_vertex_objects(ctx, &bitmap->VAO, &bitmap->VBO, false,
+ 3, 2, 4);
newTex = _mesa_meta_alloc_texture(tex, width, height, texIntFormat);
}
if (use_glsl_version) {
- _mesa_meta_setup_vertex_objects(&decompress->VAO, &decompress->VBO, true,
+ _mesa_meta_setup_vertex_objects(ctx, &decompress->VAO, &decompress->VBO, true,
2, 4, 0);
_mesa_meta_setup_blit_shader(ctx, target, false, &decompress->shaders);
} else {
- _mesa_meta_setup_ff_tnl_for_blit(&decompress->VAO, &decompress->VBO, 3);
+ _mesa_meta_setup_ff_tnl_for_blit(ctx, &decompress->VAO, &decompress->VBO, 3);
}
if (!decompress->Sampler) {