Skip to content

Commit 39a0fab

Browse files
Wohlstandslouken
authored andcommitted
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.
1 parent 67141e5 commit 39a0fab

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/render/psp/SDL_render_psp.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ typedef struct
8787
SDL_bool cliprect_dirty;
8888
SDL_Rect cliprect;
8989

90-
SDL_Texture *target;
91-
9290
float draw_offset_x;
9391
float draw_offset_y;
9492

@@ -1100,7 +1098,8 @@ static void SetDrawState(PSP_RenderData *data)
11001098

11011099
if (data->drawstate.cliprect_enabled_dirty) {
11021100
if (!data->drawstate.cliprect_enabled && !data->drawstate.viewport_is_set) {
1103-
sceGuDisable(GU_SCISSOR_TEST);
1101+
sceGuScissor(0, 0, data->drawstate.drawablew, data->drawstate.drawableh);
1102+
sceGuEnable(GU_SCISSOR_TEST);
11041103
}
11051104
data->drawstate.cliprect_enabled_dirty = SDL_FALSE;
11061105
}
@@ -1167,14 +1166,12 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
11671166
}
11681167
SDL_memcpy(gpumem, vertices, vertsize);
11691168

1170-
data->drawstate.target = renderer->target;
1171-
if (!data->drawstate.target) {
1169+
if (!data->boundTarget) {
11721170
SDL_GL_GetDrawableSize(renderer->window, &w, &h);
11731171
} else {
1174-
if (SDL_QueryTexture(renderer->target, NULL, NULL, &w, &h) < 0) {
1175-
w = data->drawstate.drawablew;
1176-
h = data->drawstate.drawableh;
1177-
}
1172+
PSP_TextureData *psp_texture = (PSP_TextureData *)data->boundTarget->driverdata;
1173+
w = psp_texture->width;
1174+
h = psp_texture->height;
11781175
}
11791176

11801177
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {

0 commit comments

Comments
 (0)