PSP lazier blend states, display mode report with 16bit option
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index 387443f..4ff1ea4 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -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 COL8888(r,g,b,a) ((r) | ((g)<<8) | ((b)<<16) | ((a)<<24))
-#define LOGGING
+//#define LOGGING
#ifdef LOGGING
#define LOG(...) printf(__VA_ARGS__)
#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
LRUTargetPushFront(PSP_RenderData* data, PSP_TextureData* psp_texture) {
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) {
return; //nothing to do
}
- //LRUTargetRelink(psp_texture);
LRUTargetRemove(data, psp_texture);
LRUTargetPushFront(data, psp_texture);
}
@@ -1016,7 +1006,7 @@ StartDrawing(SDL_Renderer * renderer)
if(!data->displayListAvail) {
sceGuStart(GU_DIRECT, DisplayList);
data->displayListAvail = SDL_TRUE;
- ResetBlendState(&data->blendState);
+ //ResetBlendState(&data->blendState);
}
// 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);
data->backbuffer = doublebuffer;
data->frontbuffer = ((uint8_t*)doublebuffer)+PSP_FRAME_BUFFER_SIZE*data->bpp;
- memset(&data->blendState, 0, sizeof(PSP_BlendState));
sceGuInit();
/* setup GU */
@@ -1453,16 +1442,8 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
sceGuEnable(GU_CULL_FACE);
*/
- /* Texturing */
- sceGuEnable(GU_TEXTURE_2D);
- 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);
+ //Setup initial blend state
+ ResetBlendState(&data->blendState);
sceGuFinish();
sceGuSync(0,0);
diff --git a/src/video/psp/SDL_pspvideo.c b/src/video/psp/SDL_pspvideo.c
index 33924fa..a37e8b2 100644
--- a/src/video/psp/SDL_pspvideo.c
+++ b/src/video/psp/SDL_pspvideo.c
@@ -158,7 +158,6 @@ PSP_VideoInit(_THIS)
current_mode.refresh_rate = 60;
/* 32 bpp for default */
current_mode.format = SDL_PIXELFORMAT_ABGR8888;
-
current_mode.driverdata = NULL;
SDL_zero(display);
@@ -166,8 +165,15 @@ PSP_VideoInit(_THIS)
display.current_mode = current_mode;
display.driverdata = NULL;
- SDL_AddVideoDisplay(&display, SDL_FALSE);
+ SDL_AddDisplayMode(&display, ¤t_mode);
+
+ /* 16 bpp secondary mode */
+ current_mode.format = SDL_PIXELFORMAT_BGR565;
+ display.desktop_mode = current_mode;
+ display.current_mode = current_mode;
+ SDL_AddDisplayMode(&display, ¤t_mode);
+ SDL_AddVideoDisplay(&display);
return 1;
}