trunk/src/mame/video/rdptpipe.c
r241678 | r241679 | |
595 | 595 | userdata->m_precomp_s = nexts; |
596 | 596 | userdata->m_precomp_t = nextt; |
597 | 597 | |
| 598 | INT32 lodclamp = (((*sst & 0x60000) > 0) | ((nextt & 0x60000) > 0)) || (((*sss & 0x60000) > 0) | ((nexts & 0x60000) > 0)); |
| 599 | |
| 600 | INT32 horstep = SIGN17(nexts & 0x1ffff) - SIGN17(*sss & 0x1ffff); |
| 601 | INT32 vertstep = SIGN17(nextt & 0x1ffff) - SIGN17(*sst & 0x1ffff); |
| 602 | if (horstep & 0x20000) |
| 603 | { |
| 604 | horstep = ~horstep & 0x1ffff; |
| 605 | } |
| 606 | if (vertstep & 0x20000) |
| 607 | { |
| 608 | vertstep = ~vertstep & 0x1ffff; |
| 609 | } |
| 610 | |
| 611 | INT32 lod = (horstep >= vertstep) ? horstep : vertstep; |
| 612 | |
598 | 613 | int tempanded; |
599 | 614 | if (*sss & 0x40000) |
600 | 615 | { |
r241678 | r241679 | |
645 | 660 | *sst &= 0xffff; |
646 | 661 | } |
647 | 662 | } |
| 663 | |
| 664 | if ((lod & 0x4000) || lodclamp) |
| 665 | { |
| 666 | lod = 0x7fff; |
| 667 | } |
| 668 | else if (lod < object.MiscState.MinLevel) |
| 669 | { |
| 670 | lod = object.MiscState.MinLevel; |
| 671 | } |
| 672 | |
| 673 | bool magnify = (lod < 32); |
| 674 | INT32 l_tile = m_rdp->GetLog2((lod >> 5) & 0xff); |
| 675 | bool distant = ((lod & 0x6000) || (l_tile >= object.MiscState.MaxLevel)); |
| 676 | |
| 677 | userdata->LODFraction = ((lod << 3) >> l_tile) & 0xff; |
| 678 | |
| 679 | if(!object.OtherModes.sharpen_tex_en && !object.OtherModes.detail_tex_en) |
| 680 | { |
| 681 | if (distant) |
| 682 | { |
| 683 | userdata->LODFraction = 0xff; |
| 684 | } |
| 685 | else if (magnify) |
| 686 | { |
| 687 | userdata->LODFraction = 0; |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | if(object.OtherModes.sharpen_tex_en && magnify) |
| 692 | { |
| 693 | userdata->LODFraction |= 0x100; |
| 694 | } |
648 | 695 | } |
649 | 696 | |
650 | 697 | void N64TexturePipeT::LOD2Cycle(INT32* sss, INT32* sst, INT32 s, INT32 t, INT32 w, INT32 dsinc, INT32 dtinc, INT32 dwinc, INT32 prim_tile, INT32* t1, INT32* t2, rdp_span_aux *userdata, const rdp_poly_state& object) |
r241678 | r241679 | |
761 | 808 | |
762 | 809 | if(object.OtherModes.sharpen_tex_en && magnify) |
763 | 810 | { |
764 | | userdata->LODFraction = userdata->LODFraction | 0x100; |
| 811 | userdata->LODFraction |= 0x100; |
765 | 812 | } |
766 | 813 | |
767 | 814 | if (object.OtherModes.tex_lod_en) |