From: Roland Scheidegger <sroland-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
To: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>,
mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [Mesa-dev] [PATCH] nv50/ir: saturate FRC result to avoid completely bogus values
Date: Tue, 18 Nov 2014 14:54:00 +0100 [thread overview]
Message-ID: <546B4F78.1060109@vmware.com> (raw)
In-Reply-To: <1416283386-28170-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
Am 18.11.2014 um 05:03 schrieb Ilia Mirkin:
> For values above integer accuracy in floats, val - floor(val) might
> actually produce a value greater than 1. For such large floats, it's
> reasonable to be imprecise, but it's unreasonable for FRC to return a
> value that is not between 0 and 1.
>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> ---
> src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> index 41b91e8..e5b767f 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> @@ -2512,7 +2512,8 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
> src0 = fetchSrc(0, c);
> val0 = getScratch();
> mkOp1(OP_FLOOR, TYPE_F32, val0, src0);
> - mkOp2(OP_SUB, TYPE_F32, dst0[c], src0, val0);
> + mkOp2(OP_SUB, TYPE_F32, val0, src0, val0);
> + mkOp1(OP_SAT, TYPE_F32, dst0[c], val0);
> }
> break;
> case TGSI_OPCODE_ROUND:
>
I don't understand the math behind this. For any such large number, as
far as I can tell floor(val) == val and hence the end result ought to be
zero. Or doesn't your floor work like that?
Roland
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
next prev parent reply other threads:[~2014-11-18 13:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 4:03 [PATCH] nv50/ir: saturate FRC result to avoid completely bogus values Ilia Mirkin
[not found] ` <1416283386-28170-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2014-11-18 13:54 ` Roland Scheidegger [this message]
2014-11-18 14:05 ` Ilia Mirkin
2014-11-18 14:34 ` Roland Scheidegger
[not found] ` <546B58DD.3060202-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2014-11-18 14:53 ` [Mesa-dev] " Jose Fonseca
2014-11-18 15:03 ` Ilia Mirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=546B4F78.1060109@vmware.com \
--to=sroland-pghwnbhtmq7qt0dzr+alfa@public.gmane.org \
--cc=imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
--cc=mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.