Module: Mesa
Branch: main
Commit: 5a39938b0004de36ac556b646071425fbe6a504c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a39938b0004de36ac556b646071425fbe6a504c

Author: Emma Anholt <[email protected]>
Date:   Sat Sep 18 13:48:41 2021 -0700

mesa: Throw an error for compressed glGenerateMipmap on GLES2 contexts.

This error is gone from GLES3.

Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Andreas Baierl <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12924>

---

 src/broadcom/ci/deqp-vc4-rpi3-fails.txt             |  1 -
 src/etnaviv/ci/deqp-etnaviv-gc2000-fails.txt        |  1 -
 src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt |  5 -----
 src/gallium/drivers/lima/ci/deqp-lima-fails.txt     |  1 -
 src/mesa/main/genmipmap.c                           | 13 +++++++++++++
 5 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/broadcom/ci/deqp-vc4-rpi3-fails.txt 
b/src/broadcom/ci/deqp-vc4-rpi3-fails.txt
index d0722563e60..6ffe0258092 100644
--- a/src/broadcom/ci/deqp-vc4-rpi3-fails.txt
+++ b/src/broadcom/ci/deqp-vc4-rpi3-fails.txt
@@ -404,7 +404,6 @@ 
dEQP-GLES2.functional.draw.draw_arrays.line_loop.single_attribute,Fail
 dEQP-GLES2.functional.fbo.render.texsubimage.after_render_tex2d_rgba,Fail
 dEQP-GLES2.functional.fbo.render.texsubimage.between_render_tex2d_rgba,Fail
 
dEQP-GLES2.functional.negative_api.shader.uniform_matrixfv_invalid_transpose,Fail
-dEQP-GLES2.functional.negative_api.texture.generatemipmap_zero_level_array_compressed,Fail
 dEQP-GLES2.functional.negative_api.vertex_array.vertex_attrib,Fail
 dEQP-GLES2.functional.negative_api.vertex_array.vertex_attribv,Fail
 
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_linear_linear_mirror_rgba8888,Fail
diff --git a/src/etnaviv/ci/deqp-etnaviv-gc2000-fails.txt 
b/src/etnaviv/ci/deqp-etnaviv-gc2000-fails.txt
index a2ee2012c45..80186be0078 100644
--- a/src/etnaviv/ci/deqp-etnaviv-gc2000-fails.txt
+++ b/src/etnaviv/ci/deqp-etnaviv-gc2000-fails.txt
@@ -138,7 +138,6 @@ dEQP-GLES2.functional.fragment_ops.random.96,Fail
 dEQP-GLES2.functional.fragment_ops.random.97,Fail
 dEQP-GLES2.functional.fragment_ops.random.98,Fail
 
dEQP-GLES2.functional.negative_api.shader.uniform_matrixfv_invalid_transpose,Fail
-dEQP-GLES2.functional.negative_api.texture.generatemipmap_zero_level_array_compressed,Fail
 dEQP-GLES2.functional.rasterization.limits.points,Fail
 
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec3_const_write_dynamic_read_fragment,Fail
 
dEQP-GLES2.functional.shaders.indexing.tmp_array.vec3_const_write_dynamic_read_vertex,Fail
diff --git a/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt 
b/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt
index 52277428cbc..58e0f4b2b98 100644
--- a/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt
+++ b/src/gallium/drivers/i915/ci/deqp-i915-g33-fails.txt
@@ -29,11 +29,6 @@ 
dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_corner,Fail
 # Mesa: User error: GL_INVALID_OPERATION in glUniformMatrix(non-matrix uniform)
 
dEQP-GLES2.functional.negative_api.shader.uniform_matrixfv_invalid_transpose,Fail
 
-# "GL_INVALID_OPERATION is generated if the zero level array is stored in a 
compressed internal format.
-#   // GL_NO_ERROR returned
-#   // ERROR: expected GL_INVALID_OPERATION"
-dEQP-GLES2.functional.negative_api.texture.generatemipmap_zero_level_array_compressed,Fail
-
 # Maybe doesn't like the color interpolation in wide lines?
 dEQP-GLES2.functional.rasterization.interpolation.basic.line_loop_wide,Fail
 dEQP-GLES2.functional.rasterization.interpolation.basic.line_strip_wide,Fail
diff --git a/src/gallium/drivers/lima/ci/deqp-lima-fails.txt 
b/src/gallium/drivers/lima/ci/deqp-lima-fails.txt
index 680b8f247fd..161b760617c 100644
--- a/src/gallium/drivers/lima/ci/deqp-lima-fails.txt
+++ b/src/gallium/drivers/lima/ci/deqp-lima-fails.txt
@@ -31,7 +31,6 @@ dEQP-GLES2.functional.fragment_ops.depth_stencil.random.8,Fail
 dEQP-GLES2.functional.fragment_ops.depth_stencil.random.9,Fail
 dEQP-GLES2.functional.fragment_ops.depth_stencil.write_mask.stencil,Fail
 
dEQP-GLES2.functional.negative_api.shader.uniform_matrixfv_invalid_transpose,Fail
-dEQP-GLES2.functional.negative_api.texture.generatemipmap_zero_level_array_compressed,Fail
 dEQP-GLES2.functional.shaders.builtin_variable.frontfacing,Fail
 
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_dynamic_loop_read_vertex,Fail
 
dEQP-GLES2.functional.shaders.indexing.matrix_subscript.mat4_dynamic_loop_write_dynamic_read_vertex,Fail
diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index 2593dbb10bd..8bf3b1ad568 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -150,6 +150,19 @@ generate_texture_mipmap(struct gl_context *ctx,
                      _mesa_enum_to_string(srcImage->InternalFormat));
          return;
       }
+
+      /* The GLES 2.0 spec says:
+       *
+       *    "If the level zero array is stored in a compressed internal format,
+       *     the error INVALID_OPERATION is generated."
+       *
+       * and this text is gone from the GLES 3.0 spec.
+       */
+      if (ctx->API == API_OPENGLES2 && ctx->Version < 30 &&
+          _mesa_is_format_compressed(srcImage->TexFormat)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION, "generate mipmaps on 
compressed texture");
+         return;
+      }
    }
 
    if (srcImage->Width == 0 || srcImage->Height == 0) {

Reply via email to