VFPU 4x4 matrix inverse

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
katsumoto
Posts: 5
Joined: Thu Jul 27, 2006 6:30 am

VFPU 4x4 matrix inverse

Post by katsumoto »

Hello,

Code: Select all

  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?
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

This function that I wrote for pspgum works just fine:

Code: Select all

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
Post Reply