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 

[PSP] sceGuScissor mislabel fix

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> Patch Submissions
View previous topic :: View next topic  
Author Message
SANiK



Joined: 05 Jul 2005
Posts: 29

PostPosted: Fri Jun 05, 2009 9:18 am    Post subject: [PSP] sceGuScissor mislabel fix Reply with quote

Issue:
sceGuScissor does not take in:
startX, startY, width, height

but instead takes in:
startX, startY, endX, endY

You can optionally change the 'w' to 'stopX' and 'h' to 'stopY'
in this file:
/trunk/pspsdk/src/gu/sceGuScissor.c

But the more important one to update I guess is:
/trunk/pspsdk/src/gu/pspgu.h
(CTRL+F for sceGuScissor)

This below is the fixed version:
(Also, originally the comment description was:
* Set what to scissor within the current viewport"
This is somewhat misinformative because sceGuScissor is not affected by the sceGuViewport (it's not contained within the viewport), but by sceGuOffset which dictates the 'top-left' position in the framebuffer)

Code:

/**
  * Set what to scissor within the current framebuffer
  *
  * Note that scissoring is only performed if the custom scissoring is enabled (GU_SCISSOR_TEST)
  *
  * @param x - Left of scissor region
  * @param y - Top of scissor region
  * @param stopX - Right of scissor region
  * @param stopY - Bottom of scissor region
**/
void sceGuScissor(int x, int y, int stopX, int stopY);


---------------Disregard the bottom-------------------------
Anyways, for people googling on how to simulate glViewport using sceGuViewport:

PC-GL:
Code:

#define sgl_viewport(a_x, a_y, a_width, a_height)   glViewport(a_x, a_y, a_width, a_height)


PSP:
Code:

#define sgl_viewport(a_x, a_y, a_width, a_height) { sceGuViewport(1808+(a_x)+((a_width)/2), 2184-(a_y)-((a_height)/2), a_width, a_height); sceGuScissor(a_x, 272-(a_y)-(a_height), (a_x)+(a_width), 272-(a_y)); }


(Remember, on the PC-GL, y=0 is on the bottom, whilst on the PSP y=0 is up top, and this flip is accounted for by the macro)
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Tue Jun 23, 2009 8:04 am    Post subject: Reply with quote

Code:
Sending        gu/pspgu.h
Sending        gu/sceGuScissor.c
Transmitting file data ..
Committed revision 2465.
thanks
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 -> Patch Submissions 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