st/mesa: handle texture_from_pixmap and other surface-based textures correctly
authorMarek Olšák <maraeo@gmail.com>
Fri, 10 May 2013 00:03:15 +0000 (02:03 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 15 May 2013 18:22:48 +0000 (20:22 +0200)
commit639d0f73c137a76ae76501da4e09cdd0e33d4c37
tree7130a53dc90ae864bb3f9a504fbbbd9441766b4d
parent5a3fac4d2667b5d46058564151142fec158f5f82
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 <ajax@redhat.com>
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_eglimage.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_format.c
src/mesa/state_tracker/st_format.h
src/mesa/state_tracker/st_manager.c
src/mesa/state_tracker/st_texture.h