[Mesa-stable] [Mesa-dev] [PATCH 31/53] st/nine: Clamp ps 1.X constants

Ilia Mirkin imirkin at alum.mit.edu
Wed Jan 7 16:49:35 PST 2015


On Wed, Jan 7, 2015 at 11:36 AM, Axel Davy <axel.davy at ens.fr> wrote:
> This is wine (and windows) behaviour.
>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
>
> Cc: "10.4" <mesa-stable at lists.freedesktop.org>
> ---
>  src/gallium/state_trackers/nine/nine_shader.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
> index 3fefce4..fb01408 100644
> --- a/src/gallium/state_trackers/nine/nine_shader.c
> +++ b/src/gallium/state_trackers/nine/nine_shader.c
> @@ -854,6 +854,13 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
>                  nine_info_mark_const_f_used(tx->info, param->idx);
>              src = ureg_src_register(TGSI_FILE_CONSTANT, param->idx);
>          }
> +        if (!IS_VS && tx->version.major < 2) {
> +            /* ps 1.X clamps constants */
> +            tmp = tx_scratch(tx);
> +            ureg_MIN(ureg, tmp, src, ureg_imm1f(ureg, 1.0f));
> +            ureg_MAX(ureg, tmp, ureg_src(tmp), ureg_imm1f(ureg, -1.0f));
> +            src = ureg_src(tmp);

FWIW there's a TGSI_SAT_MINUS_PLUS_ONE, which I guess is what you're
trying to do here. Not sure if any hw actually implements it as
something other than min/max as you have it.

> +        }
>          break;
>      case D3DSPR_CONST2:
>      case D3DSPR_CONST3:
> --
> 2.1.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list