[Mesa-dev] [PATCH 2/2] swr: add support for EXT_depth_bounds_test

Ilia Mirkin imirkin at alum.mit.edu
Tue Nov 1 20:45:13 UTC 2016


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

This fails one sub-case of the piglit depth_bounds test:

Test 10, bounds=(0.00, 0.50), z=(0.50, 0.50, 0.50, 0.50)
Probe color at (0,20)
  Expected: 255 255 255
  Observed: 26 26 26

I'm blaming it on the floating point boogey man.

 src/gallium/drivers/swr/swr_screen.cpp | 2 +-
 src/gallium/drivers/swr/swr_state.cpp  | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
index 704a684..fa16edd 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -332,7 +332,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
       return 0;
    case PIPE_CAP_DEPTH_BOUNDS_TEST:
-      return 0; // xxx
+      return 1;
    case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
    case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
       return 1;
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index 3e02322..d8a8ee1 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -1205,6 +1205,7 @@ swr_update_derived(struct pipe_context *pipe,
       struct pipe_depth_state *depth = &(ctx->depth_stencil->depth);
       struct pipe_stencil_state *stencil = ctx->depth_stencil->stencil;
       SWR_DEPTH_STENCIL_STATE depthStencilState = {{0}};
+      SWR_DEPTH_BOUNDS_STATE depthBoundsState = {0};
 
       /* XXX, incomplete.  Need to flesh out stencil & alpha test state
       struct pipe_stencil_state *front_stencil =
@@ -1251,6 +1252,11 @@ swr_update_derived(struct pipe_context *pipe,
       depthStencilState.depthTestFunc = swr_convert_depth_func(depth->func);
       depthStencilState.depthWriteEnable = depth->writemask;
       SwrSetDepthStencilState(ctx->swrContext, &depthStencilState);
+
+      depthBoundsState.depthBoundsTestEnable = depth->bounds_test;
+      depthBoundsState.depthBoundsTestMinValue = depth->bounds_min;
+      depthBoundsState.depthBoundsTestMaxValue = depth->bounds_max;
+      SwrSetDepthBoundsState(ctx->swrContext, &depthBoundsState);
    }
 
    /* Blend State */
-- 
2.7.3



More information about the mesa-dev mailing list