nvc0: add support for texture gather

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Ilia Mirkin 2014-04-04 07:11:23 +02:00
parent 91900c6d33
commit f6579e4b17
4 changed files with 22 additions and 5 deletions

View File

@ -984,6 +984,9 @@ CodeEmitterGK110::emitTEX(const TexInstruction *i)
case OP_TXF:
code[1] = 0x78000000;
break;
case OP_TXG:
code[1] = 0x7dc00000;
break;
default:
code[1] = 0x7d800000;
break;
@ -1005,6 +1008,11 @@ CodeEmitterGK110::emitTEX(const TexInstruction *i)
code[1] = 0x70000000;
code[1] |= i->tex.r << 13;
break;
case OP_TXG:
code[0] = 0x00000001;
code[1] = 0x70000000;
code[1] |= i->tex.r << 15;
break;
default:
code[0] = 0x00000001;
code[1] = 0x60000000;
@ -1023,7 +1031,7 @@ CodeEmitterGK110::emitTEX(const TexInstruction *i)
case OP_TXB: code[1] |= 0x2000; break;
case OP_TXL: code[1] |= 0x3000; break;
case OP_TXF: break;
case OP_TXG: break; // XXX
case OP_TXG: break;
case OP_TXD: break;
case OP_TXLQ: break;
default:
@ -1052,7 +1060,7 @@ CodeEmitterGK110::emitTEX(const TexInstruction *i)
srcId(i->src(0), 10);
srcId(i, src1, 23);
// if (i->op == OP_TXG) code[0] |= i->tex.gatherComp << 5;
if (i->op == OP_TXG) code[1] |= i->tex.gatherComp << 13;
// texture target:
code[1] |= (i->tex.target.isCube() ? 3 : (i->tex.target.getDim() - 1)) << 7;
@ -1666,6 +1674,7 @@ CodeEmitterGK110::emitInstruction(Instruction *insn)
case OP_TXL:
case OP_TXD:
case OP_TXF:
case OP_TXG:
case OP_TXLQ:
emitTEX(insn->asTex());
break;

View File

@ -2303,6 +2303,7 @@ CodeEmitterNVC0::emitInstruction(Instruction *insn)
case OP_TXL:
case OP_TXD:
case OP_TXF:
case OP_TXG:
case OP_TXLQ:
emitTEX(insn->asTex());
break;

View File

@ -744,9 +744,15 @@ NVC0LoweringPass::handleTEX(TexInstruction *i)
int s = i->srcCount(0xff, true);
if (i->srcExists(s)) // move potential predicate out of the way
i->moveSources(s, 1);
for (n = 0; n < i->tex.useOffsets; ++n)
if (i->op == OP_TXG) {
assert(i->tex.useOffsets == 1);
for (c = 0; c < 3; ++c)
value |= (i->tex.offset[n][c] & 0xf) << (n * 12 + c * 4);
value |= (i->tex.offset[0][c] & 0xff) << (c * 8);
} else {
for (n = 0; n < i->tex.useOffsets; ++n)
for (c = 0; c < 3; ++c)
value |= (i->tex.offset[n][c] & 0xf) << (n * 12 + c * 4);
}
i->setSrc(s, bld.loadImm(NULL, value));
}

View File

@ -174,7 +174,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
case PIPE_CAP_TGSI_VS_LAYER:
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
case PIPE_CAP_TEXTURE_GATHER_SM5:
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
case PIPE_CAP_FAKE_SW_MSAA:
@ -183,6 +182,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_TEXTURE_QUERY_LOD:
return 1;
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
return 4;
default:
NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
return 0;