[Mesa-dev] [PATCH 7/8] gallium: create TGSI_PROPERTY to disable viewport and clipping

Marek Olšák maraeo at gmail.com
Tue May 20 16:49:16 PDT 2014


Hi,

Could somebody from VMWare please review this patch? It's for st/nine
(open d3d9 state tracker).

Thanks,

Marek

On Sat, May 17, 2014 at 1:20 AM, Automated rebase
<david.heidelberger at ixit.cz> wrote:
> From: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
>
> ---
>  src/gallium/auxiliary/tgsi/tgsi_strings.c  |  3 ++-
>  src/gallium/auxiliary/tgsi/tgsi_ureg.c     | 16 ++++++++++++++++
>  src/gallium/auxiliary/tgsi/tgsi_ureg.h     |  4 ++++
>  src/gallium/docs/source/tgsi.rst           |  9 +++++++++
>  src/gallium/include/pipe/p_shader_tokens.h |  3 ++-
>  5 files changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
> index 5b6e47f..c3e7118 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
> @@ -120,7 +120,8 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
>     "FS_COORD_PIXEL_CENTER",
>     "FS_COLOR0_WRITES_ALL_CBUFS",
>     "FS_DEPTH_LAYOUT",
> -   "VS_PROHIBIT_UCPS"
> +   "VS_PROHIBIT_UCPS",
> +   "VS_POSITION_WINDOW_SPACE"
>  };
>
>  const char *tgsi_type_names[5] =
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> index 2bf93ee..bd0a3f7 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> @@ -173,6 +173,7 @@ struct ureg_program
>     unsigned char property_fs_coord_pixel_center; /* = TGSI_FS_COORD_PIXEL_CENTER_* */
>     unsigned char property_fs_color0_writes_all_cbufs; /* = TGSI_FS_COLOR0_WRITES_ALL_CBUFS * */
>     unsigned char property_fs_depth_layout; /* TGSI_FS_DEPTH_LAYOUT */
> +   boolean property_vs_window_space_position; /* TGSI_VS_WINDOW_SPACE_POSITION */
>
>     unsigned nr_addrs;
>     unsigned nr_preds;
> @@ -331,6 +332,13 @@ ureg_property_fs_depth_layout(struct ureg_program *ureg,
>     ureg->property_fs_depth_layout = fs_depth_layout;
>  }
>
> +void
> +ureg_property_vs_window_space_position(struct ureg_program *ureg,
> +                                       boolean vs_window_space_position)
> +{
> +   ureg->property_vs_window_space_position = vs_window_space_position;
> +}
> +
>  struct ureg_src
>  ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg,
>                         unsigned semantic_name,
> @@ -1508,6 +1516,14 @@ static void emit_decls( struct ureg_program *ureg )
>                      ureg->property_fs_depth_layout);
>     }
>
> +   if (ureg->property_vs_window_space_position) {
> +      assert(ureg->processor == TGSI_PROCESSOR_VERTEX);
> +
> +      emit_property(ureg,
> +                    TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION,
> +                    ureg->property_vs_window_space_position);
> +   }
> +
>     if (ureg->processor == TGSI_PROCESSOR_VERTEX) {
>        for (i = 0; i < UREG_MAX_INPUT; i++) {
>           if (ureg->vs_inputs[i/32] & (1 << (i%32))) {
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> index a0a50b7..28edea6 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> @@ -184,6 +184,10 @@ void
>  ureg_property_fs_depth_layout(struct ureg_program *ureg,
>                                unsigned fs_depth_layout);
>
> +void
> +ureg_property_vs_window_space_position(struct ureg_program *ureg,
> +                                       boolean vs_window_space_position);
> +
>
>  /***********************************************************************
>   * Build shader declarations:
> diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
> index 9500b9d..2ca3c3b 100644
> --- a/src/gallium/docs/source/tgsi.rst
> +++ b/src/gallium/docs/source/tgsi.rst
> @@ -2848,6 +2848,15 @@ input primitive. Each invocation will have a different
>  TGSI_SEMANTIC_INVOCATIONID system value set. If not specified, assumed to
>  be 1.
>
> +VS_WINDOW_SPACE_POSITION
> +""""""""""""""""""""""""""
> +If this property is set on the vertex shader, the TGSI_SEMANTIC_POSITION output
> +is assumed to contain window space coordinates.
> +Division of X,Y,Z by W and the viewport transformation are disabled, and 1/W is
> +directly taken from the 4-th component of the shader output.
> +Naturally, clipping is not performed on window coordinates either.
> +The effect of this property is undefined if a geometry or tessellation shader
> +are in use.
>
>  Texture Sampling and Texture Formats
>  ------------------------------------
> diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
> index d095bd3..9261b79 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -237,7 +237,8 @@ union tgsi_immediate_data
>  #define TGSI_PROPERTY_FS_DEPTH_LAYOUT        6
>  #define TGSI_PROPERTY_VS_PROHIBIT_UCPS       7
>  #define TGSI_PROPERTY_GS_INVOCATIONS         8
> -#define TGSI_PROPERTY_COUNT                  9
> +#define TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION 9
> +#define TGSI_PROPERTY_COUNT                  10
>
>  struct tgsi_property {
>     unsigned Type         : 4;  /**< TGSI_TOKEN_TYPE_PROPERTY */
> --
> 1.9.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list