libpspgum_vfpu curiosity
-
- Posts: 11
- Joined: Wed Apr 23, 2008 11:44 am
libpspgum_vfpu curiosity
libpspgum_vfpu still uses sinf and cosf instead of vfpu_sinf and vfpu_cosf. Why?!?
-
- Posts: 2
- Joined: Sat Apr 14, 2007 3:06 am
hum.. ok. I'm trying to develop applications without GCC libs. SO, i think:
libpspgum_vfpu = libpspgum, using vfpu.
libpspgum uses libm (sinf, consf...) --> it's ok.
libpspgum_vfpu uses libpspmath(vfpu_sinf, vfpu_cosf...) --> I'm wrong
I'll try to define "float sinf(float v){return vfpu_sinf(v);}" and "float cosf(float v){return vfpu_cosf(v);}" somewhere, and compile without libm...
libpspgum_vfpu = libpspgum, using vfpu.
libpspgum uses libm (sinf, consf...) --> it's ok.
libpspgum_vfpu uses libpspmath(vfpu_sinf, vfpu_cosf...) --> I'm wrong
I'll try to define "float sinf(float v){return vfpu_sinf(v);}" and "float cosf(float v){return vfpu_cosf(v);}" somewhere, and compile without libm...
-
- Posts: 11
- Joined: Wed Apr 23, 2008 11:44 am
damn.. damn..
newer libpspgum_vfpu are pure vfpu, my lib is outdated.
--------------------------------------------------------------------------------------
void sceGumPerspective(float fovy, float aspect, float near, float far)
{
pspvfpu_use_matrices(gum_vfpucontext, VMAT3, VMAT0 | VMAT1);
__asm__ volatile (
"vmzero.q M100\n" // set M100 to all zeros
"mtv %0, S000\n" // S000 = fovy
"viim.s S001, 90\n" // S002 = 90.0f
"vrcp.s S001, S001\n" // S002 = 1/90
"vmul.s S000, S000, S000[1/2]\n" // S000 = fovy * 0.5 = fovy/2
"vmul.s S000, S000, S001\n" // S000 = (fovy/2)/90
"vrot.p C002, S000, [c, s]\n" // S002 = cos(angle), S003 = sin(angle)
"vdiv.s S100, S002, S003\n" // S100 = m->x.x = cotangent = cos(angle)/sin(angle)
"mtv %2, S001\n" // S001 = near
"mtv %3, S002\n" // S002 = far
"vsub.s S003, S001, S002\n" // S003 = deltaz = near-far
"vrcp.s S003, S003\n" // S003 = 1/deltaz
"mtv %1, S000\n" // S000 = aspect
"vmov.s S111, S100\n" // S111 = m->y.y = cotangent
"vdiv.s S100, S100, S000\n" // S100 = m->x.x = cotangent / aspect
"vadd.s S122, S001, S002\n" // S122 = m->z.z = far + near
"vmul.s S122, S122, S003\n" // S122 = m->z.z = (far+near)/deltaz
"vmul.s S132, S001, S002\n" // S132 = m->w.z = far * near
"vmul.s S132, S132, S132[2]\n" // S132 = m->w.z = 2 * (far*near)
"vmul.s S132, S132, S003\n" // S132 = m->w.z = 2 * (far*near) / deltaz
"vsub.s S123, S123, S123[1]\n" // S123 = m->z.w = -1.0
"vmmul.q M000, M300, M100\n"
"vmmov.q M300, M000\n"
: : "r"(fovy),"r"(aspect),"r"(near),"r"(far));
gum_current_matrix_update = 1;
}
--------------------------------------------------------------------------------------
newer libpspgum_vfpu are pure vfpu, my lib is outdated.
--------------------------------------------------------------------------------------
void sceGumPerspective(float fovy, float aspect, float near, float far)
{
pspvfpu_use_matrices(gum_vfpucontext, VMAT3, VMAT0 | VMAT1);
__asm__ volatile (
"vmzero.q M100\n" // set M100 to all zeros
"mtv %0, S000\n" // S000 = fovy
"viim.s S001, 90\n" // S002 = 90.0f
"vrcp.s S001, S001\n" // S002 = 1/90
"vmul.s S000, S000, S000[1/2]\n" // S000 = fovy * 0.5 = fovy/2
"vmul.s S000, S000, S001\n" // S000 = (fovy/2)/90
"vrot.p C002, S000, [c, s]\n" // S002 = cos(angle), S003 = sin(angle)
"vdiv.s S100, S002, S003\n" // S100 = m->x.x = cotangent = cos(angle)/sin(angle)
"mtv %2, S001\n" // S001 = near
"mtv %3, S002\n" // S002 = far
"vsub.s S003, S001, S002\n" // S003 = deltaz = near-far
"vrcp.s S003, S003\n" // S003 = 1/deltaz
"mtv %1, S000\n" // S000 = aspect
"vmov.s S111, S100\n" // S111 = m->y.y = cotangent
"vdiv.s S100, S100, S000\n" // S100 = m->x.x = cotangent / aspect
"vadd.s S122, S001, S002\n" // S122 = m->z.z = far + near
"vmul.s S122, S122, S003\n" // S122 = m->z.z = (far+near)/deltaz
"vmul.s S132, S001, S002\n" // S132 = m->w.z = far * near
"vmul.s S132, S132, S132[2]\n" // S132 = m->w.z = 2 * (far*near)
"vmul.s S132, S132, S003\n" // S132 = m->w.z = 2 * (far*near) / deltaz
"vsub.s S123, S123, S123[1]\n" // S123 = m->z.w = -1.0
"vmmul.q M000, M300, M100\n"
"vmmov.q M300, M000\n"
: : "r"(fovy),"r"(aspect),"r"(near),"r"(far));
gum_current_matrix_update = 1;
}
--------------------------------------------------------------------------------------