[Mesa-dev] [PATCH 1/2] gallium: add pipe_depth_state::disable_occlusion_queries
Roland Scheidegger
sroland at vmware.com
Thu Apr 7 01:22:33 UTC 2016
Where's the doc bits...
But aside from that, this doesn't look quite right to me. Doesn't really
feel like depth state (more like context one to suspend queries), and
more importantly it should most likely apply to all queries, not just
occlusion ones (making it definitely no longer dsa state).
Roland
Am 07.04.2016 um 03:00 schrieb Marek Olšák:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Since occlusion queries count Z passes, the depth state seems to be
> the best place.
> ---
> src/gallium/auxiliary/hud/hud_context.c | 2 ++
> src/gallium/auxiliary/postprocess/pp_mlaa.c | 1 +
> src/gallium/auxiliary/postprocess/pp_program.c | 1 +
> src/gallium/auxiliary/util/u_blit.c | 1 +
> src/gallium/auxiliary/util/u_blitter.c | 1 +
> src/gallium/include/pipe/p_state.h | 1 +
> src/mesa/state_tracker/st_cb_clear.c | 2 ++
> src/mesa/state_tracker/st_cb_texture.c | 1 +
> 8 files changed, 10 insertions(+)
>
> diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
> index 4673458..2b2fabb 100644
> --- a/src/gallium/auxiliary/hud/hud_context.c
> +++ b/src/gallium/auxiliary/hud/hud_context.c
> @@ -1178,6 +1178,8 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso)
> hud->alpha_blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ZERO;
> hud->alpha_blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
>
> + hud->dsa.depth.disable_occlusion_queries = 1;
> +
> /* fragment shader */
> hud->fs_color =
> util_make_fragment_passthrough_shader(pipe,
> diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c
> index a3f58b5..2640340 100644
> --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
> +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
> @@ -124,6 +124,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
> mstencil.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
> mstencil.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
> mstencil.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
> + mstencil.depth.disable_occlusion_queries = 1;
>
> p->framebuffer.zsbuf = ppq->stencils;
>
> diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c
> index 811f1fb..8b468eb 100644
> --- a/src/gallium/auxiliary/postprocess/pp_program.c
> +++ b/src/gallium/auxiliary/postprocess/pp_program.c
> @@ -56,6 +56,7 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
> p->screen = pipe->screen;
> p->pipe = pipe;
> p->cso = cso;
> + p->depthstencil.depth.disable_occlusion_queries = 1;
>
> {
> static const float verts[4][2][4] = {
> diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
> index 22c40d1..2711899 100644
> --- a/src/gallium/auxiliary/util/u_blit.c
> +++ b/src/gallium/auxiliary/util/u_blit.c
> @@ -93,6 +93,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
>
> /* disabled blending/masking */
> ctx->blend_write_color.rt[0].colormask = PIPE_MASK_RGBA;
> + ctx->dsa_keep_depthstencil.depth.disable_occlusion_queries = 1;
>
> /* rasterizer */
> ctx->rasterizer.cull_face = PIPE_FACE_NONE;
> diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
> index 43fbd8e..790562a 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -226,6 +226,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
>
> /* depth stencil alpha state objects */
> memset(&dsa, 0, sizeof(dsa));
> + dsa.depth.disable_occlusion_queries = 1;
> ctx->dsa_keep_depth_stencil =
> pipe->create_depth_stencil_alpha_state(pipe, &dsa);
>
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index 5ab5372..681e6ec 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -225,6 +225,7 @@ struct pipe_depth_state
> unsigned writemask:1; /**< allow depth buffer writes? */
> unsigned func:3; /**< depth test func (PIPE_FUNC_x) */
> unsigned bounds_test:1; /**< depth bounds test enabled? */
> + unsigned disable_occlusion_queries:1; /**< force off occlusion queries */
> float bounds_min; /**< minimum depth bound */
> float bounds_max; /**< maximum depth bound */
> };
> diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
> index 5580146..6216eab 100644
> --- a/src/mesa/state_tracker/st_cb_clear.c
> +++ b/src/mesa/state_tracker/st_cb_clear.c
> @@ -243,6 +243,8 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
> {
> struct pipe_depth_stencil_alpha_state depth_stencil;
> memset(&depth_stencil, 0, sizeof(depth_stencil));
> + depth_stencil.depth.disable_occlusion_queries = 1;
> +
> if (clear_buffers & PIPE_CLEAR_DEPTH) {
> depth_stencil.depth.enabled = 1;
> depth_stencil.depth.writemask = 1;
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index 3980f5d..1802cde 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1492,6 +1492,7 @@ try_pbo_upload_common(struct gl_context *ctx,
> {
> struct pipe_depth_stencil_alpha_state dsa;
> memset(&dsa, 0, sizeof(dsa));
> + dsa.depth.disable_occlusion_queries = 1;
> cso_set_depth_stencil_alpha(cso, &dsa);
> }
>
>
More information about the mesa-dev
mailing list