On Mon, Nov 9, 2015 at 4:56 PM, Ian Romanick <i...@freedesktop.org> wrote: > From: Ian Romanick <ian.d.roman...@intel.com> > > 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.roman...@intel.com> > --- > src/mesa/drivers/common/meta.c | 42 > +++++++++++++++-------- > src/mesa/drivers/common/meta.h | 6 ++-- > src/mesa/drivers/common/meta_blit.c | 5 +-- > src/mesa/drivers/common/meta_generate_mipmap.c | 4 +-- > src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 2 +- > 5 files changed, 38 insertions(+), 21 deletions(-) > > diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c > index 270933f..8b9bccc 100644 > --- a/src/mesa/drivers/common/meta.c > +++ b/src/mesa/drivers/common/meta.c > @@ -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); > } > } > > @@ -1479,10 +1489,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); > @@ -1527,7 +1538,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; > @@ -1723,7 +1735,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; > @@ -1852,7 +1865,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. */ > @@ -2173,7 +2186,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. */ > @@ -2365,7 +2378,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); > > @@ -3066,12 +3080,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) { > diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h > index 23fa209..0d3bf78 100644 > --- a/src/mesa/drivers/common/meta.h > +++ b/src/mesa/drivers/common/meta.h > @@ -617,13 +617,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 > diff --git a/src/mesa/drivers/common/meta_blit.c > b/src/mesa/drivers/common/meta_blit.c > index 1d661b5..fafe312 100644 > --- a/src/mesa/drivers/common/meta_blit.c > +++ b/src/mesa/drivers/common/meta_blit.c > @@ -533,7 +533,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) { > @@ -659,7 +659,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); > } > diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c > b/src/mesa/drivers/common/meta_generate_mipmap.c > index bee38e4..41feb48 100644 > --- a/src/mesa/drivers/common/meta_generate_mipmap.c > +++ b/src/mesa/drivers/common/meta_generate_mipmap.c > @@ -189,11 +189,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); > } > > diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c > b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c > index 62ae4e7..ddb6826 100644 > --- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c > +++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c > @@ -279,7 +279,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]; > > -- > 2.1.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev