[PSP] sceGuScissor mislabel fix

Create a single thread for each patch to be added to the repository. Please try to stay on topic.
Post Reply
SANiK
Posts: 29
Joined: Tue Jul 05, 2005 5:25 am

[PSP] sceGuScissor mislabel fix

Post by SANiK »

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: Select all

/**
  * 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: Select all

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

Code: Select all

#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)
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Code: Select all

Sending        gu/pspgu.h
Sending        gu/sceGuScissor.c
Transmitting file data ..
Committed revision 2465.
thanks
Post Reply