diff options
author | Matthew McClure <[email protected]> | 2013-12-10 13:10:03 -0800 |
---|---|---|
committer | José Fonseca <[email protected]> | 2013-12-11 18:24:21 +0000 |
commit | e84a1ab3c400f819408a7ebe01c2325cd59d94d3 (patch) | |
tree | c99b65fb562865046269d8d48433b30c25fa69dd /src/gallium/drivers/llvmpipe/lp_setup.c | |
parent | 00faf82832f3e6ef886abad246b50cc47b901c1f (diff) |
llvmpipe: add plumbing for ARB_depth_clamp
With this patch llvmpipe will adhere to the ARB_depth_clamp enabled state when
clamping the fragment's zw value. To support this, the variant key now includes
the depth_clamp state. key->depth_clamp is derived from pipe_rasterizer_state's
(depth_clip == 0), thus depth clamp is only enabled when depth clip is disabled.
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 31aaf963fe9..49962af7bb2 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -656,6 +656,7 @@ lp_setup_set_viewports(struct lp_setup_context *setup, unsigned num_viewports, const struct pipe_viewport_state *viewports) { + struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); unsigned i; LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); @@ -670,8 +671,14 @@ lp_setup_set_viewports(struct lp_setup_context *setup, float min_depth; float max_depth; - min_depth = viewports[i].translate[2]; - max_depth = viewports[i].translate[2] + viewports[i].scale[2]; + if (lp->rasterizer->clip_halfz == 0) { + float half_depth = viewports[i].scale[2]; + min_depth = viewports[i].translate[2] - half_depth; + max_depth = min_depth + half_depth * 2.0f; + } else { + min_depth = viewports[i].translate[2]; + max_depth = min_depth + viewports[i].scale[2]; + } if (setup->viewports[i].min_depth != min_depth || setup->viewports[i].max_depth != max_depth) { |