From 639d0f73c137a76ae76501da4e09cdd0e33d4c37 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 10 May 2013 02:03:15 +0200 Subject: st/mesa: handle texture_from_pixmap and other surface-based textures correctly There were 2 issues with it: 1) The texture format which should be used for texturing was only set in gl_texture_image::TexFormat, which wasn't used for sampler views. 2) Textures are sometimes reallocated under some circumstances in st_finalize_texture, which is unacceptable if the texture comes from a window system. The issues are resolved as follows: 1) If surface_based is true (texture_from_pixmap, etc.), store the format in a new variable st_texture_object::surface_format. 2) Don't reallocate a surface-based texture in st_finalize_texture. Also don't use st_ChooseTextureFormat is st_context_teximage, because the format is dictated by the caller. This fixes the glx-tfp piglit test. Reviewed-by: Adam Jackson --- src/mesa/state_tracker/st_texture.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/mesa/state_tracker/st_texture.h') diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index da899c90d41..c15aeaea685 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -87,10 +87,16 @@ struct st_texture_object */ struct pipe_sampler_view *sampler_view; - /* True if there is/was a surface bound to this texture object. It helps - * track whether the texture object is surface based or not. + /* True if this texture comes from the window system. Such a texture + * cannot be reallocated and the format can only be changed with a sampler + * view or a surface. */ GLboolean surface_based; + + /* If surface_based is true, this format should be used for all sampler + * views and surfaces instead of pt->format. + */ + enum pipe_format surface_format; }; -- cgit v1.2.3