[Mesa-dev] [PATCH 1/3] gallium: add TGSI_PROPERTY_MUL_ZERO_WINS

Roland Scheidegger sroland at vmware.com
Mon Jan 16 15:51:47 UTC 2017


I think you'd also want a cap bit - I don't think it's reasonable to
expect all drivers to implement this (e.g. I really don't feel like
doing that for llvmpipe, there is no way to do that natively obviously),
and I'd think it's better that it would be the fault of the st and not
the driver if the bit isn't supported and noone feels like doing
workarounds...

Roland

Am 15.01.2017 um 19:36 schrieb Ilia Mirkin:
> This will be useful for proper D3D9 emulation, where this behavior is
> expected by some shaders.
> 
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/gallium/auxiliary/tgsi/tgsi_strings.c  |  3 ++-
>  src/gallium/docs/source/tgsi.rst           | 14 ++++++++++++--
>  src/gallium/include/pipe/p_shader_tokens.h |  1 +
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
> index 536a4c8..cebc1b4 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
> @@ -148,7 +148,8 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
>     "NEXT_SHADER",
>     "CS_FIXED_BLOCK_WIDTH",
>     "CS_FIXED_BLOCK_HEIGHT",
> -   "CS_FIXED_BLOCK_DEPTH"
> +   "CS_FIXED_BLOCK_DEPTH",
> +   "MUL_ZERO_WINS",
>  };
>  
>  const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
> diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
> index 4d7ec90..4e71ea6 100644
> --- a/src/gallium/docs/source/tgsi.rst
> +++ b/src/gallium/docs/source/tgsi.rst
> @@ -3538,13 +3538,23 @@ Which shader stage will MOST LIKELY follow after this shader when the shader
>  is bound. This is only a hint to the driver and doesn't have to be precise.
>  Only set for VS and TES.
>  
> -TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH / HEIGHT / DEPTH
> -"""""""""""""""""""""""""""""""""""""""""""""""""""
> +CS_FIXED_BLOCK_WIDTH / HEIGHT / DEPTH
> +"""""""""""""""""""""""""""""""""""""
>  
>  Threads per block in each dimension, if known at compile time. If the block size
>  is known all three should be at least 1. If it is unknown they should all be set
>  to 0 or not set.
>  
> +MUL_ZERO_WINS
> +"""""""""""""
> +
> +The MUL TGSI operation (FP32 multiplication) will return 0 if either
> +of the operands are equal to 0. That means that 0 * Inf = 0. This
> +should be set the same way for an entire pipeline. If there is a
> +mismatch between shaders, then it is unspecified whether this behavior
> +will be enabled.
> +
> +
>  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 f9b658d..27f842c 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -290,6 +290,7 @@ enum tgsi_property_name {
>     TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH,
>     TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT,
>     TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH,
> +   TGSI_PROPERTY_MUL_ZERO_WINS,
>     TGSI_PROPERTY_COUNT,
>  };
>  
> 



More information about the mesa-dev mailing list