Previous 199869 Revisions Next

r33167 Monday 3rd November, 2014 at 14:50:30 UTC by Ryan Holtz
rdp: Do LOD calculation even in 1-cycle mode. Fixes many tests. [MooglyGuy]
[src/mame/video]rdptpipe.c

trunk/src/mame/video/rdptpipe.c
r241678r241679
595595   userdata->m_precomp_s = nexts;
596596   userdata->m_precomp_t = nextt;
597597
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
598613   int tempanded;
599614   if (*sss & 0x40000)
600615   {
r241678r241679
645660         *sst &= 0xffff;
646661      }
647662   }
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   }
648695}
649696
650697void 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)
r241678r241679
761808
762809   if(object.OtherModes.sharpen_tex_en && magnify)
763810   {
764      userdata->LODFraction = userdata->LODFraction | 0x100;
811      userdata->LODFraction |= 0x100;
765812   }
766813
767814   if (object.OtherModes.tex_lod_en)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team