PSP lazier blend states, display mode report with 16bit option

This commit is contained in:
stdgregwar 2021-01-09 11:25:39 +01:00 committed by Sam Lantinga
parent 0f5368fe11
commit c3ec62d6a6
2 changed files with 12 additions and 25 deletions

View File

@ -56,7 +56,7 @@ static unsigned int __attribute__((aligned(16))) DisplayList[262144];
#define COL4444(r,g,b,a) ((r>>4) | ((g>>4)<<4) | ((b>>4)<<8) | ((a>>4)<<12)) #define COL4444(r,g,b,a) ((r>>4) | ((g>>4)<<4) | ((b>>4)<<8) | ((a>>4)<<12))
#define COL8888(r,g,b,a) ((r) | ((g)<<8) | ((b)<<16) | ((a)<<24)) #define COL8888(r,g,b,a) ((r) | ((g)<<8) | ((b)<<16) | ((a)<<24))
#define LOGGING //#define LOGGING
#ifdef LOGGING #ifdef LOGGING
#define LOG(...) printf(__VA_ARGS__) #define LOG(...) printf(__VA_ARGS__)
#else #else
@ -232,15 +232,6 @@ LRUTargetRelink(PSP_TextureData* psp_texture) {
} }
} }
/*static void
LRUTargetFixTail(PSP_RenderData* data, PSP_TextureData* psp_texture) {
if(data->least_recent_target == psp_texture) {
data->least_recent_target = psp_texture->prevhotw;
} else if(!data->least_recent_target) {
data->least_recent_target = psp_texture;
}
}*/
static void static void
LRUTargetPushFront(PSP_RenderData* data, PSP_TextureData* psp_texture) { LRUTargetPushFront(PSP_RenderData* data, PSP_TextureData* psp_texture) {
LOG("Pushing %p (%dKB) front.\n", (void*)psp_texture, psp_texture->size / 1024); LOG("Pushing %p (%dKB) front.\n", (void*)psp_texture, psp_texture->size / 1024);
@ -274,7 +265,6 @@ LRUTargetBringFront(PSP_RenderData* data, PSP_TextureData* psp_texture) {
if(data->most_recent_target == psp_texture) { if(data->most_recent_target == psp_texture) {
return; //nothing to do return; //nothing to do
} }
//LRUTargetRelink(psp_texture);
LRUTargetRemove(data, psp_texture); LRUTargetRemove(data, psp_texture);
LRUTargetPushFront(data, psp_texture); LRUTargetPushFront(data, psp_texture);
} }
@ -1016,7 +1006,7 @@ StartDrawing(SDL_Renderer * renderer)
if(!data->displayListAvail) { if(!data->displayListAvail) {
sceGuStart(GU_DIRECT, DisplayList); sceGuStart(GU_DIRECT, DisplayList);
data->displayListAvail = SDL_TRUE; data->displayListAvail = SDL_TRUE;
ResetBlendState(&data->blendState); //ResetBlendState(&data->blendState);
} }
// Check if we need a draw buffer change // Check if we need a draw buffer change
@ -1427,7 +1417,6 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
doublebuffer = valloc(PSP_FRAME_BUFFER_SIZE*data->bpp*2); doublebuffer = valloc(PSP_FRAME_BUFFER_SIZE*data->bpp*2);
data->backbuffer = doublebuffer; data->backbuffer = doublebuffer;
data->frontbuffer = ((uint8_t*)doublebuffer)+PSP_FRAME_BUFFER_SIZE*data->bpp; data->frontbuffer = ((uint8_t*)doublebuffer)+PSP_FRAME_BUFFER_SIZE*data->bpp;
memset(&data->blendState, 0, sizeof(PSP_BlendState));
sceGuInit(); sceGuInit();
/* setup GU */ /* setup GU */
@ -1453,16 +1442,8 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
sceGuEnable(GU_CULL_FACE); sceGuEnable(GU_CULL_FACE);
*/ */
/* Texturing */ //Setup initial blend state
sceGuEnable(GU_TEXTURE_2D); ResetBlendState(&data->blendState);
sceGuShadeModel(GU_SMOOTH);
sceGuTexWrap(GU_REPEAT, GU_REPEAT);
/* Blending */
//sceGuEnable(GU_BLEND);
//sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
sceGuFinish(); sceGuFinish();
sceGuSync(0,0); sceGuSync(0,0);

View File

@ -158,7 +158,6 @@ PSP_VideoInit(_THIS)
current_mode.refresh_rate = 60; current_mode.refresh_rate = 60;
/* 32 bpp for default */ /* 32 bpp for default */
current_mode.format = SDL_PIXELFORMAT_ABGR8888; current_mode.format = SDL_PIXELFORMAT_ABGR8888;
current_mode.driverdata = NULL; current_mode.driverdata = NULL;
SDL_zero(display); SDL_zero(display);
@ -166,8 +165,15 @@ PSP_VideoInit(_THIS)
display.current_mode = current_mode; display.current_mode = current_mode;
display.driverdata = NULL; display.driverdata = NULL;
SDL_AddVideoDisplay(&display, SDL_FALSE); SDL_AddDisplayMode(&display, &current_mode);
/* 16 bpp secondary mode */
current_mode.format = SDL_PIXELFORMAT_BGR565;
display.desktop_mode = current_mode;
display.current_mode = current_mode;
SDL_AddDisplayMode(&display, &current_mode);
SDL_AddVideoDisplay(&display);
return 1; return 1;
} }