summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/genmipmap.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2016-03-15 00:41:16 -0700
committerKenneth Graunke <kenneth@whitecape.org>2016-03-18 18:43:47 -0700
commit46610238e0a8db47c293f75ad8d667747d6256af (patch)
tree8b7ac194d9fbf5dfd27c8e7e749360bf063cea4b /src/mesa/main/genmipmap.c
parentf1b05735108c6733893dfbe762366f2676501c0d (diff)
downloadexternal_mesa3d-46610238e0a8db47c293f75ad8d667747d6256af.zip
external_mesa3d-46610238e0a8db47c293f75ad8d667747d6256af.tar.gz
external_mesa3d-46610238e0a8db47c293f75ad8d667747d6256af.tar.bz2
mesa: Do proper format error checks for GenerateMipmap in ES 3.x.
According to the OpenGL ES 3.2 spec's description of GenerateMipmap: "An INVALID_OPERATION error is generated if the levelbase array was not specified with an unsized internal format from table 8.3 or a sized internal format that is both color-renderable and texture-filterable according to table 8.10." Similar text exists in the ES 3.0 specification as well. Our existing rules are pretty close, but miss a few things. The OpenGL specification actually doesn't have any text about internal format checking - our existing code comes from a Khronos bug report. The ES 3.x spec provides a clearer description. Fixes dEQP-GLES3.functional.negative_api.texture.generatemipmap and dEQP-GLES2.functional.negative_api.texture.generatemipmap_zero_level _array_compressed. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src/mesa/main/genmipmap.c')
-rw-r--r--src/mesa/main/genmipmap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index 6eacd42..1a6ae9a 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -79,6 +79,20 @@ bool
_mesa_is_valid_generate_texture_mipmap_internalformat(struct gl_context *ctx,
GLenum internalformat)
{
+ if (_mesa_is_gles3(ctx)) {
+ /* From the ES 3.2 specification's description of GenerateMipmap():
+ * "An INVALID_OPERATION error is generated if the levelbase array was
+ * not specified with an unsized internal format from table 8.3 or a
+ * sized internal format that is both color-renderable and
+ * texture-filterable according to table 8.10."
+ */
+ return internalformat == GL_RGBA || internalformat == GL_RGB ||
+ internalformat == GL_LUMINANCE_ALPHA ||
+ internalformat == GL_LUMINANCE || internalformat == GL_ALPHA ||
+ (_mesa_is_es3_color_renderable(internalformat) &&
+ _mesa_is_es3_texture_filterable(internalformat));
+ }
+
return (!_mesa_is_enum_format_integer(internalformat) &&
!_mesa_is_depthstencil_format(internalformat) &&
!_mesa_is_astc_format(internalformat) &&