mesa/core: Enable EXT_depth_clamp for GLES >= 2.0
authorGert Wollny <gert.wollny@collabora.com>
Wed, 2 Jan 2019 14:44:33 +0000 (15:44 +0100)
committerGert Wollny <gw.fossdev@gmail.com>
Mon, 25 Feb 2019 09:44:27 +0000 (09:44 +0000)
The extension NV_depth_clamp is written against OpenGL 1.2.1, and
since GLES 2.0 is based on GL 2.0 there is no reason not to enable
this extension also for GLES >= 2.0.

v2: Use EXT_depth_clamp that has been proposed to Khronos

v3: - Fix check for extension availability (Erik Faya-Lund)
    - Also fix the test in is_enabled
v4: - Test both, ARB and EXT extension (Erik)
v5: - Fix white space errors (Erik)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
src/mesa/main/enable.c
src/mesa/main/extensions_table.h

index b5e59b77751ead94cbdce7ecd8ac3a2afd5bd57b..386556edeedb829bcfeaa34510108287732e5a19 100644 (file)
@@ -1004,9 +1004,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          break;
 
       case GL_DEPTH_CLAMP:
-         if (!_mesa_is_desktop_gl(ctx))
+         if (!_mesa_has_ARB_depth_clamp(ctx) &&
+             !_mesa_has_EXT_depth_clamp(ctx))
             goto invalid_enum_error;
-         CHECK_EXTENSION(ARB_depth_clamp, cap);
          if (ctx->Transform.DepthClampNear == state &&
              ctx->Transform.DepthClampFar == state)
             return;
@@ -1704,9 +1704,9 @@ _mesa_IsEnabled( GLenum cap )
 
       /* GL_ARB_depth_clamp */
       case GL_DEPTH_CLAMP:
-         if (!_mesa_is_desktop_gl(ctx))
+         if (!_mesa_has_ARB_depth_clamp(ctx) &&
+             !_mesa_has_EXT_depth_clamp(ctx))
             goto invalid_enum_error;
-         CHECK_EXTENSION(ARB_depth_clamp);
          return ctx->Transform.DepthClampNear ||
                 ctx->Transform.DepthClampFar;
 
index b0492fed698ad5d57e20f7627851c1c6a433533e..05ed418d750090ae7a57892d4d3017c1987e2a55 100644 (file)
@@ -218,6 +218,7 @@ EXT(EXT_compressed_ETC1_RGB8_sub_texture    , OES_compressed_ETC1_RGB8_texture
 EXT(EXT_copy_image                          , OES_copy_image                         ,  x ,  x ,  x ,  30, 2014)
 EXT(EXT_copy_texture                        , dummy_true                             , GLL,  x ,  x ,  x , 1995)
 EXT(EXT_depth_bounds_test                   , EXT_depth_bounds_test                  , GLL, GLC,  x ,  x , 2002)
+EXT(EXT_depth_clamp                         , ARB_depth_clamp                        ,  x ,  x ,  x , ES2, 2019)
 EXT(EXT_discard_framebuffer                 , dummy_true                             ,  x ,  x , ES1, ES2, 2009)
 EXT(EXT_disjoint_timer_query                , EXT_disjoint_timer_query               ,  x ,  x ,  x , ES2, 2016)
 EXT(EXT_draw_buffers                        , dummy_true                             ,  x ,  x ,  x , ES2, 2012)