-
Notifications
You must be signed in to change notification settings - Fork 2.4k
SDL_render_psp.c: Implemented working viewport support #14070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Since it's no known way to use genuine viewport with PSP SDK, I implemented the workaround using manually added/subtracted offsets to vertices passing to the render API. To assign viewport and cliprect in valid way, I copied part of code from the Vita's module and adjusted it to work on PSP.
Okay, I fixed it so it works on hardware properly. |
I found if I try to make texture bigger than screen and use it as a frame buffer, it gets cuts of content. To ensure that render will be valid, I making sure scissors were initialised properly. P.S. This works on hardware, however, emulator PPSSPP seems has a bug in this case, so I going to report that and making the simple demo.
Can you make a separate PR for the SDL main branch? |
Of course, I just wanted to make sure it's no notices to me, so I want to fix any notices, and then I making full replica of this to |
Offhand, it looks good to me. Do any of these changes need to go into the vita code too? |
Vita right now is fine in this case, it was been fixed before, and then once I got PSP to port my thing to it, and I obtained such thingies that requires a fixing. So, backporting the thing now... (I mean this to main) |
I made for SDL3 this: #14081 |
Description
Since it's no known way to use geuine viewport with PSP SDK, I implemented the workaround using manually added/subtracted offsets to vertices passing to the render API. To assign viewport and cliprect in valid way, I copied part of code from the Vita's module and adjusted it to work on PSP.
Just a small note to author of #13314, @fjtrujy, please take changes that I done into your work since the viewport via existing way just doesn't work at all.
There are showcases made on emulator (it's absoutely same on hardware):
How it worked before my changes:
How it works together with my changes:
EDIT: This valid on emulator, on hardware it glitchies because quick alternation of values seems unsafe.

What I did exactly
Since existing API calls of
sceGuOffset
andsceGuViewport
give no effect in order to set the viewport, however, scissors works as charm, I found that I can replicate viewport functionality by appending viewport's offset ofx
andy
to every vertex that gets used while drawing the stuff. Scissors do help to limit drawing of content in the given scope that allows to prevent drawing of the stuff outside the given scope.Existing Issue(s)
Nothing