summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2015-02-24 13:29:11 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2015-02-27 23:02:01 +0000
commit9e5af14163d5c4a782356c2b4787b2d5091ce5d3 (patch)
tree4f33857d70816333a67a420f1d950430b8dd7bea /src
parented7272ade9ef2f7a1327077876e93130a48f8735 (diff)
common: Correct texture init for meta pbo uploads and downloads.
This moves the line setting immutability for the texture to after _mesa_initialize_texture_object so that the initializer function will not cancel it out. Moreover, because of the ARB_texture_view extension, immutable textures must have NumLayers > 0, or depth will equal (0-1)=0xFFFFFFFF during SURFACE_STATE setup, which triggers assertions. v2: Review from Kenneth Graunke: - Include more explanation in the commit message. - Make texture setup bug fixes into a separate patch. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 06084652fefe49c3d6bf1b476ff74ff602fdc22a)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/meta_tex_subimage.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c
index 68c8273fe4f..2d2b9d86b24 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -100,8 +100,11 @@ create_texture_for_pbo(struct gl_context *ctx, bool create_pbo,
_mesa_GenTextures(1, tmp_tex);
tex_obj = _mesa_lookup_texture(ctx, *tmp_tex);
tex_obj->Target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
- tex_obj->Immutable = GL_TRUE;
_mesa_initialize_texture_object(ctx, tex_obj, *tmp_tex, GL_TEXTURE_2D);
+ /* This must be set after _mesa_initialize_texture_object, not before. */
+ tex_obj->Immutable = GL_TRUE;
+ /* This is required for interactions with ARB_texture_view. */
+ tex_obj->NumLayers = 1;
internal_format = _mesa_get_format_base_format(pbo_format);