Mesa (marge_bot_batch_merge_job): mesa: OpenGL 1.4 feature GL_ARB_depth_texture is not optional

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 7 08:28:24 UTC 2022


Module: Mesa
Branch: marge_bot_batch_merge_job
Commit: 1c1f179069c23ce09c52d1b59d7fbad1341c9b6c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c1f179069c23ce09c52d1b59d7fbad1341c9b6c

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Tue Dec 14 17:32:30 2021 -0800

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 at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>

---

 src/mesa/main/extensions.c       |  1 -
 src/mesa/main/extensions_table.h |  4 ++--
 src/mesa/main/fbobject.c         | 13 +++----------
 src/mesa/main/formatquery.c      |  3 +--
 src/mesa/main/glformats.c        |  3 +--
 src/mesa/main/mtypes.h           |  1 -
 src/mesa/main/texparam.c         |  8 +++-----
 src/mesa/main/version.c          |  3 +--
 8 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 96d19c6d54b..4ead8e511b4 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -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;
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 9ab2f8ef804..4a8d28889e8 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -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)
@@ -430,7 +430,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)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 3db75974f2c..40064df28c5 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -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) {
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index f95086b4415..6f0f019783f 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -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;
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 3e9b5c57bc6..9ef771de105 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -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:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e321d58b7ea..662be2c6cc8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4373,7 +4373,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;
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 7ac49ac73c4..81ab4a8d386 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -517,7 +517,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 ||
@@ -1770,8 +1770,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:
@@ -2338,7 +2336,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;
@@ -2624,7 +2622,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;
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index b3a0e654231..90eb377b461 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -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 &&



More information about the mesa-commit mailing list