Browse Source

nv50/ir: fix texture grad for cubemaps

We were ignoring the partial derivatives on the last dim.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
tags/11.2-branchpoint
Ilia Mirkin 9 years ago
parent
commit
69e8b476d0

+ 1
- 1
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp View File

@@ -1897,7 +1897,7 @@ Converter::handleTEX(Value *dst[4], int R, int S, int L, int C, int Dx, int Dy)
shd = fetchSrc(C >> 4, C & 3);

if (texi->op == OP_TXD) {
for (c = 0; c < tgt.getDim(); ++c) {
for (c = 0; c < tgt.getDim() + tgt.isCube(); ++c) {
texi->dPdx[c].set(fetchSrc(Dx >> 4, (Dx & 3) + c));
texi->dPdy[c].set(fetchSrc(Dy >> 4, (Dy & 3) + c));
}

+ 1
- 1
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.cpp View File

@@ -57,7 +57,7 @@ GM107LoweringPass::handleManualTXD(TexInstruction *i)
Instruction *tex, *add;
Value *zero = bld.loadImm(bld.getSSA(), 0);
int l, c;
const int dim = i->tex.target.getDim();
const int dim = i->tex.target.getDim() + i->tex.target.isCube();
const int array = i->tex.target.isArray();

i->op = OP_TEX; // no need to clone dPdx/dPdy later

+ 1
- 1
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp View File

@@ -911,7 +911,7 @@ NV50LoweringPreSSA::handleTXD(TexInstruction *i)
Instruction *tex;
Value *zero = bld.loadImm(bld.getSSA(), 0);
int l, c;
const int dim = i->tex.target.getDim();
const int dim = i->tex.target.getDim() + i->tex.target.isCube();

handleTEX(i);
i->op = OP_TEX; // no need to clone dPdx/dPdy later

+ 3
- 4
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp View File

@@ -870,7 +870,7 @@ NVC0LoweringPass::handleManualTXD(TexInstruction *i)
Instruction *tex;
Value *zero = bld.loadImm(bld.getSSA(), 0);
int l, c;
const int dim = i->tex.target.getDim();
const int dim = i->tex.target.getDim() + i->tex.target.isCube();
const int array = i->tex.target.isArray();

i->op = OP_TEX; // no need to clone dPdx/dPdy later
@@ -917,7 +917,7 @@ NVC0LoweringPass::handleManualTXD(TexInstruction *i)
bool
NVC0LoweringPass::handleTXD(TexInstruction *txd)
{
int dim = txd->tex.target.getDim();
int dim = txd->tex.target.getDim() + txd->tex.target.isCube();
unsigned arg = txd->tex.target.getArgCount();
unsigned expected_args = arg;
const int chipset = prog->getTarget()->getChipset();
@@ -937,8 +937,7 @@ NVC0LoweringPass::handleTXD(TexInstruction *txd)

if (expected_args > 4 ||
dim > 2 ||
txd->tex.target.isShadow() ||
txd->tex.target.isCube())
txd->tex.target.isShadow())
txd->op = OP_TEX;

handleTEX(txd);

Loading…
Cancel
Save