SDL2: PSP: Fixed render-to-texture larger than screen

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.
This commit is contained in:
Wohlstand
2025-09-30 01:34:17 +03:00
committed by Sam Lantinga
parent 67141e5079
commit 39a0fab4d7

View File

@@ -87,8 +87,6 @@ typedef struct
SDL_bool cliprect_dirty; SDL_bool cliprect_dirty;
SDL_Rect cliprect; SDL_Rect cliprect;
SDL_Texture *target;
float draw_offset_x; float draw_offset_x;
float draw_offset_y; float draw_offset_y;
@@ -1100,7 +1098,8 @@ static void SetDrawState(PSP_RenderData *data)
if (data->drawstate.cliprect_enabled_dirty) { if (data->drawstate.cliprect_enabled_dirty) {
if (!data->drawstate.cliprect_enabled && !data->drawstate.viewport_is_set) { if (!data->drawstate.cliprect_enabled && !data->drawstate.viewport_is_set) {
sceGuDisable(GU_SCISSOR_TEST); sceGuScissor(0, 0, data->drawstate.drawablew, data->drawstate.drawableh);
sceGuEnable(GU_SCISSOR_TEST);
} }
data->drawstate.cliprect_enabled_dirty = SDL_FALSE; data->drawstate.cliprect_enabled_dirty = SDL_FALSE;
} }
@@ -1167,14 +1166,12 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
} }
SDL_memcpy(gpumem, vertices, vertsize); SDL_memcpy(gpumem, vertices, vertsize);
data->drawstate.target = renderer->target; if (!data->boundTarget) {
if (!data->drawstate.target) {
SDL_GL_GetDrawableSize(renderer->window, &w, &h); SDL_GL_GetDrawableSize(renderer->window, &w, &h);
} else { } else {
if (SDL_QueryTexture(renderer->target, NULL, NULL, &w, &h) < 0) { PSP_TextureData *psp_texture = (PSP_TextureData *)data->boundTarget->driverdata;
w = data->drawstate.drawablew; w = psp_texture->width;
h = data->drawstate.drawableh; h = psp_texture->height;
}
} }
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) { if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {