Add initial decoding check for uv bounds.

This commit is contained in:
Unknown W. Brackets 2015-03-15 21:38:01 -07:00
parent 52c3fc221b
commit 5c233fa545
5 changed files with 51 additions and 0 deletions

View file

@ -565,6 +565,24 @@ void VertexDecoderJitCache::Jit_TcFloat() {
void VertexDecoderJitCache::Jit_TcU16Through() {
LDRH(tempReg1, srcReg, dec_->tcoff);
LDRH(tempReg2, srcReg, dec_->tcoff + 2);
// TODO: Cleanup.
MOVP2R(scratchReg, &gstate_c.vertMinU);
auto updateSide = [&](ARMReg r, CCFlags cc, u32 off) {
LDRH(tempReg3, scratchReg, off);
CMP(r, tempReg3);
SetCC(cc);
STRH(r, scratchReg, off);
SetCC(CC_AL);
};
// TODO: Can this actually be fast? Hmm, floats aren't better.
updateSide(tempReg1, CC_LT, 0);
updateSide(tempReg1, CC_GT, 2);
updateSide(tempReg2, CC_LT, 4);
updateSide(tempReg2, CC_GT, 6);
ORR(tempReg1, tempReg1, Operand2(tempReg2, ST_LSL, 16));
STR(tempReg1, dstReg, dec_->decFmt.uvoff);
}