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 

Strange GE problem...

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



Joined: 31 Jul 2009
Posts: 35

PostPosted: Fri Oct 23, 2009 12:38 am    Post subject: Strange GE problem... Reply with quote

I'm making a library wich has the goal to replace the PSPgu, it contains high and low level functions (actualy i can go to 650FPS when blitting a fullscreen image in 32bits mode).

Now I want to add functions to blit the Sony OSK but there was a bug when I blit image+osk (fast scanlines and controls doesn't respond, but no freeze).

I foudn a solution, but I've a question:
what is the difference between these two codes :
Code:

   int j = 0;
   while (j < width) {
      TextureVertex* vertices = (TextureVertex*)geGetMemory(2 * sizeof(TextureVertex));
      int sliceWidth = 64;
      if (j + sliceWidth > width) sliceWidth = width - j;
      vertices[0].u = sx + j;
      vertices[0].v = sy;
      vertices[0].x = x + j;
      vertices[0].y = y;
      vertices[1].u = sx + j + sliceWidth;
      vertices[1].v = sy + height;
      vertices[1].x = x + j + sliceWidth;
      vertices[1].y = y + height;
      vertices[0].color = vertices[1].color = 0xffffffff;

      geSendCommandi(CMD_DRAW_MODE, GE_COLOR_8888 | GE_TEXTURE_16BIT | GE_VERTEX_16BIT | GE_TRANSFORM_2D);
      geSendCommandi(CMD_VERTICES_POINTER, ((unsigned int)vertices) & 0xffffff);
      geSendCommandi(CMD_DRAW_TYPE_VCOUNT, (GE_SPRITES << 16)|2);
      j += sliceWidth;
   }

Code:
   int total_count = ((int)(width/64))+1;
   TextureVertex* vertices = (TextureVertex*)geGetMemory((total_count<<1) * sizeof(TextureVertex));
   int count = 0;
   int j = 0;
   while(j < width){
      int sliceWidth = 64;
      if (j + sliceWidth > width) sliceWidth = width - j;
      vertices[count+0].u = sx + j;
      vertices[count+0].v = sy;
      vertices[count+0].x = x + j;
      vertices[count+0].y = y;
      vertices[count+1].u = sx + j + sliceWidth;
      vertices[count+1].v = sy + height;
      vertices[count+1].x = x + j + sliceWidth;
      vertices[count+1].y = y + height;
      vertices[count+0].color = vertices[count+1].color = 0xffffffff;
      j += sliceWidth;
      count += 2;
   }

   geSendCommandi(CMD_DRAW_MODE, GE_COLOR_8888 | GE_TEXTURE_16BIT | GE_VERTEX_16BIT | GE_TRANSFORM_2D);
   geSendCommandi(CMD_VERTICES_POINTER, ((unsigned int)vertices) & 0xffffff);
   geSendCommandi(CMD_DRAW_TYPE_VCOUNT, (GE_SPRITES << 16)|(total_count<<1));

In the first, each "sprite" is blitted in the loop, in the second all vertices are stored and they're blitted when loop is finished.
I verified if the 'total_count' variable is the good, and yes...
_________________
I'm French, and 15 years old, so my English is not good...
Back to top
View user's profile Send private message
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