diff options
author | Marek Olšák <[email protected]> | 2018-08-21 21:59:23 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-09-06 21:53:00 -0400 |
commit | daa19363def83c025ccf16106b3402268bf1f56f (patch) | |
tree | 94fd791ebf78e36f29ddf8c8cd665a3731688d6e | |
parent | 7b26741806c521279a1b83f2eae40a277d806626 (diff) |
gallium: split depth_clip into depth_clip_near & depth_clip_far
for AMD_depth_clamp_separate.
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 e887272e154..3fc096789c0 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 46fa5747460..88a50b80903 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 3dd7c102edb..9f9db850a71 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 cb06c8d81f3..52786de297b 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 ca3d221ed36..15edf2f48dc 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 fc86fa367c6..e19fde9873d 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 286d5fad75b..638dac79db2 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 7360eb97639..59953dc70a4 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 a3dc6c8c5cf..f3f8cbee778 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 725bfd9126e..159a2952af4 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 d2c48bda7f9..dbd6be534e9 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 3e6f581244e..91ff02b3911 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 1dacc7c6025..4a24c6a3f97 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 a202fac54b0..414aff9623f 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 273afaf2fb2..b10237d1e56 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 75013c42bfe..769fc71ff42 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 bab3d3d28c8..c970ef63ee7 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 b6f8ff33c47..87ba28a6b2c 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 260eacd301a..6efff82e336 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 8470fa95783..13cb2c44375 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 b3a42929c50..b57ac19bef8 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 b7e16f92469..ab285bed1ca 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 2a812252c98..19e10d31d92 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 a7d86b0f90c..fb4a259ce16 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 d9ee62523b9..f2393cb27b5 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 cc41e114369..49c9ad9ee4a 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 c26a38d9264..9a49ba065f4 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 780d9010abc..18024a9f77d 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 847a616f491..98dd36d21a3 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 d54ce2d4180..bc0acd94625 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 c5d755d7200..e540ddb06c8 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 29920b22be5..d130e4059e6 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 671cccda4eb..95a18a72b5c 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 a28b4c6d57a..a84a17f551f 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 e3311232e77..d87a14e8088 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 cc87b02a0a2..a4182be55bd 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 9c3c29bc3c6..a984e0acfb0 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 d532e60e1e2..a5029484b3b 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 444f64e947f..35ba4fa3469 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 4178448f768..8fa1a727f54 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 5efc9e87c4c..ed721f378b1 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 9bd2ff58687..297377b894e 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 1ca915aa126..78a2ddbda44 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 b62a2ab4896..2267d98a8fe 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 26976f41682..b3714543b3a 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 1f29306ec04..9a9d7012249 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 87a335fba1e..3827edc0da3 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 1f66b9d0597..2bffa684a25 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 babb00178ae..a73d6c7e062 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 fbc577a370c..22e85019764 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 67bbb358500..cb50b7104a0 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); } |