[Mesa-dev] [RFC] gallium/st/drivers: Extend render_condition() Add a new boolean flag: inverted Adopt all places where we make use of this This will be used to implement ARB_conditional_render_inverted, where we can just make use of the already implemented PIPE_RENDER_COND_* and invert them.

Roland Scheidegger sroland at vmware.com
Thu Aug 14 16:17:05 PDT 2014


NAK.
This is unnecessary, the condition parameter can already handle that
(and was added for that purpose, though for d3d10 only at that time -
793e8e3d7ed816cc9a066245dde798afdcf8b581). Can't speak for other
drivers, but llvmpipe/softpipe already handle it in any case.
Otherwise, I'd still have to reject it on the grounds of ridiculously
long commit shortlog :-).

Roland


Am 15.08.2014 00:53, schrieb Tobias Klausmann:
> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
> ---
>  src/gallium/auxiliary/util/u_blitter.c          | 5 +++--
>  src/gallium/drivers/galahad/glhd_context.c      | 5 +++--
>  src/gallium/drivers/ilo/ilo_3d.c                | 3 ++-
>  src/gallium/drivers/llvmpipe/lp_context.c       | 3 ++-
>  src/gallium/drivers/nouveau/nv30/nv30_query.c   | 3 ++-
>  src/gallium/drivers/nouveau/nv50/nv50_query.c   | 3 ++-
>  src/gallium/drivers/nouveau/nv50/nv50_surface.c | 3 ++-
>  src/gallium/drivers/nouveau/nvc0/nvc0_query.c   | 3 ++-
>  src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 3 ++-
>  src/gallium/drivers/r300/r300_query.c           | 3 ++-
>  src/gallium/drivers/radeon/r600_pipe_common.c   | 5 +++--
>  src/gallium/drivers/radeon/r600_query.c         | 3 ++-
>  src/gallium/drivers/softpipe/sp_context.c       | 3 ++-
>  src/gallium/include/pipe/p_context.h            | 4 +++-
>  14 files changed, 32 insertions(+), 17 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
> index 20fbd80..706f516 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -545,7 +545,7 @@ static void blitter_disable_render_cond(struct blitter_context_priv *ctx)
>     struct pipe_context *pipe = ctx->base.pipe;
>  
>     if (ctx->base.saved_render_cond_query) {
> -      pipe->render_condition(pipe, NULL, FALSE, 0);
> +      pipe->render_condition(pipe, NULL, FALSE, 0, FALSE);
>     }
>  }
>  
> @@ -556,7 +556,8 @@ static void blitter_restore_render_cond(struct blitter_context_priv *ctx)
>     if (ctx->base.saved_render_cond_query) {
>        pipe->render_condition(pipe, ctx->base.saved_render_cond_query,
>                               ctx->base.saved_render_cond_cond,
> -                             ctx->base.saved_render_cond_mode);
> +                             ctx->base.saved_render_cond_mode,
> +                             FALSE);
>        ctx->base.saved_render_cond_query = NULL;
>     }
>  }
> diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
> index 79d5495..c17f49f 100644
> --- a/src/gallium/drivers/galahad/glhd_context.c
> +++ b/src/gallium/drivers/galahad/glhd_context.c
> @@ -940,12 +940,13 @@ static void
>  galahad_context_render_condition(struct pipe_context *_context,
>                                   struct pipe_query *query,
>                                   boolean condition,
> -                                 uint mode)
> +                                 uint mode,
> +                                 boolean inverted)
>  {
>     struct galahad_context *glhd_context = galahad_context(_context);
>     struct pipe_context *context = glhd_context->pipe;
>  
> -   context->render_condition(context, query, condition, mode);
> +   context->render_condition(context, query, condition, mode, inverted);
>  }
>  
>  
> diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c
> index 9006376..03a36b7 100644
> --- a/src/gallium/drivers/ilo/ilo_3d.c
> +++ b/src/gallium/drivers/ilo/ilo_3d.c
> @@ -842,7 +842,8 @@ static void
>  ilo_render_condition(struct pipe_context *pipe,
>                       struct pipe_query *query,
>                       boolean condition,
> -                     uint mode)
> +                     uint mode,
> +                     boolean inverted)
>  {
>     struct ilo_context *ilo = ilo_context(pipe);
>     struct ilo_3d *hw3d = ilo->hw3d;
> diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
> index d9696c2..b449aeb 100644
> --- a/src/gallium/drivers/llvmpipe/lp_context.c
> +++ b/src/gallium/drivers/llvmpipe/lp_context.c
> @@ -109,7 +109,8 @@ static void
>  llvmpipe_render_condition ( struct pipe_context *pipe,
>                              struct pipe_query *query,
>                              boolean condition,
> -                            uint mode )
> +                            uint mode,
> +                            boolean inverted )
>  {
>     struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
>  
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_query.c b/src/gallium/drivers/nouveau/nv30/nv30_query.c
> index ace2cdc..1f8c1ef 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_query.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_query.c
> @@ -233,7 +233,8 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
>  static void
>  nv40_query_render_condition(struct pipe_context *pipe,
>                              struct pipe_query *pq,
> -                            boolean condition, uint mode)
> +                            boolean condition, uint mode,
> +                            boolean inverted)
>  {
>     struct nv30_context *nv30 = nv30_context(pipe);
>     struct nv30_query *q = nv30_query(pq);
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> index a373dc6..041ea18 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> @@ -322,7 +322,8 @@ nv84_query_fifo_wait(struct nouveau_pushbuf *push, struct pipe_query *pq)
>  static void
>  nv50_render_condition(struct pipe_context *pipe,
>                        struct pipe_query *pq,
> -                      boolean condition, uint mode)
> +                      boolean condition, uint mode,
> +                      boolean inverted)
>  {
>     struct nv50_context *nv50 = nv50_context(pipe);
>     struct nouveau_pushbuf *push = nv50->base.pushbuf;
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> index 600f4f9..60297af 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> @@ -1096,7 +1096,8 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit)
>  
>     if (nv50->cond_query && !blit->render_condition_enable)
>        nv50->base.pipe.render_condition(&nv50->base.pipe, nv50->cond_query,
> -                                       nv50->cond_cond, nv50->cond_mode);
> +                                       nv50->cond_cond, nv50->cond_mode,
> +                                       FALSE);
>  
>     nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_FB);
>     nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_TEXTURES);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> index 50cef1e..ee02ed7 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> @@ -536,7 +536,8 @@ nvc0_query_fifo_wait(struct nouveau_pushbuf *push, struct pipe_query *pq)
>  static void
>  nvc0_render_condition(struct pipe_context *pipe,
>                        struct pipe_query *pq,
> -                      boolean condition, uint mode)
> +                      boolean condition, uint mode,
> +                      boolean inverted)
>  {
>     struct nvc0_context *nvc0 = nvc0_context(pipe);
>     struct nouveau_pushbuf *push = nvc0->base.pushbuf;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
> index a29f0cc..f7b4ce5 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
> @@ -1003,7 +1003,8 @@ nvc0_blitctx_post_blit(struct nvc0_blitctx *blit)
>  
>     if (nvc0->cond_query && !blit->render_condition_enable)
>        nvc0->base.pipe.render_condition(&nvc0->base.pipe, nvc0->cond_query,
> -                                       nvc0->cond_cond, nvc0->cond_mode);
> +                                       nvc0->cond_cond, nvc0->cond_mode,
> +                                       FALSE);
>  
>     nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
>     nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(4, 0));
> diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
> index 1679433..ad4c5e5 100644
> --- a/src/gallium/drivers/r300/r300_query.c
> +++ b/src/gallium/drivers/r300/r300_query.c
> @@ -180,7 +180,8 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
>  static void r300_render_condition(struct pipe_context *pipe,
>                                    struct pipe_query *query,
>                                    boolean condition,
> -                                  uint mode)
> +                                  uint mode,
> +                                  boolean inverted)
>  {
>      struct r300_context *r300 = r300_context(pipe);
>      union pipe_query_result result;
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 95abfb8..55b5198 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -63,7 +63,7 @@ void r600_preflush_suspend_features(struct r600_common_context *ctx)
>  		ctx->saved_render_cond = ctx->current_render_cond;
>  		ctx->saved_render_cond_cond = ctx->current_render_cond_cond;
>  		ctx->saved_render_cond_mode = ctx->current_render_cond_mode;
> -		ctx->b.render_condition(&ctx->b, NULL, FALSE, 0);
> +		ctx->b.render_condition(&ctx->b, NULL, FALSE, 0, FALSE);
>  	}
>  
>  	/* suspend queries */
> @@ -96,7 +96,8 @@ void r600_postflush_resume_features(struct r600_common_context *ctx)
>  	if (ctx->saved_render_cond) {
>  		ctx->b.render_condition(&ctx->b, ctx->saved_render_cond,
>  					  ctx->saved_render_cond_cond,
> -					  ctx->saved_render_cond_mode);
> +					  ctx->saved_render_cond_mode,
> +					  FALSE);
>  	}
>  }
>  
> diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
> index 503737c..38d175f 100644
> --- a/src/gallium/drivers/radeon/r600_query.c
> +++ b/src/gallium/drivers/radeon/r600_query.c
> @@ -756,7 +756,8 @@ static boolean r600_get_query_result(struct pipe_context *ctx,
>  static void r600_render_condition(struct pipe_context *ctx,
>  				  struct pipe_query *query,
>  				  boolean condition,
> -				  uint mode)
> +				  uint mode,
> +				  boolean inverted)
>  {
>  	struct r600_common_context *rctx = (struct r600_common_context *)ctx;
>  	struct r600_query *rquery = (struct r600_query *)query;
> diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
> index 34d2b80..7fdec50 100644
> --- a/src/gallium/drivers/softpipe/sp_context.c
> +++ b/src/gallium/drivers/softpipe/sp_context.c
> @@ -174,7 +174,8 @@ static void
>  softpipe_render_condition( struct pipe_context *pipe,
>                             struct pipe_query *query,
>                             boolean condition,
> -                           uint mode )
> +                           uint mode,
> +                           boolean inverted )
>  {
>     struct softpipe_context *softpipe = softpipe_context( pipe );
>  
> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
> index af5674f..b1e2127 100644
> --- a/src/gallium/include/pipe/p_context.h
> +++ b/src/gallium/include/pipe/p_context.h
> @@ -98,11 +98,13 @@ struct pipe_context {
>      * \param query  the query predicate, or NULL if no predicate
>      * \param condition whether to skip on FALSE or TRUE query results
>      * \param mode  one of PIPE_RENDER_COND_x
> +    * \param inverted whether to use PIPE_RENDER_COND_*_INVERTED or not
>      */
>     void (*render_condition)( struct pipe_context *pipe,
>                               struct pipe_query *query,
>                               boolean condition,
> -                             uint mode );
> +                             uint mode,
> +                             boolean inverted );
>  
>     /**
>      * Query objects
> 



More information about the mesa-dev mailing list