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>
This commit is contained in:
@@ -239,7 +239,8 @@ update_single_texture(struct st_context *st,
|
||||
st_mesa_format_to_pipe_format(stObj->base._BufferObjectFormat);
|
||||
}
|
||||
else {
|
||||
view_format = stObj->pt->format;
|
||||
view_format =
|
||||
stObj->surface_based ? stObj->surface_format : stObj->pt->format;
|
||||
|
||||
/* If sRGB decoding is off, use the linear format */
|
||||
if (samp->sRGBDecode == GL_SKIP_DECODE_EXT) {
|
||||
|
Reference in New Issue
Block a user