mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-22 00:08:09 +02:00
nvc0/ir: use levelZero flag when the lod is set to 0
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
parent
b1340fd708
commit
9145873b15
2 changed files with 43 additions and 6 deletions
|
|
@ -115,6 +115,38 @@ NVC0LegalizeSSA::handleFTZ(Instruction *i)
|
||||||
i->ftz = true;
|
i->ftz = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NVC0LegalizeSSA::handleTEXLOD(TexInstruction *i)
|
||||||
|
{
|
||||||
|
if (i->tex.target.isMS())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImmediateValue lod;
|
||||||
|
|
||||||
|
// The LOD argument comes right after the coordinates (before depth bias,
|
||||||
|
// offsets, etc).
|
||||||
|
int arg = i->tex.target.getArgCount();
|
||||||
|
|
||||||
|
// SM30+ stores the indirect handle as a separate arg, which comes before
|
||||||
|
// the LOD.
|
||||||
|
if (prog->getTarget()->getChipset() >= NVISA_GK104_CHIPSET &&
|
||||||
|
i->tex.rIndirectSrc >= 0)
|
||||||
|
arg++;
|
||||||
|
// SM20 stores indirect handle combined with array coordinate
|
||||||
|
if (prog->getTarget()->getChipset() < NVISA_GK104_CHIPSET &&
|
||||||
|
!i->tex.target.isArray() &&
|
||||||
|
i->tex.rIndirectSrc >= 0)
|
||||||
|
arg++;
|
||||||
|
|
||||||
|
if (!i->src(arg).getImmediate(lod) || !lod.isInteger(0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (i->op == OP_TXL)
|
||||||
|
i->op = OP_TEX;
|
||||||
|
i->tex.levelZero = true;
|
||||||
|
i->moveSources(arg + 1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
NVC0LegalizeSSA::visit(Function *fn)
|
NVC0LegalizeSSA::visit(Function *fn)
|
||||||
{
|
{
|
||||||
|
|
@ -128,21 +160,25 @@ NVC0LegalizeSSA::visit(BasicBlock *bb)
|
||||||
Instruction *next;
|
Instruction *next;
|
||||||
for (Instruction *i = bb->getEntry(); i; i = next) {
|
for (Instruction *i = bb->getEntry(); i; i = next) {
|
||||||
next = i->next;
|
next = i->next;
|
||||||
if (i->sType == TYPE_F32) {
|
|
||||||
if (prog->getType() != Program::TYPE_COMPUTE)
|
if (i->sType == TYPE_F32 && prog->getType() != Program::TYPE_COMPUTE)
|
||||||
handleFTZ(i);
|
handleFTZ(i);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
switch (i->op) {
|
switch (i->op) {
|
||||||
case OP_DIV:
|
case OP_DIV:
|
||||||
case OP_MOD:
|
case OP_MOD:
|
||||||
handleDIV(i);
|
if (i->sType != TYPE_F32)
|
||||||
|
handleDIV(i);
|
||||||
break;
|
break;
|
||||||
case OP_RCP:
|
case OP_RCP:
|
||||||
case OP_RSQ:
|
case OP_RSQ:
|
||||||
if (i->dType == TYPE_F64)
|
if (i->dType == TYPE_F64)
|
||||||
handleRCPRSQ(i);
|
handleRCPRSQ(i);
|
||||||
break;
|
break;
|
||||||
|
case OP_TXL:
|
||||||
|
case OP_TXF:
|
||||||
|
handleTEXLOD(i->asTex());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ private:
|
||||||
void handleDIV(Instruction *); // integer division, modulus
|
void handleDIV(Instruction *); // integer division, modulus
|
||||||
void handleRCPRSQ(Instruction *); // double precision float recip/rsqrt
|
void handleRCPRSQ(Instruction *); // double precision float recip/rsqrt
|
||||||
void handleFTZ(Instruction *);
|
void handleFTZ(Instruction *);
|
||||||
|
void handleTEXLOD(TexInstruction *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BuildUtil bld;
|
BuildUtil bld;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue