[Mesa-dev] [PATCH 2/6] gallium/st: Add PIPE_CAP_CONDITIONAL_RENDER_INVERTED

Roland Scheidegger sroland at vmware.com
Fri Aug 15 17:53:09 PDT 2014


Am 16.08.2014 01:59, schrieb Tobias Klausmann:
> with this we determine if the driver wants to enable
> GL_ARB_conditional_render_inverted
> 
> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
> ---
>  src/gallium/docs/source/screen.rst               | 2 ++
>  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
>  src/gallium/drivers/i915/i915_screen.c           | 1 +
>  src/gallium/drivers/ilo/ilo_screen.c             | 1 +
>  src/gallium/drivers/llvmpipe/lp_screen.c         | 1 +
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 2 ++
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 ++
>  src/gallium/drivers/r300/r300_screen.c           | 1 +
>  src/gallium/drivers/r600/r600_pipe.c             | 1 +
>  src/gallium/drivers/radeonsi/si_pipe.c           | 1 +
>  src/gallium/drivers/softpipe/sp_screen.c         | 2 ++
>  src/gallium/drivers/svga/svga_screen.c           | 1 +
>  src/gallium/drivers/vc4/vc4_screen.c             | 1 +
>  src/gallium/include/pipe/p_defines.h             | 1 +
>  src/mesa/state_tracker/st_extensions.c           | 1 +
>  16 files changed, 20 insertions(+)
> 
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index 6fecc15..3570bd5 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -215,6 +215,8 @@ The integer capabilities:
>    See pipe_draw_info.
>  * ``PIPE_CAP_TGSI_FS_FINE_DERIVATIVE``: Whether the fragment shader supports
>    the FINE versions of DDX/DDY.
> +* ``PIPE_CAP_CONDITIONAL_RENDER_INVERTED``: Invert the condition used to
> +  determine whether to draw or not.
That should be something like "Whether the driver supports inverted
condition for conditional rendering" or similar.
Though I would prefer if no cap were needed - I suspect everyobdy being
able to do conditional rendering should also be trivially able to handle
the inverted condition. But I guess we can easily kill the cap later
when all drivers are actually adopted to handle it.


>  
>  
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index b156d8b..127bf1a 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -217,6 +217,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>  	case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>  	case PIPE_CAP_DRAW_INDIRECT:
>  	case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>  		return 0;
>  
>  	/* Stream output. */
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 53d5e75..2515ba4 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -221,6 +221,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>     case PIPE_CAP_SAMPLE_SHADING:
>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>        return 0;
>  
>     case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index 991d2d0..969dbb6 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -434,6 +434,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_MAX_VERTEX_STREAMS:
>     case PIPE_CAP_DRAW_INDIRECT:
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>        return 0;
>  
>     default:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index f4f3257..36fdff1 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -249,6 +249,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
This really should be enabled for both softpipe and llvmpipe (and
mentioned in the docs too). It really should work and we want the test
coverage for it.


>        return 0;
>     case PIPE_CAP_FAKE_SW_MSAA:
>        return 1;
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 4766955..b277401 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -149,7 +149,9 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_COMPUTE:
>     case PIPE_CAP_DRAW_INDIRECT:
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>        return 0;
> +
>     }
>  
>     debug_printf("unknown param %d\n", param);
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 8a9a40e..58c0c30 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -201,6 +201,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>     case PIPE_CAP_COMPUTE:
>     case PIPE_CAP_DRAW_INDIRECT:
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>        return 0;
>     }
>  
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index c6d9b91..a391a5f 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -173,6 +173,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>        return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
>     case PIPE_CAP_COMPUTE:
>        return (class_3d == NVE4_3D_CLASS) ? 1 : 0;
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
> +      return 0;
>  
>     /* unsupported caps */
>     case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index ad599e9..415815f 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -179,6 +179,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>          case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>          case PIPE_CAP_DRAW_INDIRECT:
>          case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +        case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>              return 0;
>  
>          /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index bf52a19..d1ce92b 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -320,6 +320,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_SAMPLE_SHADING:
>  	case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>  	case PIPE_CAP_DRAW_INDIRECT:
> +	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>  		return 0;
>  
>  	/* Stream output. */
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 0f10f3b..f9b9bef 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -255,6 +255,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>  	case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>  	case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>  		return 0;
>  
>  	case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 5e2640d..552acee 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -203,6 +203,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>        return 0;
>     case PIPE_CAP_DRAW_INDIRECT:
>        return 1;
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
> +      return 0;
>     }
>     /* should only get here on unhandled cases */
>     debug_printf("Unexpected PIPE_CAP %d query\n", param);
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index d140f56..5fd0299 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -279,6 +279,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>     case PIPE_CAP_DRAW_INDIRECT:
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>        return 0;
>     case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>        return 64;
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index 7e59613..444f528 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -158,6 +158,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>          case PIPE_CAP_MAX_VERTEX_STREAMS:
>          case PIPE_CAP_DRAW_INDIRECT:
>          case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
> +        case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>                  return 0;
>  
>                  /* Stream output. */
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 53d5d4b..341490d 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -563,6 +563,7 @@ enum pipe_cap {
>     PIPE_CAP_MAX_VERTEX_STREAMS = 100,
>     PIPE_CAP_DRAW_INDIRECT = 101,
>     PIPE_CAP_TGSI_FS_FINE_DERIVATIVE = 102,
> +   PIPE_CAP_CONDITIONAL_RENDER_INVERTED = 103,
>  };
>  
>  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 24e886c..4110eb5 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -460,6 +460,7 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(ARB_sample_shading),               PIPE_CAP_SAMPLE_SHADING                   },
>        { o(ARB_draw_indirect),                PIPE_CAP_DRAW_INDIRECT                    },
>        { o(ARB_derivative_control),           PIPE_CAP_TGSI_FS_FINE_DERIVATIVE          },
> +      { o(ARB_conditional_render_inverted),  PIPE_CAP_CONDITIONAL_RENDER_INVERTED      },
>     };
>  
>     /* Required: render target and sampler support */
> 

Other than that the series looks good but like Ilja mentioned the mesa
parts are missing so enabling it won't do any good.

Roland



More information about the mesa-dev mailing list