Skip to content

Commit e8d7fad

Browse files
committed
Applying trick for Alpha in 5551
1 parent 74e76ef commit e8d7fad

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/render/psp/SDL_render_psp.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,22 @@ static int PSP_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
514514
PSP_Texture *psp_tex = (PSP_Texture *)texture->driverdata;
515515
sceGuDrawBufferList(psp_tex->format, vrelptr(psp_tex->data), psp_tex->width);
516516
data->currentDrawBufferFormat = psp_tex->format;
517+
518+
if(psp_tex->format == GU_PSM_5551) {
519+
sceGuEnable(GU_STENCIL_TEST);
520+
sceGuStencilOp(GU_REPLACE, GU_REPLACE, GU_REPLACE);
521+
sceGuStencilFunc(GU_GEQUAL, 0xff, 0xff);
522+
sceGuEnable(GU_ALPHA_TEST);
523+
sceGuAlphaFunc(GU_GREATER, 0x00, 0xff);
524+
} else {
525+
sceGuDisable(GU_STENCIL_TEST);
526+
sceGuDisable(GU_ALPHA_TEST);
527+
}
528+
529+
//Enable scissor to avoid drawing outside viewport
530+
sceGuEnable(GU_SCISSOR_TEST);
531+
sceGuScissor(0,0,psp_tex->width, psp_tex->height);
532+
517533
} else {
518534
sceGuDrawBufferList(data->drawBufferFormat, vrelptr(data->frontbuffer), PSP_FRAME_BUFFER_WIDTH);
519535
data->currentDrawBufferFormat = data->drawBufferFormat;

0 commit comments

Comments
 (0)