mesa: OpenGL 1.4 feature GL_ARB_depth_texture is not optional

Cheatsheet:

_mesa_has_ARB_depth_texture() becomes (true && ctx->Extensions.Version
>= _mesa_extension_table[...].version[ctx->API]).  The last value is 0
when ctx->API is API_OPENGL_COMPAT and ~0 otherwise.  The whole function
effectively becomes (ctx->API == API_OPENGL_COMPAT).

_mesa_has_OES_depth_texture() becomes (true && ctx->Extensions.Version
>= _mesa_extension_table[...].version[ctx->API]).  The last value is 0
when ctx->API is API_OPENGLES2 and ~0 otherwise.  The whole function
effectively becomes (ctx->API == API_OPENGLES2).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
This commit is contained in:
Ian Romanick 2021-12-14 17:32:30 -08:00 committed by Marge Bot
parent 3608bce137
commit f80d45c515
8 changed files with 11 additions and 25 deletions

View file

@ -68,7 +68,6 @@ struct gl_extensions
GLboolean EXT_color_buffer_half_float;
GLboolean ARB_depth_buffer_float;
GLboolean ARB_depth_clamp;
GLboolean ARB_depth_texture;
GLboolean ARB_derivative_control;
GLboolean ARB_draw_buffers_blend;
GLboolean ARB_draw_elements_base_vertex;

View file

@ -266,7 +266,6 @@ _mesa_init_extensions(struct gl_extensions *extensions)
extensions->MESA_window_pos = GL_TRUE;
extensions->ARB_ES2_compatibility = GL_TRUE;
extensions->ARB_depth_texture = GL_TRUE;
extensions->ARB_draw_elements_base_vertex = GL_TRUE;
extensions->ARB_explicit_attrib_location = GL_TRUE;
extensions->ARB_explicit_uniform_location = GL_TRUE;

View file

@ -60,7 +60,7 @@ EXT(ARB_cull_distance , ARB_cull_distance
EXT(ARB_debug_output , dummy_true , GLL, GLC, x , x , 2009)
EXT(ARB_depth_buffer_float , ARB_depth_buffer_float , GLL, GLC, x , x , 2008)
EXT(ARB_depth_clamp , ARB_depth_clamp , GLL, GLC, x , x , 2003)
EXT(ARB_depth_texture , ARB_depth_texture , GLL, x , x , x , 2001)
EXT(ARB_depth_texture , dummy_true , GLL, x , x , x , 2001)
EXT(ARB_derivative_control , ARB_derivative_control , GLL, GLC, x , x , 2014)
EXT(ARB_direct_state_access , dummy_true , 31, GLC, x , x , 2014)
EXT(ARB_draw_buffers , dummy_true , GLL, GLC, x , x , 2002)
@ -431,7 +431,7 @@ EXT(OES_compressed_ETC1_RGB8_texture , OES_compressed_ETC1_RGB8_texture
EXT(OES_compressed_paletted_texture , dummy_true , x , x , ES1, x , 2003)
EXT(OES_copy_image , OES_copy_image , x , x , x , 30, 2014)
EXT(OES_depth24 , dummy_true , x , x , ES1, ES2, 2005)
EXT(OES_depth_texture , ARB_depth_texture , x , x , x , ES2, 2006)
EXT(OES_depth_texture , dummy_true , x , x , x , ES2, 2006)
EXT(OES_depth_texture_cube_map , OES_depth_texture_cube_map , x , x , x , ES2, 2012)
EXT(OES_draw_buffers_indexed , ARB_draw_buffers_blend , x , x , x , 30, 2014)
EXT(OES_draw_elements_base_vertex , ARB_draw_elements_base_vertex , x , x , x , ES2, 2014)

View file

@ -999,14 +999,8 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
}
}
else if (format == GL_DEPTH) {
if (baseFormat == GL_DEPTH_COMPONENT) {
/* OK */
}
else if (ctx->Extensions.ARB_depth_texture &&
baseFormat == GL_DEPTH_STENCIL) {
/* OK */
}
else {
if (baseFormat != GL_DEPTH_COMPONENT &&
baseFormat != GL_DEPTH_STENCIL) {
att->Complete = GL_FALSE;
att_incomplete("bad depth format");
return;
@ -1014,8 +1008,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
}
else {
assert(format == GL_STENCIL);
if (ctx->Extensions.ARB_depth_texture &&
baseFormat == GL_DEPTH_STENCIL) {
if (baseFormat == GL_DEPTH_STENCIL) {
/* OK */
} else if (ctx->Extensions.ARB_texture_stencil8 &&
baseFormat == GL_STENCIL_INDEX) {

View file

@ -1017,8 +1017,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
switch (pname) {
case GL_INTERNALFORMAT_DEPTH_SIZE:
if (ctx->API != API_OPENGL_CORE &&
!_mesa_has_ARB_depth_texture(ctx) &&
if (!_mesa_is_desktop_gl(ctx) &&
target != GL_RENDERBUFFER &&
target != GL_TEXTURE_BUFFER)
goto end;

View file

@ -2345,8 +2345,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
}
}
if (_mesa_has_ARB_depth_texture(ctx) || _mesa_has_OES_depth_texture(ctx) ||
ctx->API == API_OPENGL_CORE) {
if (ctx->API != API_OPENGLES) {
switch (internalFormat) {
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16:

View file

@ -518,7 +518,7 @@ set_tex_parameteri(struct gl_context *ctx,
/* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has never
* existed in OpenGL ES.
*/
if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_texture) {
if (ctx->API == API_OPENGL_COMPAT) {
if (texObj->Attrib.DepthMode == params[0])
return GL_FALSE;
if (params[0] == GL_LUMINANCE ||
@ -1812,8 +1812,6 @@ get_tex_level_parameter_image(struct gl_context *ctx,
}
break;
case GL_TEXTURE_DEPTH_SIZE_ARB:
if (!ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = _mesa_get_format_bits(texFormat, pname);
break;
case GL_TEXTURE_STENCIL_SIZE:
@ -2380,7 +2378,7 @@ get_tex_parameterfv(struct gl_context *ctx,
/* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has
* never existed in OpenGL ES.
*/
if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLfloat) obj->Attrib.DepthMode;
break;
@ -2667,7 +2665,7 @@ get_tex_parameteriv(struct gl_context *ctx,
*params = (GLint) obj->Sampler.Attrib.CompareFunc;
break;
case GL_DEPTH_TEXTURE_MODE_ARB:
if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLint) obj->Attrib.DepthMode;
break;

View file

@ -251,8 +251,7 @@ compute_version(const struct gl_extensions *extensions,
{
GLuint major, minor, version;
const bool ver_1_4 = (extensions->ARB_depth_texture &&
extensions->ARB_shadow &&
const bool ver_1_4 = (extensions->ARB_shadow &&
extensions->ARB_texture_env_crossbar &&
extensions->EXT_blend_color &&
extensions->EXT_blend_func_separate &&