forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VFPU 4x4 matrix inverse

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
katsumoto



Joined: 27 Jul 2006
Posts: 5

PostPosted: Sun Aug 06, 2006 11:48 am    Post subject: VFPU 4x4 matrix inverse Reply with quote

Hello,

Code:

  GLfloat out[16], in[16]

  asm volatile (
   "ulv.q c400, 0 + %1\n"
   "ulv.q c410, 16 + %1\n"
   "ulv.q c420, 32 + %1\n"
   "ulv.q c600, 48 + %1\n"
   "vzero.t c430\n"
   "vtfm3.t c610, m400, c600\n"
   "vneg.t   c600, c610\n"
   "usv.q   r400,  0 + %0\n"
   "usv.q   r401, 16 + %0\n"
   "usv.q   r402, 32 + %0\n"
   "usv.q   c600, 48 + %0\n"
  : "=m" (*out) : "m" (*in));


someone can fix my code?
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Mon Aug 07, 2006 3:50 pm    Post subject: Reply with quote

This function that I wrote for pspgum works just fine:
Code:
void gumFastInverse(ScePspFMatrix4* m, const ScePspFMatrix4* a)
{
        pspvfpu_use_matrices(gum_vfpucontext, 0, VMAT0 | VMAT1 | VMAT2);

        __asm__ volatile (
                "ulv.q C200,  0 + %1\n"
                "ulv.q C210, 16 + %1\n"
                "ulv.q C220, 32 + %1\n"
                "ulv.q C230, 48 + %1\n"

                "vmidt.q M000\n"
                "vmmov.t M000, E200\n"
                "vneg.t C100, C230\n"
                "vtfm3.t C030, M200, C100\n"

                "usv.q C000,  0 + %0\n"
                "usv.q C010, 16 + %0\n"
                "usv.q C020, 32 + %0\n"
                "usv.q C030, 48 + %0\n"
        : "=m"(*m) : "m"(*a) : "memory" );
}

_________________
GE Dominator
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group