[Mesa-stable] [Mesa-dev] [PATCH 25/53] st/nine: Handle NRM with input of null norm
Ilia Mirkin
imirkin at alum.mit.edu
Wed Jan 7 10:12:07 PST 2015
On Wed, Jan 7, 2015 at 1:11 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Wed, Jan 7, 2015 at 11:36 AM, Axel Davy <axel.davy at ens.fr> wrote:
>> When the input's xyz are 0.0, the output
>> should be 0.0. This is due to the fact that
>> Inf * 0 = 0 for dx9. To handle this case,
>> cap the result of RSQ to FLT_MAX. We have
>> FLT_MAX * 0 = 0.
>>
>> Reviewed-by: David Heidelberg <david at ixit.cz>
>> 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 | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
>> index 4dee5f5..48492b4 100644
>> --- a/src/gallium/state_trackers/nine/nine_shader.c
>> +++ b/src/gallium/state_trackers/nine/nine_shader.c
>> @@ -1973,10 +1973,12 @@ DECL_SPECIAL(NRM)
>> struct ureg_program *ureg = tx->ureg;
>> struct ureg_dst tmp = tx_scratch_scalar(tx);
>> struct ureg_src nrm = tx_src_scalar(tmp);
>> + struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
>> struct ureg_src src = tx_src_param(tx, &tx->insn.src[0]);
>> ureg_DP3(ureg, tmp, src, src);
>> ureg_RSQ(ureg, tmp, nrm);
>> - ureg_MUL(ureg, tx_dst_param(tx, &tx->insn.dst[0]), src, nrm);
>> + ureg_MIN(ureg, tmp, ureg_imm1f(ureg, FLT_MAX), nrm);
>> + ureg_MUL(ureg, dst, src, nrm);
>
> Was this supposed to use tmp instead of nrm? Otherwise tmp is
> unused... Also, same question as before wrt the MIN.
Er wait, I see, nrm == tmp.xxxx.
More information about the mesa-stable
mailing list