From daa19363def83c025ccf16106b3402268bf1f56f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 21 Aug 2018 21:59:23 -0400 Subject: [PATCH] gallium: split depth_clip into depth_clip_near & depth_clip_far for AMD_depth_clamp_separate. --- src/gallium/auxiliary/draw/draw_context.c | 2 +- src/gallium/auxiliary/driver_trace/tr_dump_state.c | 3 ++- src/gallium/auxiliary/hud/hud_context.c | 3 ++- src/gallium/auxiliary/postprocess/pp_program.c | 3 ++- src/gallium/auxiliary/util/u_blit.c | 3 ++- src/gallium/auxiliary/util/u_blitter.c | 3 ++- src/gallium/auxiliary/util/u_dump_state.c | 3 ++- src/gallium/auxiliary/util/u_tests.c | 3 ++- src/gallium/auxiliary/vl/vl_bicubic_filter.c | 4 +++- src/gallium/auxiliary/vl/vl_compositor.c | 3 ++- src/gallium/auxiliary/vl/vl_deint_filter.c | 4 +++- src/gallium/auxiliary/vl/vl_idct.c | 4 +++- src/gallium/auxiliary/vl/vl_matrix_filter.c | 4 +++- src/gallium/auxiliary/vl/vl_mc.c | 4 +++- src/gallium/auxiliary/vl/vl_median_filter.c | 4 +++- src/gallium/auxiliary/vl/vl_zscan.c | 4 +++- src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 4 ++-- src/gallium/drivers/freedreno/a3xx/fd3_program.c | 2 +- src/gallium/drivers/freedreno/a3xx/fd3_rasterizer.c | 2 +- src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 2 +- src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c | 2 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 2 +- src/gallium/drivers/nouveau/nv30/nv30_state.c | 2 +- src/gallium/drivers/nouveau/nv50/nv50_state.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 2 +- src/gallium/drivers/r600/evergreen_state.c | 4 ++-- src/gallium/drivers/r600/r600_state.c | 4 ++-- src/gallium/drivers/radeonsi/si_state.c | 4 ++-- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 4 ++-- src/gallium/drivers/svga/svga_pipe_rasterizer.c | 2 +- src/gallium/drivers/swr/swr_state.cpp | 2 +- src/gallium/drivers/virgl/virgl_encode.c | 2 +- src/gallium/include/pipe/p_state.h | 6 +++++- src/gallium/state_trackers/nine/nine_pipe.c | 3 ++- src/gallium/state_trackers/xa/xa_renderer.c | 3 ++- src/gallium/tests/graw/fs-test.c | 3 ++- src/gallium/tests/graw/gs-test.c | 3 ++- src/gallium/tests/graw/quad-sample.c | 3 ++- src/gallium/tests/graw/quad-tex.c | 3 ++- src/gallium/tests/graw/shader-leak.c | 3 ++- src/gallium/tests/graw/tri-gs.c | 3 ++- src/gallium/tests/graw/tri-instanced.c | 3 ++- src/gallium/tests/graw/tri-large.c | 3 ++- src/gallium/tests/graw/tri.c | 3 ++- src/gallium/tests/graw/vs-test.c | 3 ++- src/gallium/tests/trivial/quad-tex.c | 3 ++- src/gallium/tests/trivial/tri.c | 3 ++- src/mesa/state_tracker/st_atom_rasterizer.c | 4 ++-- src/mesa/state_tracker/st_cb_bitmap.c | 3 ++- src/mesa/state_tracker/st_cb_clear.c | 3 ++- src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++-- 51 files changed, 100 insertions(+), 58 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index e887272..3fc0967 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -275,7 +275,7 @@ draw_update_clip_flags(struct draw_context *draw) draw->guard_band_xy = (!draw->driver.bypass_clip_xy && draw->driver.guard_band_xy); draw->clip_z = (!draw->driver.bypass_clip_z && - draw->rasterizer && draw->rasterizer->depth_clip) && + draw->rasterizer && draw->rasterizer->depth_clip_near) && !window_space; draw->clip_user = draw->rasterizer && draw->rasterizer->clip_plane_enable != 0 && diff --git a/src/gallium/auxiliary/driver_trace/tr_dump_state.c b/src/gallium/auxiliary/driver_trace/tr_dump_state.c index 46fa574..88a50b8 100644 --- a/src/gallium/auxiliary/driver_trace/tr_dump_state.c +++ b/src/gallium/auxiliary/driver_trace/tr_dump_state.c @@ -143,7 +143,8 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state) trace_dump_member(bool, state, rasterizer_discard); - trace_dump_member(bool, state, depth_clip); + trace_dump_member(bool, state, depth_clip_near); + trace_dump_member(bool, state, depth_clip_far); trace_dump_member(bool, state, clip_halfz); diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 3dd7c10..9f9db85 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -1860,7 +1860,8 @@ hud_create(struct cso_context *cso, struct hud_context *share) /* rasterizer */ hud->rasterizer.half_pixel_center = 1; hud->rasterizer.bottom_edge_rule = 1; - hud->rasterizer.depth_clip = 1; + hud->rasterizer.depth_clip_near = 1; + hud->rasterizer.depth_clip_far = 1; hud->rasterizer.line_width = 1; hud->rasterizer.line_last_pixel = 1; diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c index cb06c8d..52786de 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.c +++ b/src/gallium/auxiliary/postprocess/pp_program.c @@ -91,7 +91,8 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe, p->rasterizer.cull_face = PIPE_FACE_NONE; p->rasterizer.half_pixel_center = 1; p->rasterizer.bottom_edge_rule = 1; - p->rasterizer.depth_clip = 1; + p->rasterizer.depth_clip_near = 1; + p->rasterizer.depth_clip_far = 1; p->sampler.wrap_s = p->sampler.wrap_t = p->sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index ca3d221..15edf2f 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -98,7 +98,8 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) ctx->rasterizer.cull_face = PIPE_FACE_NONE; ctx->rasterizer.half_pixel_center = 1; ctx->rasterizer.bottom_edge_rule = 1; - ctx->rasterizer.depth_clip = 1; + ctx->rasterizer.depth_clip_near = 1; + ctx->rasterizer.depth_clip_far = 1; /* samplers */ ctx->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index fc86fa3..e19fde9 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -276,7 +276,8 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) rs_state.half_pixel_center = 1; rs_state.bottom_edge_rule = 1; rs_state.flatshade = 1; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); rs_state.scissor = 1; diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index 286d5fa..638dac7 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -368,7 +368,8 @@ util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *sta util_dump_member(stream, bool, state, half_pixel_center); util_dump_member(stream, bool, state, bottom_edge_rule); util_dump_member(stream, bool, state, rasterizer_discard); - util_dump_member(stream, bool, state, depth_clip); + util_dump_member(stream, bool, state, depth_clip_near); + util_dump_member(stream, bool, state, depth_clip_far); util_dump_member(stream, bool, state, clip_halfz); util_dump_member(stream, uint, state, clip_plane_enable); diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c index 7360eb9..59953dc 100644 --- a/src/gallium/auxiliary/util/u_tests.c +++ b/src/gallium/auxiliary/util/u_tests.c @@ -108,7 +108,8 @@ util_set_rasterizer_normal(struct cso_context *cso) rs.half_pixel_center = 1; rs.bottom_edge_rule = 1; - rs.depth_clip = 1; + rs.depth_clip_near = 1; + rs.depth_clip_far = 1; cso_set_rasterizer(cso, &rs); } diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index a3dc6c8..f3f8cbe 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -262,7 +262,9 @@ vl_bicubic_filter_init(struct vl_bicubic_filter *filter, struct pipe_context *pi memset(&rs_state, 0, sizeof(rs_state)); rs_state.half_pixel_center = true; rs_state.bottom_edge_rule = true; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; + filter->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); if (!filter->rs_state) goto error_rs_state; diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 725bfd9..159a295 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -611,7 +611,8 @@ init_pipe_state(struct vl_compositor *c) rast.offset_scale = 1; rast.half_pixel_center = 1; rast.bottom_edge_rule = 1; - rast.depth_clip = 1; + rast.depth_clip_near = 1; + rast.depth_clip_far = 1; c->rast = c->pipe->create_rasterizer_state(c->pipe, &rast); diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c index d2c48bd..dbd6be5 100644 --- a/src/gallium/auxiliary/vl/vl_deint_filter.c +++ b/src/gallium/auxiliary/vl/vl_deint_filter.c @@ -273,7 +273,9 @@ vl_deint_filter_init(struct vl_deint_filter *filter, struct pipe_context *pipe, memset(&rs_state, 0, sizeof(rs_state)); rs_state.half_pixel_center = true; rs_state.bottom_edge_rule = true; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; + filter->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); if (!filter->rs_state) goto error_rs_state; diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index 3e6f581..91ff02b 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -516,7 +516,9 @@ init_state(struct vl_idct *idct) rs_state.point_size = 1; rs_state.half_pixel_center = true; rs_state.bottom_edge_rule = true; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; + idct->rs_state = idct->pipe->create_rasterizer_state(idct->pipe, &rs_state); if (!idct->rs_state) goto error_rs_state; diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index 1dacc7c..4a24c6a 100644 --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c @@ -151,7 +151,9 @@ vl_matrix_filter_init(struct vl_matrix_filter *filter, struct pipe_context *pipe memset(&rs_state, 0, sizeof(rs_state)); rs_state.half_pixel_center = true; rs_state.bottom_edge_rule = true; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; + filter->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); if (!filter->rs_state) goto error_rs_state; diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index a202fac..414aff9 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -434,7 +434,9 @@ init_pipe_state(struct vl_mc *r) rs_state.point_size = VL_BLOCK_WIDTH; rs_state.half_pixel_center = true; rs_state.bottom_edge_rule = true; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; + r->rs_state = r->pipe->create_rasterizer_state(r->pipe, &rs_state); if (!r->rs_state) goto error_rs_state; diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c index 273afaf..b10237d 100644 --- a/src/gallium/auxiliary/vl/vl_median_filter.c +++ b/src/gallium/auxiliary/vl/vl_median_filter.c @@ -262,7 +262,9 @@ vl_median_filter_init(struct vl_median_filter *filter, struct pipe_context *pipe memset(&rs_state, 0, sizeof(rs_state)); rs_state.half_pixel_center = true; rs_state.bottom_edge_rule = true; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; + filter->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); if (!filter->rs_state) goto error_rs_state; diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index 75013c4..769fc71 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -297,7 +297,9 @@ init_state(struct vl_zscan *zscan) memset(&rs_state, 0, sizeof(rs_state)); rs_state.half_pixel_center = true; rs_state.bottom_edge_rule = true; - rs_state.depth_clip = 1; + rs_state.depth_clip_near = 1; + rs_state.depth_clip_far = 1; + zscan->rs_state = zscan->pipe->create_rasterizer_state(zscan->pipe, &rs_state); if (!zscan->rs_state) goto error_rs_state; diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index bab3d3d..c970ef6 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -557,7 +557,7 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, if (fp->has_kill) { val |= A3XX_RB_DEPTH_CONTROL_EARLY_Z_DISABLE; } - if (!ctx->rasterizer->depth_clip) { + if (!ctx->rasterizer->depth_clip_near) { val |= A3XX_RB_DEPTH_CONTROL_Z_CLAMP_ENABLE; } OUT_PKT0(ring, REG_A3XX_RB_DEPTH_CONTROL, 1); @@ -652,7 +652,7 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, * or nothing deal. So when we disable clipping, we must handle the * viewport clip via scissors. */ - if (!ctx->rasterizer->depth_clip) { + if (!ctx->rasterizer->depth_clip_near) { struct pipe_viewport_state *vp = &ctx->viewport; minx = MAX2(minx, (int)floorf(vp->translate[0] - fabsf(vp->scale[0]))); miny = MAX2(miny, (int)floorf(vp->translate[1] - fabsf(vp->scale[1]))); diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c index b6f8ff3..87ba28a 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c @@ -83,7 +83,7 @@ fd3_needs_manual_clipping(const struct ir3_shader *shader, { uint64_t outputs = ir3_shader_outputs(shader); - return (!rast->depth_clip || + return (!rast->depth_clip_near || util_bitcount(rast->clip_plane_enable) > 6 || outputs & ((1ULL << VARYING_SLOT_CLIP_VERTEX) | (1ULL << VARYING_SLOT_CLIP_DIST0) | diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_rasterizer.c b/src/gallium/drivers/freedreno/a3xx/fd3_rasterizer.c index 260eacd..6efff82 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_rasterizer.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_rasterizer.c @@ -98,7 +98,7 @@ fd3_rasterizer_state_create(struct pipe_context *pctx, if (cso->offset_tri) so->gras_su_mode_control |= A3XX_GRAS_SU_MODE_CONTROL_POLY_OFFSET; - if (!cso->depth_clip) + if (!cso->depth_clip_near) so->gras_cl_clip_cntl |= A3XX_GRAS_CL_CLIP_CNTL_CLIP_DISABLE; return so; diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index 8470fa9..13cb2c4 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -561,7 +561,7 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, if (dirty & (FD_DIRTY_ZSA | FD_DIRTY_RASTERIZER | FD_DIRTY_PROG)) { struct fd4_zsa_stateobj *zsa = fd4_zsa_stateobj(ctx->zsa); bool fragz = fp->has_kill | fp->writes_pos; - bool clamp = !ctx->rasterizer->depth_clip; + bool clamp = !ctx->rasterizer->depth_clip_near; OUT_PKT0(ring, REG_A4XX_RB_DEPTH_CONTROL, 1); OUT_RING(ring, zsa->rb_depth_control | diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c b/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c index b3a4292..b57ac19 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_rasterizer.c @@ -97,7 +97,7 @@ fd4_rasterizer_state_create(struct pipe_context *pctx, if (cso->offset_tri) so->gras_su_mode_control |= A4XX_GRAS_SU_MODE_CONTROL_POLY_OFFSET; - if (!cso->depth_clip) + if (!cso->depth_clip_near) so->gras_cl_clip_cntl |= A4XX_GRAS_CL_CLIP_CNTL_ZNEAR_CLIP_DISABLE | A4XX_GRAS_CL_CLIP_CNTL_ZFAR_CLIP_DISABLE; if (cso->clip_halfz) diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index b7e16f9..ab285be 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -3212,7 +3212,7 @@ make_variant_key(struct llvmpipe_context *lp, if (lp->rasterizer->clip_halfz) { key->depth_clamp = 1; } else { - key->depth_clamp = (lp->rasterizer->depth_clip == 0) ? 1 : 0; + key->depth_clamp = (lp->rasterizer->depth_clip_near == 0) ? 1 : 0; } /* alpha test only applies if render buffer 0 is non-integer (or does not exist) */ diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state.c b/src/gallium/drivers/nouveau/nv30/nv30_state.c index 2a81225..19e10d3 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_state.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_state.c @@ -188,7 +188,7 @@ nv30_rasterizer_state_create(struct pipe_context *pipe, SB_DATA (so, cso->flatshade_first); SB_MTHD30(so, DEPTH_CONTROL, 1); - SB_DATA (so, cso->depth_clip ? 0x00000001 : 0x00000010); + SB_DATA (so, cso->depth_clip_near ? 0x00000001 : 0x00000010); return so; } diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index a7d86b0..fb4a259 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -315,7 +315,7 @@ nv50_rasterizer_state_create(struct pipe_context *pipe, SB_DATA (so, fui(cso->offset_clamp)); } - if (cso->depth_clip) { + if (cso->depth_clip_near) { reg = 0; } else { reg = diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index d9ee625..f2393cb 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -311,7 +311,7 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe, SB_DATA (so, fui(cso->offset_clamp)); } - if (cso->depth_clip) + if (cso->depth_clip_near) reg = NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1_UNK1; else reg = diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index cc41e11..49c9ad9 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -492,8 +492,8 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, S_028A0C_REPEAT_COUNT(state->line_stipple_factor) : 0; rs->pa_cl_clip_cntl = S_028810_DX_CLIP_SPACE_DEF(state->clip_halfz) | - S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip) | - S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip) | + S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip_near) | + S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip_near) | S_028810_DX_LINEAR_ATTR_CLIP_ENA(1) | S_028810_DX_RASTERIZATION_KILL(state->rasterizer_discard); rs->multisample_enable = state->multisample; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index c26a38d..9a49ba0 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -479,8 +479,8 @@ static void *r600_create_rs_state(struct pipe_context *ctx, S_028A0C_REPEAT_COUNT(state->line_stipple_factor) : 0; rs->pa_cl_clip_cntl = S_028810_DX_CLIP_SPACE_DEF(state->clip_halfz) | - S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip) | - S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip) | + S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip_near) | + S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip_near) | S_028810_DX_LINEAR_ATTR_CLIP_ENA(1); if (rctx->b.chip_class == R700) { rs->pa_cl_clip_cntl |= diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 780d901..18024a9 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -869,8 +869,8 @@ static void *si_create_rs_state(struct pipe_context *ctx, S_028A0C_REPEAT_COUNT(state->line_stipple_factor) : 0; rs->pa_cl_clip_cntl = S_028810_DX_CLIP_SPACE_DEF(state->clip_halfz) | - S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip) | - S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip) | + S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip_near) | + S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip_near) | S_028810_DX_RASTERIZATION_KILL(state->rasterizer_discard) | S_028810_DX_LINEAR_ATTR_CLIP_ENA(1); diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 847a616..98dd36d 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -803,7 +803,7 @@ depth_test_quads_fallback(struct quad_stage *qs, data.tile = sp_get_cached_tile(qs->softpipe->zsbuf_cache, quads[0]->input.x0, quads[0]->input.y0, quads[0]->input.layer); - data.clamp = !qs->softpipe->rasterizer->depth_clip; + data.clamp = !qs->softpipe->rasterizer->depth_clip_near; near_val = qs->softpipe->viewports[vp_idx].translate[2] - qs->softpipe->viewports[vp_idx].scale[2]; far_val = near_val + (qs->softpipe->viewports[vp_idx].scale[2] * 2.0); @@ -916,7 +916,7 @@ choose_depth_test(struct quad_stage *qs, boolean occlusion = qs->softpipe->active_query_count; - boolean clipped = !qs->softpipe->rasterizer->depth_clip; + boolean clipped = !qs->softpipe->rasterizer->depth_clip_near; if(!qs->softpipe->framebuffer.zsbuf) depth = depthwrite = stencil = FALSE; diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c index d54ce2d..bc0acd9 100644 --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -142,7 +142,7 @@ define_rasterizer_object(struct svga_context *svga, depth_bias, depth_bias_clamp, slope_scaled_depth_bias, - rast->templ.depth_clip, + rast->templ.depth_clip_near, rast->templ.scissor, rast->templ.multisample, rast->templ.line_smooth, diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index c5d755d..e540ddb 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1198,7 +1198,7 @@ swr_update_derived(struct pipe_context *pipe, if (zb && swr_resource(zb->texture)->has_depth) rastState->depthFormat = swr_resource(zb->texture)->swr.format; - rastState->depthClipEnable = rasterizer->depth_clip; + rastState->depthClipEnable = rasterizer->depth_clip_near; rastState->clipHalfZ = rasterizer->clip_halfz; ctx->api.pfnSwrSetRastState(ctx->swrContext, rastState); diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index 29920b2..d130e40 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -154,7 +154,7 @@ int virgl_encode_rasterizer_state(struct virgl_context *ctx, virgl_encoder_write_dword(ctx->cbuf, handle); tmp = VIRGL_OBJ_RS_S0_FLATSHADE(state->flatshade) | - VIRGL_OBJ_RS_S0_DEPTH_CLIP(state->depth_clip) | + VIRGL_OBJ_RS_S0_DEPTH_CLIP(state->depth_clip_near) | VIRGL_OBJ_RS_S0_CLIP_HALFZ(state->clip_halfz) | VIRGL_OBJ_RS_S0_RASTERIZER_DISCARD(state->rasterizer_discard) | VIRGL_OBJ_RS_S0_FLATSHADE_FIRST(state->flatshade_first) | diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 671cccd..95a18a7 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -151,8 +151,12 @@ struct pipe_rasterizer_state * When false, depth clipping is disabled and the depth value will be * clamped later at the per-pixel level before depth testing. * This depends on PIPE_CAP_DEPTH_CLIP_DISABLE. + * + * If PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE is unsupported, depth_clip_near + * is equal to depth_clip_far. */ - unsigned depth_clip:1; + unsigned depth_clip_near:1; + unsigned depth_clip_far:1; /** * When true clip space in the z axis goes from [0..1] (D3D). When false diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c index a28b4c6..a84a17f 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.c +++ b/src/gallium/state_trackers/nine/nine_pipe.c @@ -105,7 +105,8 @@ nine_convert_rasterizer_state(struct NineDevice9 *device, /* rast.lower_left_origin = 0; */ /* rast.bottom_edge_rule = 0; */ /* rast.rasterizer_discard = 0; */ - rast.depth_clip = 1; + rast.depth_clip_near = 1; + rast.depth_clip_far = 1; rast.clip_halfz = 1; rast.clip_plane_enable = rs[D3DRS_CLIPPLANEENABLE]; /* rast.line_stipple_factor = 0; */ diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c index e331123..d87a14e 100644 --- a/src/gallium/state_trackers/xa/xa_renderer.c +++ b/src/gallium/state_trackers/xa/xa_renderer.c @@ -121,7 +121,8 @@ renderer_init_state(struct xa_context *r) memset(&raster, 0, sizeof(struct pipe_rasterizer_state)); raster.half_pixel_center = 1; raster.bottom_edge_rule = 1; - raster.depth_clip = 1; + raster.depth_clip_near = 1; + raster.depth_clip_far = 1; raster.scissor = 1; cso_set_rasterizer(r->cso, &raster); diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index cc87b02..a4182be 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -458,7 +458,8 @@ static void init( void ) rasterizer.cull_face = PIPE_FACE_NONE; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = ctx->create_rasterizer_state(ctx, &rasterizer); ctx->bind_rasterizer_state(ctx, handle); } diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 9c3c29b..a984e0a 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -548,7 +548,8 @@ static void init( void ) rasterizer.cull_face = PIPE_FACE_NONE; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = ctx->create_rasterizer_state(ctx, &rasterizer); ctx->bind_rasterizer_state(ctx, handle); } diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index d532e60..a502948 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -373,7 +373,8 @@ static void init( void ) rasterizer.cull_face = PIPE_FACE_NONE; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = ctx->create_rasterizer_state(ctx, &rasterizer); ctx->bind_rasterizer_state(ctx, handle); } diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index 444f64e..35ba4fa 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -192,7 +192,8 @@ static void init( void ) rasterizer.cull_face = PIPE_FACE_NONE; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = info.ctx->create_rasterizer_state(info.ctx, &rasterizer); info.ctx->bind_rasterizer_state(info.ctx, handle); } diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index 4178448..8fa1a72 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -250,7 +250,8 @@ static void init( void ) rasterizer.cull_face = PIPE_FACE_NONE; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = ctx->create_rasterizer_state(ctx, &rasterizer); ctx->bind_rasterizer_state(ctx, handle); } diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 5efc9e8..ed721f37 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -255,7 +255,8 @@ static void init( void ) rasterizer.cull_face = PIPE_FACE_NONE; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = ctx->create_rasterizer_state(ctx, &rasterizer); ctx->bind_rasterizer_state(ctx, handle); } diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 9bd2ff5..297377b 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -306,7 +306,8 @@ static void init( void ) rasterizer.cull_face = PIPE_FACE_NONE; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = ctx->create_rasterizer_state(ctx, &rasterizer); ctx->bind_rasterizer_state(ctx, handle); } diff --git a/src/gallium/tests/graw/tri-large.c b/src/gallium/tests/graw/tri-large.c index 1ca915a..78a2ddb 100644 --- a/src/gallium/tests/graw/tri-large.c +++ b/src/gallium/tests/graw/tri-large.c @@ -131,7 +131,8 @@ static void init( void ) rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; rasterizer.flatshade = FlatShade; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = info.ctx->create_rasterizer_state(info.ctx, &rasterizer); info.ctx->bind_rasterizer_state(info.ctx, handle); } diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index b62a2ab..2267d98 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -128,7 +128,8 @@ static void init( void ) rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; rasterizer.flatshade = FlatShade; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = info.ctx->create_rasterizer_state(info.ctx, &rasterizer); info.ctx->bind_rasterizer_state(info.ctx, handle); } diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index 26976f4..b371454 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -447,7 +447,8 @@ static void init( void ) rasterizer.point_size = 8.0; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = 1; + rasterizer.depth_clip_near = 1; + rasterizer.depth_clip_far = 1; handle = ctx->create_rasterizer_state(ctx, &rasterizer); ctx->bind_rasterizer_state(ctx, handle); } diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index 1f29306..9a9d701 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -200,7 +200,8 @@ static void init_prog(struct program *p) p->rasterizer.cull_face = PIPE_FACE_NONE; p->rasterizer.half_pixel_center = 1; p->rasterizer.bottom_edge_rule = 1; - p->rasterizer.depth_clip = 1; + p->rasterizer.depth_clip_near = 1; + p->rasterizer.depth_clip_far = 1; /* sampler */ memset(&p->sampler, 0, sizeof(p->sampler)); diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c index 87a335f..3827edc 100644 --- a/src/gallium/tests/trivial/tri.c +++ b/src/gallium/tests/trivial/tri.c @@ -154,7 +154,8 @@ static void init_prog(struct program *p) p->rasterizer.cull_face = PIPE_FACE_NONE; p->rasterizer.half_pixel_center = 1; p->rasterizer.bottom_edge_rule = 1; - p->rasterizer.depth_clip = 1; + p->rasterizer.depth_clip_near = 1; + p->rasterizer.depth_clip_far = 1; surf_tmpl.format = PIPE_FORMAT_B8G8R8A8_UNORM; surf_tmpl.u.tex.level = 0; diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 1f66b9d..2bffa68 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -294,8 +294,8 @@ st_update_rasterizer(struct st_context *st) } /* _NEW_TRANSFORM */ - raster->depth_clip = !(ctx->Transform.DepthClampNear && - ctx->Transform.DepthClampFar); + raster->depth_clip_near = !ctx->Transform.DepthClampNear; + raster->depth_clip_far = !ctx->Transform.DepthClampFar; raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled; raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE); diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index babb001..a73d6c7 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -560,7 +560,8 @@ init_bitmap_state(struct st_context *st) memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer)); st->bitmap.rasterizer.half_pixel_center = 1; st->bitmap.rasterizer.bottom_edge_rule = 1; - st->bitmap.rasterizer.depth_clip = 1; + st->bitmap.rasterizer.depth_clip_near = 1; + st->bitmap.rasterizer.depth_clip_far = 1; /* find a usable texture format */ if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index fbc577a..22e8501 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -71,7 +71,8 @@ st_init_clear(struct st_context *st) st->clear.raster.half_pixel_center = 1; st->clear.raster.bottom_edge_rule = 1; - st->clear.raster.depth_clip = 1; + st->clear.raster.depth_clip_near = 1; + st->clear.raster.depth_clip_far = 1; } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 67bbb35..cb50b71 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -677,8 +677,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, ctx->Color._ClampFragmentColor; rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; - rasterizer.depth_clip = !(ctx->Transform.DepthClampNear && - ctx->Transform.DepthClampFar); + rasterizer.depth_clip_near = !ctx->Transform.DepthClampNear; + rasterizer.depth_clip_far = !ctx->Transform.DepthClampFar; rasterizer.scissor = ctx->Scissor.EnableFlags; cso_set_rasterizer(cso, &rasterizer); } -- 2.7.4