X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnouveau%2Fcodegen%2Fnv50_ir_emit_nv50.cpp;h=139ff4a31dc9ef1b37bdd87d34d5ae8504bc82f8;hb=e8d9be40cbaf4922adec34a2e8106c04e2c7660d;hp=bd6200687ed8479b0e3bcbdb0086c76912aa288b;hpb=2c3f95d6aaab38cd66dd3dee1b089d5c91928eea;p=mesa.git diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp index bd6200687ed..139ff4a31dc 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp @@ -621,7 +621,7 @@ void CodeEmitterNV50::emitLOAD(const Instruction *i) { DataFile sf = i->src(0).getFile(); - int32_t offset = i->getSrc(0)->reg.data.offset; + MAYBE_UNUSED int32_t offset = i->getSrc(0)->reg.data.offset; switch (sf) { case FILE_SHADER_INPUT: @@ -882,8 +882,7 @@ CodeEmitterNV50::emitPFETCH(const Instruction *i) } static void -interpApply(const InterpEntry *entry, uint32_t *code, - bool force_persample_interp, bool flatshade) +interpApply(const FixupEntry *entry, uint32_t *code, const FixupData& data) { int ipa = entry->ipa; int encSize = entry->reg; @@ -891,7 +890,7 @@ interpApply(const InterpEntry *entry, uint32_t *code, if ((ipa & NV50_IR_INTERP_SAMPLE_MASK) == NV50_IR_INTERP_DEFAULT && (ipa & NV50_IR_INTERP_MODE_MASK) != NV50_IR_INTERP_FLAT) { - if (force_persample_interp) { + if (data.force_persample_interp) { if (encSize == 8) code[loc + 1] |= 1 << 16; else @@ -912,6 +911,7 @@ CodeEmitterNV50::emitINTERP(const Instruction *i) defId(i->def(0), 2); srcAddr8(i->src(0), 16); + setAReg16(i, 0); if (i->encSize != 8 && i->getInterpMode() == NV50_IR_INTERP_FLAT) { code[0] |= 1 << 8; @@ -1265,6 +1265,28 @@ CodeEmitterNV50::emitISAD(const Instruction *i) } } +static void +alphatestSet(const FixupEntry *entry, uint32_t *code, const FixupData& data) +{ + int loc = entry->loc; + int enc; + + switch (data.alphatest) { + case PIPE_FUNC_NEVER: enc = 0x0; break; + case PIPE_FUNC_LESS: enc = 0x1; break; + case PIPE_FUNC_EQUAL: enc = 0x2; break; + case PIPE_FUNC_LEQUAL: enc = 0x3; break; + case PIPE_FUNC_GREATER: enc = 0x4; break; + case PIPE_FUNC_NOTEQUAL: enc = 0x5; break; + case PIPE_FUNC_GEQUAL: enc = 0x6; break; + default: + case PIPE_FUNC_ALWAYS: enc = 0xf; break; + } + + code[loc + 1] &= ~(0x1f << 14); + code[loc + 1] |= enc << 14; +} + void CodeEmitterNV50::emitSET(const Instruction *i) { @@ -1294,6 +1316,10 @@ CodeEmitterNV50::emitSET(const Instruction *i) if (i->src(1).mod.abs()) code[1] |= 0x00080000; emitForm_MAD(i); + + if (i->subOp == 1) { + addInterp(0, 0, alphatestSet); + } } void @@ -2113,7 +2139,7 @@ makeInstructionLong(Instruction *insn) insn->encSize = 8; for (int i = fn->bbCount - 1; i >= 0 && fn->bbArray[i] != insn->bb; --i) { - fn->bbArray[i]->binPos += 4; + fn->bbArray[i]->binPos += adj; } fn->binSize += adj; insn->bb->binSize += adj; @@ -2165,9 +2191,16 @@ replaceExitWithModifier(Function *func) return; } } - epilogue->binSize -= 8; - func->binSize -= 8; + + int adj = epilogue->getExit()->encSize; + epilogue->binSize -= adj; + func->binSize -= adj; delete_Instruction(func->getProgram(), epilogue->getExit()); + + // There may be BB's that are laid out after the exit block + for (int i = func->bbCount - 1; i >= 0 && func->bbArray[i] != epilogue; --i) { + func->bbArray[i]->binPos -= adj; + } } void