[Mesa-dev] [PATCH] mesa/main: clean only first LOD when the texture is rectangular or extern
Gert Wollny
gert.wollny at collabora.com
Thu Jul 5 13:05:16 UTC 2018
Rectangular and extern textures don't support mip-maps, but when
a texture allocation fails, then clear_texture_fields tried to clean all
LOSs, which would fire an assertion further down the call chain in
set_tex_image. Therefore, restrict the number of LODs to be cleaned
to just level 0 for these textures.
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
src/mesa/main/texstorage.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 9cb8b90065..ea21dfe421 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -182,10 +182,13 @@ clear_texture_fields(struct gl_context *ctx,
{
const GLenum target = texObj->Target;
const GLuint numFaces = _mesa_num_tex_faces(target);
+ const GLint numLevels = (target != GL_TEXTURE_RECTANGLE_NV &&
+ target != GL_TEXTURE_EXTERNAL_OES) ?
+ ARRAY_SIZE(texObj->Image[0]) : 1;
GLint level;
GLuint face;
- for (level = 0; level < ARRAY_SIZE(texObj->Image[0]); level++) {
+ for (level = 0; level < numLevels; level++) {
for (face = 0; face < numFaces; face++) {
struct gl_texture_image *texImage =
get_tex_image(ctx, texObj, face, level);
--
2.16.4
More information about the mesa-dev
mailing list