Skip to content
Snippets Groups Projects
Commit dfe88d4f authored by Ilia Mirkin's avatar Ilia Mirkin Committed by Emil Velikov
Browse files

nvc0/ir: flush denorms to zero in non-compute shaders

This will set the FTZ flag (flush denorms to zero) on all opcodes that
can take it.

This resolves issues in Unigine Heaven 4.0 where there were solid-filled
boxes popping up.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89455


Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: default avatarIlia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit 6fe0d4f0)
parent 1176e586
No related branches found
No related tags found
Loading
......@@ -73,6 +73,26 @@ NVC0LegalizeSSA::handleRCPRSQ(Instruction *i)
// TODO
}
void
NVC0LegalizeSSA::handleFTZ(Instruction *i)
{
// Only want to flush float inputs
if (i->sType != TYPE_F32)
return;
// If we're already flushing denorms (and NaN's) to zero, no need for this.
if (i->dnz)
return;
// Only certain classes of operations can flush
OpClass cls = prog->getTarget()->getOpClass(i->op);
if (cls != OPCLASS_ARITH && cls != OPCLASS_COMPARE &&
cls != OPCLASS_CONVERT)
return;
i->ftz = true;
}
bool
NVC0LegalizeSSA::visit(Function *fn)
{
......@@ -86,8 +106,11 @@ NVC0LegalizeSSA::visit(BasicBlock *bb)
Instruction *next;
for (Instruction *i = bb->getEntry(); i; i = next) {
next = i->next;
if (i->dType == TYPE_F32)
if (i->dType == TYPE_F32) {
if (prog->getType() != Program::TYPE_COMPUTE)
handleFTZ(i);
continue;
}
switch (i->op) {
case OP_DIV:
case OP_MOD:
......
......@@ -36,6 +36,7 @@ private:
// we want to insert calls to the builtin library only after optimization
void handleDIV(Instruction *); // integer division, modulus
void handleRCPRSQ(Instruction *); // double precision float recip/rsqrt
void handleFTZ(Instruction *);
private:
BuildUtil bld;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment