Module: Mesa
Branch: master
Commit: cac0191baa7393bf9ff7cdc5979301fd80721256
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cac0191baa7393bf9ff7cdc5979301fd80721256

Author: Adam Jackson <[email protected]>
Date:   Wed Feb 24 19:57:50 2021 -0500

mesa: Store depth bounds test bounds as GLclampd

... instead of truncating to GLfloat. This seems somewhat silly since
the "clamp" part means only values [0.0, 1.0] are defined, but if the
depth buffer is Z32_UNORM then storing as GLfloat means you lose 8 bits
of depth bounds precision. This happens not to matter, yet, since swrast
classic doesn't support Z32_UNORM for depth, and the software gallium
drivers don't support EXT_depth_bounds_test. But the latter part is
about to change.

Reviewed-by: Eric Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9287>

---

 src/gallium/include/pipe/p_state.h | 4 ++--
 src/mesa/main/depth.c              | 4 ++--
 src/mesa/main/mtypes.h             | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index 56d863e6e87..57ac9b6b29a 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -328,8 +328,8 @@ struct pipe_depth_stencil_alpha_state
    unsigned depth_bounds_test:1;     /**< depth bounds test enabled? */
 
    float alpha_ref_value;            /**< reference value */
-   float depth_bounds_min;           /**< minimum depth bound */
-   float depth_bounds_max;           /**< maximum depth bound */
+   double depth_bounds_min;          /**< minimum depth bound */
+   double depth_bounds_max;          /**< maximum depth bound */
 };
 
 
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index 3e366a71d1e..d69e8e71d00 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -166,8 +166,8 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
    FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH,
                   GL_DEPTH_BUFFER_BIT);
    ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
-   ctx->Depth.BoundsMin = (GLfloat) zmin;
-   ctx->Depth.BoundsMax = (GLfloat) zmax;
+   ctx->Depth.BoundsMin = zmin;
+   ctx->Depth.BoundsMax = zmax;
 }
 
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d0581b39c06..d31514396b4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -493,7 +493,7 @@ struct gl_depthbuffer_attrib
    GLboolean Test;             /**< Depth buffering enabled flag */
    GLboolean Mask;             /**< Depth buffer writable? */
    GLboolean BoundsTest;        /**< GL_EXT_depth_bounds_test */
-   GLfloat BoundsMin, BoundsMax;/**< GL_EXT_depth_bounds_test */
+   GLclampd BoundsMin, BoundsMax;/**< GL_EXT_depth_bounds_test */
 };
 
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to