mesa/main: validate integer-formats

RG integer-textures are only supported on OpenGL if the combination
of EXT_texture_integer and ARB_texture_rg is supported. It's also
supported on GL3, but both of those extensions are required there
anyway. In addition GLES3 is supported.

BGR, BGRA and alpha integer-textures are only supported by
EXT_texture_integer.

Luminance and luminance-alpha integer-textures similarly, but are
unsupported in core contexts, because general luminance support is
removed.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29835>
This commit is contained in:
Erik Faye-Lund 2024-06-06 22:15:22 +02:00 committed by Marge Bot
parent dea1b68f73
commit 63a2f94962

View file

@ -1754,6 +1754,28 @@ valid_texture_format_enum(const struct gl_context *ctx, GLenum format)
_mesa_has_EXT_texture_format_BGRA8888(ctx));
return true;
case GL_RED_INTEGER:
case GL_GREEN_INTEGER:
case GL_BLUE_INTEGER:
case GL_RGB_INTEGER:
case GL_RGBA_INTEGER:
return _mesa_has_integer_textures(ctx);
case GL_RG_INTEGER:
return (_mesa_has_EXT_texture_integer(ctx) &&
_mesa_has_ARB_texture_rg(ctx)) ||
_mesa_is_gles3(ctx);
case GL_BGR_INTEGER:
case GL_BGRA_INTEGER:
case GL_ALPHA_INTEGER:
return _mesa_has_EXT_texture_integer(ctx);
case GL_LUMINANCE_INTEGER_EXT:
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
return _mesa_is_desktop_gl_compat(ctx) &&
_mesa_has_EXT_texture_integer(ctx);
case GL_DEPTH_COMPONENT:
return _mesa_is_desktop_gl(ctx) ||
_mesa_has_OES_depth_texture(ctx);