mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
meta: Don't leave the VBO bound after _mesa_meta_setup_vertex_objects
Meta currently does this, but future changes will make this impossible.
Explicitly do it as a step in the patch series now to catch any possible
kinks.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 3b5a7d450d)
This commit is contained in:
parent
bf3f0b9e9b
commit
4a5c29d877
5 changed files with 38 additions and 21 deletions
|
|
@ -310,9 +310,9 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
|
|||
/**
|
||||
* 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.
|
||||
|
|
@ -333,7 +333,8 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
|
|||
* 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)
|
||||
|
|
@ -381,9 +382,18 @@ _mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
|
|||
_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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1490,10 +1500,11 @@ _mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
@ -1538,7 +1549,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
|
|||
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;
|
||||
|
|
@ -1734,7 +1746,8 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
|
|||
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;
|
||||
|
|
@ -1863,7 +1876,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
|
|||
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. */
|
||||
|
|
@ -2184,7 +2197,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
|
|||
|
||||
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. */
|
||||
|
|
@ -2376,7 +2389,8 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
|
|||
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);
|
||||
|
||||
|
|
@ -3077,12 +3091,12 @@ decompress_texture_image(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -620,13 +620,15 @@ struct temp_texture *
|
|||
_mesa_meta_get_temp_depth_texture(struct gl_context *ctx);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
|
|||
|
||||
texcoord_size = 2 + (src_rb->Depth > 1 ? 1 : 0);
|
||||
|
||||
_mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true,
|
||||
_mesa_meta_setup_vertex_objects(ctx, &blit->VAO, &blit->VBO, true,
|
||||
2, texcoord_size, 0);
|
||||
|
||||
if (is_target_multisample && is_filter_scaled_resolve && is_scaled_blit) {
|
||||
|
|
@ -691,7 +691,8 @@ blitframebuffer_texture(struct gl_context *ctx,
|
|||
do_depth);
|
||||
}
|
||||
else {
|
||||
_mesa_meta_setup_ff_tnl_for_blit(&ctx->Meta->Blit.VAO,
|
||||
_mesa_meta_setup_ff_tnl_for_blit(ctx,
|
||||
&ctx->Meta->Blit.VAO,
|
||||
&ctx->Meta->Blit.VBO,
|
||||
2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,11 +196,11 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
|
|||
* GenerateMipmap function.
|
||||
*/
|
||||
if (use_glsl_version) {
|
||||
_mesa_meta_setup_vertex_objects(&mipmap->VAO, &mipmap->VBO, true,
|
||||
_mesa_meta_setup_vertex_objects(ctx, &mipmap->VAO, &mipmap->VBO, true,
|
||||
2, 4, 0);
|
||||
_mesa_meta_setup_blit_shader(ctx, target, false, &mipmap->shaders);
|
||||
} else {
|
||||
_mesa_meta_setup_ff_tnl_for_blit(&mipmap->VAO, &mipmap->VBO, 3);
|
||||
_mesa_meta_setup_ff_tnl_for_blit(ctx, &mipmap->VAO, &mipmap->VBO, 3);
|
||||
_mesa_set_enable(ctx, target, GL_TRUE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ setup_program(struct brw_context *brw, bool msaa_tex)
|
|||
char *fs_source;
|
||||
const struct sampler_and_fetch *sampler = &samplers[msaa_tex];
|
||||
|
||||
_mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
|
||||
_mesa_meta_setup_vertex_objects(ctx, &blit->VAO, &blit->VBO, true, 2, 2, 0);
|
||||
|
||||
GLuint *prog_id = &brw->meta_stencil_blit_programs[msaa_tex];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue