From 0319ea9ff6a9cc2eba4879fbe09c6fac137d6ce1 Mon Sep 17 00:00:00 2001 From: Matthew McClure Date: Tue, 26 Nov 2013 10:50:27 -0800 Subject: llvmpipe: clamp fragment shader depth write to the current viewport depth range. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this patch, generate_fs_loop will clamp any fragment shader depth writes to the viewport's min and max depth values. Viewport selection is determined by the geometry shader output for the viewport array index. If no index is specified, then the default viewport index is zero. Semantics for this path can be found in draw_clamp_viewport_idx and lp_clamp_viewport_idx. lp_jit_viewport was created to store viewport information visible to JIT code, and is validated when the LP_NEW_VIEWPORT dirty flag is set. lp_rast_shader_inputs is responsible for passing the viewport_index through the rasterizer stage to fragment stage (via lp_jit_thread_data). Reviewed-by: Roland Scheidegger Reviewed-by: José Fonseca --- src/gallium/drivers/llvmpipe/lp_setup.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/llvmpipe/lp_setup.h') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 712ed145d8e..f4fbd3dbf65 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -120,6 +120,11 @@ void lp_setup_set_scissors( struct lp_setup_context *setup, const struct pipe_scissor_state *scissors ); +void +lp_setup_set_viewports(struct lp_setup_context *setup, + unsigned num_viewports, + const struct pipe_viewport_state *viewports); + void lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, unsigned num, @@ -155,7 +160,7 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq); static INLINE unsigned -lp_clamp_scissor_idx(int idx) +lp_clamp_viewport_idx(int idx) { return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0; } -- cgit v1.2.3