summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c1
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c9
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c9
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c20
-rw-r--r--src/gallium/docs/source/cso/rasterizer.rst4
-rw-r--r--src/gallium/include/pipe/p_state.h6
8 files changed, 29 insertions, 24 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 0f98021247a..5272951d2b3 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -712,6 +712,7 @@ draw_get_rasterizer_no_cull( struct draw_context *draw,
rast.flatshade = flatshade;
rast.front_ccw = 1;
rast.gl_rasterization_rules = draw->rasterizer->gl_rasterization_rules;
+ rast.clip_halfz = draw->rasterizer->clip_halfz;
draw->rasterizer_no_cull[scissor][flatshade] =
pipe->create_rasterizer_state(pipe, &rast);
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index e0c07057441..e1c08c6b58d 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1669,7 +1669,7 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
key->clip_z = llvm->draw->clip_z;
key->clip_user = llvm->draw->clip_user;
key->bypass_viewport = llvm->draw->identity_viewport;
- key->clip_halfz = !llvm->draw->rasterizer->gl_rasterization_rules;
+ key->clip_halfz = llvm->draw->rasterizer->clip_halfz;
key->need_edgeflags = (llvm->draw->vs.edgeflag_output ? TRUE : FALSE);
key->ucp_enable = llvm->draw->rasterizer->clip_plane_enable;
key->has_gs = llvm->draw->gs.geometry_shader != NULL;
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h
index 764d3111755..dca836859cc 100644
--- a/src/gallium/auxiliary/draw/draw_pt.h
+++ b/src/gallium/auxiliary/draw/draw_pt.h
@@ -233,7 +233,7 @@ void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
boolean clip_user,
boolean guard_band,
boolean bypass_viewport,
- boolean opengl,
+ boolean clip_halfz,
boolean need_edgeflags );
struct pt_post_vs *draw_pt_post_vs_create( struct draw_context *draw );
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index ab32a8033ac..664c5949e8c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -107,17 +107,14 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
vs->info.num_inputs,
fpme->vertex_size,
instance_id_index );
- /* XXX: it's not really gl rasterization rules we care about here,
- * but gl vs dx9 clip spaces.
- */
draw_pt_post_vs_prepare( fpme->post_vs,
draw->clip_xy,
draw->clip_z,
draw->clip_user,
draw->guard_band_xy,
- draw->identity_viewport,
- (boolean)draw->rasterizer->gl_rasterization_rules,
- (draw->vs.edgeflag_output ? TRUE : FALSE) );
+ draw->identity_viewport,
+ draw->rasterizer->clip_halfz,
+ (draw->vs.edgeflag_output ? TRUE : FALSE) );
draw_pt_so_emit_prepare( fpme->so_emit, FALSE );
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index 31bd7ce734d..7ce845ed7da 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -158,17 +158,14 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
fpme->vertex_size = sizeof(struct vertex_header) + nr * 4 * sizeof(float);
- /* XXX: it's not really gl rasterization rules we care about here,
- * but gl vs dx9 clip spaces.
- */
draw_pt_post_vs_prepare( fpme->post_vs,
draw->clip_xy,
draw->clip_z,
draw->clip_user,
draw->guard_band_xy,
- draw->identity_viewport,
- (boolean)draw->rasterizer->gl_rasterization_rules,
- (draw->vs.edgeflag_output ? TRUE : FALSE) );
+ draw->identity_viewport,
+ draw->rasterizer->clip_halfz,
+ (draw->vs.edgeflag_output ? TRUE : FALSE) );
draw_pt_so_emit_prepare( fpme->so_emit, gs == NULL );
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index a83bb59a748..021265633f7 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -127,14 +127,14 @@ void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
boolean clip_user,
boolean guard_band,
boolean bypass_viewport,
- boolean opengl,
+ boolean clip_halfz,
boolean need_edgeflags )
{
pvs->flags = 0;
/* This combination not currently tested/in use:
*/
- if (opengl)
+ if (!clip_halfz)
guard_band = FALSE;
if (clip_xy && !guard_band) {
@@ -152,14 +152,14 @@ void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
ASSIGN_4V( pvs->draw->plane[3], 0, 0.5, 0, 1 );
}
- if (clip_z && opengl) {
- pvs->flags |= DO_CLIP_FULL_Z;
- ASSIGN_4V( pvs->draw->plane[4], 0, 0, 1, 1 );
- }
-
- if (clip_z && !opengl) {
- pvs->flags |= DO_CLIP_HALF_Z;
- ASSIGN_4V( pvs->draw->plane[4], 0, 0, 1, 0 );
+ if (clip_z) {
+ if (clip_halfz) {
+ pvs->flags |= DO_CLIP_HALF_Z;
+ ASSIGN_4V( pvs->draw->plane[4], 0, 0, 1, 0 );
+ } else {
+ pvs->flags |= DO_CLIP_FULL_Z;
+ ASSIGN_4V( pvs->draw->plane[4], 0, 0, 1, 1 );
+ }
}
if (clip_user)
diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst
index 8338243be9f..be4bad56c00 100644
--- a/src/gallium/docs/source/cso/rasterizer.rst
+++ b/src/gallium/docs/source/cso/rasterizer.rst
@@ -242,6 +242,10 @@ gl_rasterization_rules
Whether the rasterizer should use (0.5, 0.5) pixel centers. When not set,
the rasterizer will use (0, 0) for pixel centers.
+clip_halfz
+ When true clip space in the z axis goes from [0..1] (D3D). When false
+ [-1, 1] (GL)
+
depth_clip
When false, the near and far depth clipping planes of the view volume are
disabled and the depth value will be clamped at the per-pixel level, after
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index dfafd0bb99f..5da3a533e85 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -134,6 +134,12 @@ struct pipe_rasterizer_state
unsigned depth_clip:1;
/**
+ * When true clip space in the z axis goes from [0..1] (D3D). When false
+ * [-1, 1] (GL).
+ */
+ unsigned clip_halfz:1;
+
+ /**
* Enable bits for clipping half-spaces.
* This applies to both user clip planes and shader clip distances.
* Note that if the bound shader exports any clip distances, these