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

Author: Filip Gawin <[email protected]>
Date:   Mon Mar 27 13:44:46 2023 +0200

crocus: don't quantize the clear value

Helps with:
spec@!opengl 1.0@depth-clear-precision-check@depth32f_stencil8,UnexpectedPass
spec@!opengl 3.0@clearbuffer-bug,UnexpectedPass

Cc: mesa-stable

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

---

 src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt |  3 ---
 src/gallium/drivers/crocus/crocus_clear.c          | 12 ------------
 2 files changed, 15 deletions(-)

diff --git a/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt 
b/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt
index 50935d9aa8b..5e85394fde9 100644
--- a/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt
+++ b/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt
@@ -1,7 +1,6 @@
 spec@!opengl 1.0@depth-clear-precision-check,Fail
 spec@!opengl 1.0@depth-clear-precision-check@depth16,Fail
 spec@!opengl 1.0@depth-clear-precision-check@depth32,Fail
-spec@!opengl 1.0@depth-clear-precision-check@depth32f_stencil8,Fail
 
 fast_color_clear@fcc-write-after-clear,Fail
 
@@ -19,8 +18,6 @@ spec@!opengl 1.1@linestipple@Factor 3x,Fail
 spec@!opengl 1.1@linestipple@Line loop,Fail
 spec@!opengl 1.1@linestipple@Line strip,Fail
 
-spec@!opengl 3.0@clearbuffer-bug,Fail
-
 spec@!opengl [email protected] cull-back pv-first,Fail
 spec@!opengl [email protected] cull-front pv-first,Fail
 spec@!opengl [email protected] line cull-back pv-first,Fail
diff --git a/src/gallium/drivers/crocus/crocus_clear.c 
b/src/gallium/drivers/crocus/crocus_clear.c
index 9ce65e914c2..dab78ca94fb 100644
--- a/src/gallium/drivers/crocus/crocus_clear.c
+++ b/src/gallium/drivers/crocus/crocus_clear.c
@@ -454,20 +454,8 @@ fast_clear_depth(struct crocus_context *ice,
                  const struct pipe_box *box,
                  float depth)
 {
-   struct pipe_resource *p_res = (void *) res;
    struct crocus_batch *batch = &ice->batches[CROCUS_BATCH_RENDER];
 
-   /* Quantize the clear value to what can be stored in the actual depth
-    * buffer.  This makes the following check more accurate because it now
-    * checks if the actual depth bits will match.  It also prevents us from
-    * getting a too-accurate depth value during depth testing or when sampling
-    * with HiZ enabled.
-    */
-   const unsigned nbits = p_res->format == PIPE_FORMAT_Z16_UNORM ? 16 : 24;
-   const uint32_t depth_max = (1 << nbits) - 1;
-   depth = p_res->format == PIPE_FORMAT_Z32_FLOAT ? depth :
-      (unsigned)(depth * depth_max) / (float)depth_max;
-
    bool update_clear_depth = false;
 
    /* If we're clearing to a new clear value, then we need to resolve any clear

Reply via email to