[Mesa-dev] [PATCH 4/4] mesa: Add support for NV_depth_buffer_float.

Roland Scheidegger sroland at vmware.com
Mon Sep 15 09:10:16 PDT 2014


Am 14.09.2014 16:07, schrieb Mathias.Froehlich at gmx.net:
> From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
> 
> This is mostly support for the unclamped versions of
> glDepthRangedNV, glClearDepthdNV and glDepthBoundsdNV.
> Note that OpenGL 4.2 introduced that the traditonal
> glDepthRange functions may no longer clamp to [0, 1],
> but OpenGL 4.3 already revoked this behavior to clamp
> the arguments.
> 
> Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
> ---
>  docs/relnotes/10.3.html                      |  1 +
>  src/mapi/glapi/gen/NV_depth_buffer_float.xml | 32 +++++++++++++
>  src/mapi/glapi/gen/gl_API.xml                |  2 +
>  src/mesa/drivers/common/meta.c               |  3 +-
>  src/mesa/main/attrib.c                       |  4 +-
>  src/mesa/main/depth.c                        | 16 +++++++
>  src/mesa/main/depth.h                        |  6 +++
>  src/mesa/main/dlist.c                        | 67 ++++++++++++++++++++++++++++
>  src/mesa/main/extensions.c                   |  1 +
>  src/mesa/main/fbobject.c                     |  5 +++
>  src/mesa/main/get.c                          | 15 +++++++
>  src/mesa/main/get_hash_params.py             |  3 ++
>  src/mesa/main/glformats.c                    |  9 +++-
>  src/mesa/main/mtypes.h                       |  1 +
>  src/mesa/main/tests/dispatch_sanity.cpp      |  5 +++
>  src/mesa/main/texformat.c                    |  2 +
>  src/mesa/main/teximage.c                     |  2 +
>  src/mesa/main/viewport.c                     | 13 ++++++
>  src/mesa/main/viewport.h                     |  3 ++
>  src/mesa/state_tracker/st_extensions.c       |  1 +
>  src/mesa/state_tracker/st_format.c           |  8 ++++
>  21 files changed, 195 insertions(+), 4 deletions(-)
>  create mode 100644 src/mapi/glapi/gen/NV_depth_buffer_float.xml
> 
> diff --git a/docs/relnotes/10.3.html b/docs/relnotes/10.3.html
> index fa4ea23..702f4b6 100644
> --- a/docs/relnotes/10.3.html
> +++ b/docs/relnotes/10.3.html
> @@ -65,6 +65,7 @@ Note: some of the new features are only available with certain drivers.
>  <li>GL_ARB_texture_query_lod on r600, radeonsi</li>
>  <li>GL_ARB_viewport_array on nvc0</li>
>  <li>GL_AMD_vertex_shader_viewport_index on i965/gen7+, r600</li>
> +<li>GL_NV_depth_buffer_float on softpipe, llvmpipe</li>
>  <li>GL_OES_compressed_ETC1_RGB8_texture on nv30, nv50, nvc0, r300, r600, radeonsi, softpipe, llvmpipe</li>
>  <li>GLX_MESA_query_renderer on nv30, nv50, nvc0, r300, r600, radeonsi, softpipe, llvmpipe</li>
>  <li>A new software rasterizer driver (kms_swrast_dri.so) that works with
> diff --git a/src/mapi/glapi/gen/NV_depth_buffer_float.xml b/src/mapi/glapi/gen/NV_depth_buffer_float.xml
> new file mode 100644
> index 0000000..289538cf
> --- /dev/null
> +++ b/src/mapi/glapi/gen/NV_depth_buffer_float.xml
> @@ -0,0 +1,32 @@
> +<?xml version="1.0"?>
> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
> +
> +<!-- Note: no GLX protocol info yet. -->
> +
> +<OpenGLAPI>
> +
> +<category name="GL_NV_depth_buffer_float" number="334">
> +
> +    <enum name="DEPTH_COMPONENT32F_NV"        value = "0x8DAB"/>
> +    <enum name="DEPTH32F_STENCIL8_NV"         value = "0x8DAC"/>
> +
> +    <!-- Is the same than FLOAT_32_UNSIGNED_INT_24_8_REV. -->
> +    <enum name="FLOAT_32_UNSIGNED_INT_24_8_REV_NV" value = "0x8DAD"/>
> +
> +    <enum name="DEPTH_BUFFER_FLOAT_MODE_NV" value = "0x8DAF"/>
> +
> +    <function name="DepthRangedNV" offset="assign">
> +        <param name="n" type="GLdouble"/>
> +        <param name="f" type="GLdouble"/>
> +    </function>
> +    <function name="ClearDepthdNV" offset="assign">
> +        <param name="d" type="GLdouble"/>
> +    </function>
> +    <function name="DepthBoundsdNV" offset="assign">
> +        <param name="zmin" type="GLdouble"/>
> +        <param name="zmax" type="GLdouble"/>
> +    </function>
> +
> +</category>
> +
> +</OpenGLAPI>
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index 73f2f75..d504faf 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -13027,6 +13027,8 @@
>  
>  <xi:include href="NV_vdpau_interop.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
>  
> +<xi:include href="NV_depth_buffer_float.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
> +
>  <xi:include href="GL4x.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
>  
>  </OpenGLAPI>
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 7a8e627..d165f12 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -1112,7 +1112,8 @@ _mesa_meta_end(struct gl_context *ctx)
>           _mesa_set_viewport(ctx, 0, save->ViewportX, save->ViewportY,
>                              save->ViewportW, save->ViewportH);
>        }
> -      _mesa_DepthRange(save->DepthNear, save->DepthFar);
> +      /* Need to call ...NV since this is guaranteed not to clamp to [0,1] */
> +      _mesa_DepthRangedNV(save->DepthNear, save->DepthFar);
>     }
>  
>     if (state & MESA_META_CLAMP_FRAGMENT_COLOR &&
> diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> index 97115a1..4930afd 100644
> --- a/src/mesa/main/attrib.c
> +++ b/src/mesa/main/attrib.c
> @@ -1072,7 +1072,9 @@ _mesa_PopAttrib(void)
>                 const struct gl_depthbuffer_attrib *depth;
>                 depth = (const struct gl_depthbuffer_attrib *) attr->data;
>                 _mesa_DepthFunc(depth->Func);
> -               _mesa_ClearDepth(depth->Clear);
> +               /* The ...NV variant is guaranteed not to clamp */
> +               /* what was not clamped before. */
> +               _mesa_ClearDepthdNV(depth->Clear);
>                 _mesa_set_enable(ctx, GL_DEPTH_TEST, depth->Test);
>                 _mesa_DepthMask(depth->Mask);
>              }
> diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
> index 8ae3cb6..f63dc01 100644
> --- a/src/mesa/main/depth.c
> +++ b/src/mesa/main/depth.c
> @@ -91,6 +91,12 @@ _mesa_ClearDepthf( GLclampf depth )
>     set_clear_depth(ctx, "glClearDepthf", depth, true);
>  }
>  
> +void GLAPIENTRY
> +_mesa_ClearDepthdNV( GLdouble depth )
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +   set_clear_depth(ctx, "glClearDepthdNV", depth, false);
> +}
>  
>  void GLAPIENTRY
>  _mesa_DepthFunc( GLenum func )
> @@ -162,6 +168,16 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
>  }
>  
>  
> +/**
> + * Specified by the NV_depth_buffer_float extension.
> + */
> +void GLAPIENTRY
> +_mesa_DepthBoundsdNV( GLdouble zmin, GLdouble zmax )
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +   set_depth_bounds(ctx, "glDepthBoundsdNV", zmin, zmax, false);
> +}
> +
>  /**********************************************************************/
>  /*****                      Initialization                        *****/
>  /**********************************************************************/
> diff --git a/src/mesa/main/depth.h b/src/mesa/main/depth.h
> index 5ff7a5e..f213012 100644
> --- a/src/mesa/main/depth.h
> +++ b/src/mesa/main/depth.h
> @@ -44,6 +44,9 @@ extern void GLAPIENTRY
>  _mesa_ClearDepthf( GLclampf depth );
>  
>  extern void GLAPIENTRY
> +_mesa_ClearDepthdNV( GLdouble depth );
> +
> +extern void GLAPIENTRY
>  _mesa_DepthFunc( GLenum func );
>  
>  extern void GLAPIENTRY
> @@ -52,6 +55,9 @@ _mesa_DepthMask( GLboolean flag );
>  extern void GLAPIENTRY
>  _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax );
>  
> +extern void GLAPIENTRY
> +_mesa_DepthBoundsdNV( GLdouble zmin, GLdouble zmax );
> +
>  extern void 
>  _mesa_init_depth( struct gl_context * ctx );
>  
> diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
> index 5c7160d..2e98045 100644
> --- a/src/mesa/main/dlist.c
> +++ b/src/mesa/main/dlist.c
> @@ -40,6 +40,7 @@
>  #include "bufferobj.h"
>  #include "arrayobj.h"
>  #include "context.h"
> +#include "depth.h"
>  #include "dlist.h"
>  #include "enums.h"
>  #include "eval.h"
> @@ -308,6 +309,10 @@ typedef enum
>     OPCODE_ACTIVE_STENCIL_FACE_EXT,
>     /* GL_EXT_depth_bounds_test */
>     OPCODE_DEPTH_BOUNDS_EXT,
> +   /* GL_NV_depth_buffer_float */
> +   OPCODE_DEPTH_RANGE_NV,
> +   OPCODE_CLEAR_DEPTH_NV,
> +   OPCODE_DEPTH_BOUNDS_NV,
>     /* GL_ARB_vertex/fragment_program */
>     OPCODE_PROGRAM_STRING_ARB,
>     OPCODE_PROGRAM_ENV_PARAMETER_ARB,
> @@ -4843,6 +4848,54 @@ save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
>  }
>  
>  
> +/* NV_depth_buffer_float */
> +static void GLAPIENTRY
> +save_DepthRangedNV(GLdouble near, GLdouble far)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +   Node *n;
> +   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
> +   n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE_NV, 2);
> +   if (n) {
> +      n[1].f = near;
> +      n[2].f = far;
> +   }
> +   if (ctx->ExecuteFlag) {
> +      CALL_DepthRangedNV(ctx->Exec, (near, far));
> +   }
> +}
> +
> +static void GLAPIENTRY
> +save_ClearDepthdNV(GLdouble d)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +   Node *n;
> +   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
> +   n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH_NV, 1);
> +   if (n) {
> +      n[1].f = d;
> +   }
> +   if (ctx->ExecuteFlag) {
> +      CALL_ClearDepthdNV(ctx->Exec, (d));
> +   }
> +}
> +
> +static void GLAPIENTRY
> +save_DepthBoundsdNV(GLdouble zmin, GLdouble zmax)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +   Node *n;
> +   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
> +   n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_NV, 2);
> +   if (n) {
> +      n[1].f = zmin;
> +      n[2].f = zmax;
> +   }
> +   if (ctx->ExecuteFlag) {
> +      CALL_DepthBoundsdNV(ctx->Exec, (zmin, zmax));
> +   }
> +}
> +
>  
>  static void GLAPIENTRY
>  save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
> @@ -8317,6 +8370,15 @@ execute_list(struct gl_context *ctx, GLuint list)
>           case OPCODE_DEPTH_BOUNDS_EXT:
>              CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
>              break;
> +         case OPCODE_DEPTH_RANGE_NV:
> +            CALL_DepthRangedNV(ctx->Exec, (n[1].f, n[2].f));
> +            break;
> +         case OPCODE_CLEAR_DEPTH_NV:
> +            CALL_ClearDepthdNV(ctx->Exec, (n[1].f));
> +            break;
> +         case OPCODE_DEPTH_BOUNDS_NV:
> +            CALL_DepthBoundsdNV(ctx->Exec, (n[1].f, n[2].f));
> +            break;
>           case OPCODE_PROGRAM_STRING_ARB:
>              CALL_ProgramStringARB(ctx->Exec,
>                                    (n[1].e, n[2].e, n[3].i,
> @@ -9460,6 +9522,11 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
>     /* ???. GL_EXT_depth_bounds_test */
>     SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
>  
> +   /* ???. GL_NV_depth_buffer_float */
> +   SET_DepthRangedNV(table, save_DepthRangedNV);
> +   SET_ClearDepthdNV(table, save_ClearDepthdNV);
> +   SET_DepthBoundsdNV(table, save_DepthBoundsdNV);
> +
>     /* ARB 1. GL_ARB_multitexture */
>     SET_ActiveTexture(table, save_ActiveTextureARB);
>  
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 553c01e..6b912fb 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -353,6 +353,7 @@ static const struct extension extension_table[] = {
>     { "GL_MESA_ycbcr_texture",                      o(MESA_ycbcr_texture),                      GL,             2002 },
>     { "GL_NV_blend_square",                         o(dummy_true),                              GLL,            1999 },
>     { "GL_NV_conditional_render",                   o(NV_conditional_render),                   GL,             2008 },
> +   { "GL_NV_depth_buffer_float",                   o(NV_depth_buffer_float),                   GL,             2008 },
>     { "GL_NV_depth_clamp",                          o(ARB_depth_clamp),                         GL,             2001 },
>     { "GL_NV_draw_buffers",                         o(dummy_true),                                         ES2, 2011 },
>     { "GL_NV_fbo_color_attachments",                o(dummy_true),                                         ES2, 2010 },
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index ae3a418..43bfeae 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1480,6 +1480,11 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
>           || (ctx->API == API_OPENGL_COMPAT &&
>               ctx->Extensions.ARB_depth_buffer_float)
>           ? GL_DEPTH_STENCIL : 0;
> +   case GL_DEPTH_COMPONENT32F_NV:
> +   case GL_DEPTH32F_STENCIL8_NV:
> +      return (ctx->API == API_OPENGL_COMPAT &&
> +	      ctx->Extensions.NV_depth_buffer_float)
> +         ? GL_DEPTH_COMPONENT : 0;
>     case GL_RED:
>     case GL_R16:
>        return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_rg
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 0e2d8f6..13f773b 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -31,6 +31,7 @@
>  #include "errors.h"
>  #include "extensions.h"
>  #include "get.h"
> +#include "glformats.h"
>  #include "macros.h"
>  #include "mtypes.h"
>  #include "state.h"
> @@ -391,6 +392,7 @@ EXTRA_EXT(ARB_gpu_shader5);
>  EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
>  EXTRA_EXT(INTEL_performance_query);
>  EXTRA_EXT(ARB_explicit_uniform_location);
> +EXTRA_EXT(NV_depth_buffer_float);
>  
>  static const int
>  extra_ARB_color_buffer_float_or_glcore[] = {
> @@ -1019,6 +1021,19 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
>           v->value_int = 0;
>        }
>        break;
> +   /* NV_depth_buffer_float */
> +   case GL_DEPTH_BUFFER_FLOAT_MODE_NV:
> +      {
> +         /* Note: we only check the 0th color attachment. */
Since you're checking the depth buffer, I don't think comment makes much
sense here.

Roland

> +         const struct gl_renderbuffer *rb =
> +            ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
> +         if (rb && _mesa_is_float_depth_format(rb->Format)) {
> +            v->value_bool = 1;
> +         } else {
> +            v->value_bool = 0;
> +         }
> +      }
> +      break;
>     }
>  }
>  
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index aace8a5..898fda0 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -791,6 +791,9 @@ descriptor=[
>    [ "MIN_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MinFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>    [ "MAX_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MaxFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>    [ "FRAGMENT_INTERPOLATION_OFFSET_BITS", "CONST(FRAGMENT_INTERPOLATION_OFFSET_BITS), extra_ARB_gpu_shader5" ],
> +
> +# GL_NV_depth_buffer_float
> +  [ "DEPTH_BUFFER_FLOAT_MODE_NV", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_NV_depth_buffer_float" ],
>  ]},
>  
>  # Enums restricted to OpenGL Core profile
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 16f7d6b..73804c9 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -901,6 +901,7 @@ _mesa_is_depth_format(GLenum format)
>        case GL_DEPTH_COMPONENT24:
>        case GL_DEPTH_COMPONENT32:
>        case GL_DEPTH_COMPONENT32F:
> +      case GL_DEPTH_COMPONENT32F_NV:
>           return GL_TRUE;
>        default:
>           return GL_FALSE;
> @@ -974,7 +975,9 @@ _mesa_is_depth_or_stencil_format(GLenum format)
>        case GL_DEPTH_STENCIL_EXT:
>        case GL_DEPTH24_STENCIL8_EXT:
>        case GL_DEPTH_COMPONENT32F:
> +      case GL_DEPTH_COMPONENT32F_NV:
>        case GL_DEPTH32F_STENCIL8:
> +      case GL_DEPTH32F_STENCIL8_NV:
>           return GL_TRUE;
>        default:
>           return GL_FALSE;
> @@ -2188,7 +2191,8 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
>           break;
>  
>        case GL_FLOAT:
> -         if (internalFormat != GL_DEPTH_COMPONENT32F)
> +         if (internalFormat != GL_DEPTH_COMPONENT32F
> +            && internalFormat != GL_DEPTH_COMPONENT32F_NV)
>              return GL_INVALID_OPERATION;
>           break;
>  
> @@ -2206,7 +2210,8 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
>           break;
>  
>        case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
> -         if (internalFormat != GL_DEPTH32F_STENCIL8)
> +         if (internalFormat != GL_DEPTH32F_STENCIL8
> +             && internalFormat != GL_DEPTH32F_STENCIL8_NV)
>              return GL_INVALID_OPERATION;
>           break;
>  
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 0d50be8..e7b5784 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3779,6 +3779,7 @@ struct gl_extensions
>     GLboolean MESA_pack_invert;
>     GLboolean MESA_ycbcr_texture;
>     GLboolean NV_conditional_render;
> +   GLboolean NV_depth_buffer_float;
>     GLboolean NV_fog_distance;
>     GLboolean NV_fragment_program_option;
>     GLboolean NV_point_sprite;
> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
> index 04fa86b..9bdc86c 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -951,6 +951,11 @@ const struct function gl_core_functions_possible[] = {
>     { "glClearTexImage", 13, -1 },
>     { "glClearTexSubImage", 13, -1 },
>  
> +   /* GL_NV_depth_buffer_float */
> +   { "glDepthRangedNV", 20, -1 },
> +   { "glClearDepthdNV", 20, -1 },
> +   { "glDepthBoundsdNV", 20, -1 },
> +
>     { NULL, 0, -1 }
>  };
>  
> diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
> index 6d3b805..6c22889 100644
> --- a/src/mesa/main/texformat.c
> +++ b/src/mesa/main/texformat.c
> @@ -442,9 +442,11 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
>        break;
>  
>     case GL_DEPTH_COMPONENT32F:
> +   case GL_DEPTH_COMPONENT32F_NV:
>        ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32]);
>        return MESA_FORMAT_Z_FLOAT32;
>     case GL_DEPTH32F_STENCIL8:
> +   case GL_DEPTH32F_STENCIL8_NV:
>        ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_S8X24_UINT]);
>        return MESA_FORMAT_Z32_FLOAT_S8X24_UINT;
>  
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 647d28a..8d820af 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -448,8 +448,10 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
>     if (ctx->Extensions.ARB_depth_buffer_float) {
>        switch (internalFormat) {
>        case GL_DEPTH_COMPONENT32F:
> +      case GL_DEPTH_COMPONENT32F_NV:
>           return GL_DEPTH_COMPONENT;
>        case GL_DEPTH32F_STENCIL8:
> +      case GL_DEPTH32F_STENCIL8_NV:
>           return GL_DEPTH_STENCIL;
>        default:
>           ; /* fallthrough */
> diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
> index e86a77c..0712acb 100644
> --- a/src/mesa/main/viewport.c
> +++ b/src/mesa/main/viewport.c
> @@ -332,6 +332,19 @@ _mesa_DepthRangef(GLclampf nearval, GLclampf farval)
>     _mesa_DepthRange(nearval, farval);
>  }
>  
> +void GLAPIENTRY
> +_mesa_DepthRangedNV(GLdouble nearval, GLdouble farval)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   FLUSH_VERTICES(ctx, 0);
> +
> +   if (MESA_VERBOSE&VERBOSE_API)
> +      _mesa_debug(ctx, "glDepthRangeNV %f %f\n", nearval, farval);
> +
> +   set_all_depth_range(ctx, nearval, farval, false);
> +}
> +
>  /**
>   * Update a range DepthRange values
>   *
> diff --git a/src/mesa/main/viewport.h b/src/mesa/main/viewport.h
> index 6324cab..dbbe814 100644
> --- a/src/mesa/main/viewport.h
> +++ b/src/mesa/main/viewport.h
> @@ -55,6 +55,9 @@ extern void GLAPIENTRY
>  _mesa_DepthRangef(GLclampf nearval, GLclampf farval);
>  
>  extern void GLAPIENTRY
> +_mesa_DepthRangedNV(GLdouble nearval, GLdouble farval);
> +
> +extern void GLAPIENTRY
>  _mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd * v);
>  
>  extern void GLAPIENTRY
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index c7bc0ca..8521d04 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -451,6 +451,7 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(ATI_separate_stencil),             PIPE_CAP_TWO_SIDED_STENCIL                },
>        { o(ATI_texture_mirror_once),          PIPE_CAP_TEXTURE_MIRROR_CLAMP             },
>        { o(NV_conditional_render),            PIPE_CAP_CONDITIONAL_RENDER               },
> +      { o(NV_depth_buffer_float),            PIPE_CAP_UNCLAMPED_DEPTH_VALUES           },
>        { o(NV_texture_barrier),               PIPE_CAP_TEXTURE_BARRIER                  },
>        /* GL_NV_point_sprite is not supported by gallium because we don't
>         * support the GL_POINT_SPRITE_R_MODE_NV option. */
> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
> index 531bc65..4446a17 100644
> --- a/src/mesa/state_tracker/st_format.c
> +++ b/src/mesa/state_tracker/st_format.c
> @@ -1081,6 +1081,10 @@ static const struct format_mapping format_map[] = {
>        { GL_DEPTH_COMPONENT32F, 0 },
>        { PIPE_FORMAT_Z32_FLOAT, 0 }
>     },
> +   {
> +      { GL_DEPTH_COMPONENT32F_NV, 0 },
> +      { PIPE_FORMAT_Z32_FLOAT, 0 }
> +   },
>  
>     /* stencil formats */
>     {
> @@ -1101,6 +1105,10 @@ static const struct format_mapping format_map[] = {
>        { GL_DEPTH32F_STENCIL8, 0 },
>        { PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, 0 }
>     },
> +   {
> +      { GL_DEPTH32F_STENCIL8_NV, 0 },
> +      { PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, 0 }
> +   },
>  
>     /* sRGB formats */
>     {
> 



More information about the mesa-dev mailing list