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 

sceGumDrawArray and huge models

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



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Wed Jan 18, 2006 10:39 pm    Post subject: sceGumDrawArray and huge models Reply with quote

as sceGumDrawArray is defined:
Code:
void sceGumDrawArray     (      int       prim,
      int     vtype,
      int     count,
      const void *     indices,
      const void *     vertices
   )


if i pass to count a value like unsigned shor it works fine
when i switch over to unsigned long the model gets fucked up (no other changes in code...)

as int can be 2 or 4 bytes i am curious whats going wrong there...
int
-32'768 ... 32'767 or
-2'147'483'648 .. 2'147'483'647

while unsigned long = 4 byte
0 ... 4'294'967'295

the range is the same (IF int is implemented as 4-byte)

any ideas?
greets
lumo
PS: i do not want to crop the models in parts...
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Thu Jan 19, 2006 2:44 am    Post subject: Reply with quote

This is caused by the fact, that when the sceGuDrawArray sends the last command to the GU, it packs the primitive type and the count parameter into the same 32 bit argument. Where the 16 upper bits is the primitive and the lower 16 bit is the number of vertices / indices. So you can only use 16 bit for the count.

I've marked the code below in red.

Quote:

void sceGuDrawArray(int prim, int vtype, int count, const void* indices, const void* vertices)
{
if (vtype)
sendCommandi(18,vtype);

if (indices)
{
sendCommandi(16,(((unsigned int)indices) >> 8) & 0xf0000);
sendCommandi(2,((unsigned int)indices) & 0xffffff);
}

if (vertices)
{
sendCommandi(16,(((unsigned int)vertices) >> 8) & 0xf0000);
sendCommandi(1,((unsigned int)vertices) & 0xffffff);
}

sendCommandiStall(4,(prim << 16)|count);
}

_________________
Br, Sandberg
Back to top
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Thu Jan 19, 2006 2:57 am    Post subject: Reply with quote

bugga
at least i know... its not my programming fault :)

thanks
lumo
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
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