c94wjpn
10-Nov-2007, 23:44
yo ho folks.
I have a problem with my vectors on the SPU. They just aren't interpreting the bits correctly and I think it's an alignment issue.
Here is my code:
float * pf;
vectorfloat4 pvf;
pf = (float*)p;
pvf = (vectorfloat4*)p;
if(fabs(*pf - spu_extract(*pvf,0))>1e-4)
printf("values differ: %f vs %f\n", *pf, spu_extract(*pvf, 0));
which demonstrates that spu_extract(o,*pvf) is just not returning correct values.
I think the problem is that my pointer p is not divisible by, say, 32.
Can anyone give me some advice on the alignment you need on your vectorfloat4*s to make it work ok?
cheers!
I have a problem with my vectors on the SPU. They just aren't interpreting the bits correctly and I think it's an alignment issue.
Here is my code:
float * pf;
vectorfloat4 pvf;
pf = (float*)p;
pvf = (vectorfloat4*)p;
if(fabs(*pf - spu_extract(*pvf,0))>1e-4)
printf("values differ: %f vs %f\n", *pf, spu_extract(*pvf, 0));
which demonstrates that spu_extract(o,*pvf) is just not returning correct values.
I think the problem is that my pointer p is not divisible by, say, 32.
Can anyone give me some advice on the alignment you need on your vectorfloat4*s to make it work ok?
cheers!