 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Shazz

Joined: 31 Aug 2004 Posts: 244 Location: Somewhere over the rainbow
|
Posted: Sun Apr 23, 2006 6:06 am Post subject: PSPSDK/Gum : Different behavior VPFU/Core |
|
|
When I use sceGumLookAt(), it works with the core impl, but black screen when the VFPU handles it. (other sceGum* work well)
Was the VFPU implementation tested ?
| Code: |
#ifdef F_sceGumLookAt_vfpu
void sceGumLookAt(ScePspFVector3* eye, ScePspFVector3* center, ScePspFVector3* up)
{
ScePspFMatrix4* t = GUM_ALIGNED_MATRIX();
gumLookAt(t,eye,center,up);
pspvfpu_use_matrices(gum_vfpucontext, VMAT3, VMAT0 | VMAT1);
__asm__ volatile (
"lv.q C000.q, 0 + %0\n"
"lv.q C010.q, 16 + %0\n"
"lv.q C020.q, 32 + %0\n"
"lv.q C030.q, 48 + %0\n"
"vmmul.q M100, M300, M000\n"
"vmmov.q M300, M100\n"
: : "m"(*t) );
gum_current_matrix_update = 1;
}
#endif
|
_________________ - TiTAN Art Division -
http://www.titandemo.org |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Mon Apr 24, 2006 6:11 pm Post subject: |
|
|
It has not been fully tested, no... Do you get a crash or can you put the results side by side and see what happens? If the matrices differ let me know, and I'll look into why this is so... It shouldn't be, since they both call gumLookAt, and the only thing the code does afterwards is load the resulting matrix and multiply it into the stack. This kind of code is used at quite a few places so I dunno why it should act up... _________________ GE Dominator |
|
| Back to top |
|
 |
Shazz

Joined: 31 Aug 2004 Posts: 244 Location: Somewhere over the rainbow
|
Posted: Mon Apr 24, 2006 6:24 pm Post subject: |
|
|
no crash, only a black screen. So something got wrong but no bus error or something like that, the GU seems to refuse the stuff.
For the moment I have recopied the "generic" gumLookAt => pspGumLookAt) with some matrix store/load :
| Code: |
sceGumMatrixMode(GU_VIEW);
sceGumLoadIdentity();
ScePspFMatrix4 currentMtx;
sceGumStoreMatrix(¤tMtx);
pspGumLookAt(¤tMtx, &rotozoom_eye, &rotozoom_center, &rotozoom_up );
sceGumLoadMatrix(¤tMtx);
|
That's my 2s patch (but seems to work)
But so yes the issue should be there :
| Code: |
pspvfpu_use_matrices(gum_vfpucontext, VMAT3, VMAT0 | VMAT1);
__asm__ volatile (
"lv.q C000.q, 0 + %0\n"
"lv.q C010.q, 16 + %0\n"
"lv.q C020.q, 32 + %0\n"
"lv.q C030.q, 48 + %0\n"
"vmmul.q M100, M300, M000\n"
"vmmov.q M300, M100\n"
: : "m"(*t) );
|
which seems, yep, used elsewhere...
What's mean memory in "=m"(*m) : : "memory"); I see i nother matrix updates ?
I will look into the details of the VFPU implementation and I'll dump the VIEW matrix to see differences as you requested. _________________ - TiTAN Art Division -
http://www.titandemo.org |
|
| Back to top |
|
 |
Shazz

Joined: 31 Aug 2004 Posts: 244 Location: Somewhere over the rainbow
|
Posted: Tue May 16, 2006 3:32 am Post subject: |
|
|
Sorry for the dealy, some other stuff to code :D
so I dumped the matrcies using CORE & VFPU impl for gum, here are the results :
| Code: |
CORE
Dump matrix : Mode
[0.000 0.000 0.000 0.000]
[0.000 0.000 0.000 0.000]
[0.000 0.000 0.000 0.000]
[0.000 0.000 0.000 0.000]
Dump matrix : Id
[1.000 0.000 0.000 0.000]
[0.000 1.000 0.000 0.000]
[0.000 0.000 1.000 0.000]
[0.000 0.000 0.000 1.000]
Dump matrix : LookAt
[1.000 0.000 0.000 0.000]
[0.000 0.894 0.447 0.000]
[0.000 -0.447 0.894 0.000]
[0.000 -4.472 -2.236 1.000]
VFPU
Dump matrix : Mode
[0.000 0.000 0.000 0.000]
[0.000 0.000 0.000 0.000]
[0.000 0.000 0.000 0.000]
[0.000 0.000 0.000 0.000]
Dump matrix : Id
[1.000 0.000 0.000 0.000]
[0.000 1.000 0.000 0.000]
[0.000 0.000 1.000 0.000]
[0.000 0.000 0.000 1.000]
Dump matrix : LookAt
[0.000 0.000 0.000 0.000]
[0.000 1.166 0.000 0.000]
[-0.000 -0.583 0.000 0.000]
[-6259853398707798888.200 -6259853398707798888.200 0.000 0.000]
|
So we see that the matrix generated by the lookAt is not the good one (the CORE lookAt matrix is ok)
I'll try to see where is the bug in the vfpu impl...
EDIT : bug found :
| Code: |
void sceGumLookAt(ScePspFVector3* eye, ScePspFVector3* center, ScePspFVector3* up)
{
ScePspFMatrix4* t = GUM_ALIGNED_MATRIX();
gumLookAt(t,eye,center,up);
|
you call gumLookAt on t which is null instead of the current matrix : gum_current_matrix, I don't think gumLookAt can be reused here as it does the matrix multiply and so on... Specific impl needed no ? _________________ - TiTAN Art Division -
http://www.titandemo.org |
|
| Back to top |
|
 |
Shazz

Joined: 31 Aug 2004 Posts: 244 Location: Somewhere over the rainbow
|
Posted: Tue May 16, 2006 4:03 am Post subject: |
|
|
This is the patch I propose...
| Code: |
#ifdef F_sceGumLookAt_vfpu
void sceGumLookAt(ScePspFVector3* eye, ScePspFVector3* center, ScePspFVector3* up)
{
ScePspFMatrix4* t = GUM_ALIGNED_MATRIX();
ScePspFVector3 forward, side, lup,ieye;
forward.x = center->x - eye->x;
forward.y = center->y - eye->y;
forward.z = center->z - eye->z;
gumNormalize(&forward);
gumCrossProduct(&side,&forward,up);
gumNormalize(&side);
gumCrossProduct(&lup,&side,&forward);
gumLoadIdentity(t);
t->x.x = side.x;
t->y.x = side.y;
t->z.x = side.z;
t->x.y = lup.x;
t->y.y = lup.y;
t->z.y = lup.z;
t->x.z = -forward.x;
t->y.z = -forward.y;
t->z.z = -forward.z;
ieye.x = -eye->x; ieye.y = -eye->y; ieye.z = -eye->z;
// multiply t with current matrix
sceGumMultMatrix(t);
// translate current matrix from eye vector
sceGumTranslate(&ieye);
gum_current_matrix_update = 1;
}
#endif
|
_________________ - TiTAN Art Division -
http://www.titandemo.org |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Tue May 16, 2006 8:20 am Post subject: |
|
|
Thanks, I'll look into fixing this asap. _________________ GE Dominator |
|
| Back to top |
|
 |
|
|
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
|