win32: add ability to disable each gpu, for speedup by halting render of useless screens

This commit is contained in:
zeromus 2009-06-09 03:35:37 +00:00
parent 7dbe16b4c4
commit 333a10a655
6 changed files with 40 additions and 2 deletions

View File

@ -3062,6 +3062,14 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
gpu->refreshAffineStartRegs(-1,-1);
}
//blacken the screen if it is turned off by the user
if(!CommonSettings.showGpu.screens[gpu->core])
{
u8 * dst = GPU_tempScreen + (screen->offset + l) * 512;
memset(dst,0,512);
return;
}
//cache some parameters which are assumed to be stable throughout the rendering of the entire line
gpu->currLine = (u8)l;
u16 mosaic_control = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0);

View File

@ -389,6 +389,14 @@ extern struct TCommonSettings {
//this is the user's choice of manual backup type, for cases when the autodetection can't be trusted
int manualBackupType;
struct _ShowGpu {
_ShowGpu() : main(true), sub(true) {}
union {
struct { bool main,sub; };
bool screens[2];
};
} showGpu;
} CommonSettings;
extern char ROMserial[20];

View File

@ -1510,10 +1510,12 @@ void gfx3d_VBlankEndSignal(bool skipFrame)
if(!drawPending) return;
drawPending = FALSE;
gpu3D->NDS_3D_Render();
if(CommonSettings.showGpu.main)
gpu3D->NDS_3D_Render();
//if the null 3d core is chosen, then we need to clear out the 3d buffers to keep old data from being rendered
if(gpu3D == &gpu3DNull)
if(gpu3D == &gpu3DNull || !CommonSettings.showGpu.main)
{
memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedScreen));
memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedAlpha));

View File

@ -1639,6 +1639,9 @@ int _main()
ShowMicrophone = GetPrivateProfileInt("Display","Display Microphone", 0, IniName);
ScreenGap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName);
FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName);
CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0;
CommonSettings.showGpu.sub = GetPrivateProfileInt("Display", "SubGpu", 1, IniName) != 0;
//Get Ram-Watch values
RWSaveWindowPos = GetPrivateProfileInt("RamWatch", "SaveWindowPos", 0, IniName);
@ -2674,6 +2677,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
MainWindow->checkMenu(IDC_FRAMESKIP8, MF_BYCOMMAND | (!autoframeskipenab && frameskiprate==8) ? MF_CHECKED:MF_UNCHECKED);
MainWindow->checkMenu(IDC_FRAMESKIP9, MF_BYCOMMAND | (!autoframeskipenab && frameskiprate==9) ? MF_CHECKED:MF_UNCHECKED);
MainWindow->checkMenu(IDM_MGPU, MF_BYCOMMAND | CommonSettings.showGpu.main ? MF_CHECKED:MF_UNCHECKED);
MainWindow->checkMenu(IDM_SGPU, MF_BYCOMMAND | CommonSettings.showGpu.sub ? MF_CHECKED:MF_UNCHECKED);
//Language selection
//Save type
@ -3180,6 +3186,16 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
//========================================================== Tools end
case IDM_MGPU:
CommonSettings.showGpu.main = !CommonSettings.showGpu.main;
WritePrivateProfileInt("Display","MainGpu",CommonSettings.showGpu.main?1:0,IniName);
return 0;
case IDM_SGPU:
CommonSettings.showGpu.sub = !CommonSettings.showGpu.sub;
WritePrivateProfileInt("Display","SubGpu",CommonSettings.showGpu.sub?1:0,IniName);
return 0;
case IDM_MBG0 :
if(MainScreen.gpu->dispBG[0])
{

View File

@ -97,6 +97,8 @@
#define IDC_LANGENGLISH 210
#define IDC_LANGFRENCH 211
#define IDC_LANGDANISH 212
#define IDM_MGPU 213
#define IDM_SGPU 214
#define IDC_8_BIT 302
#define IDC_16_BIT 303
#define IDC_32_BIT 304

View File

@ -359,11 +359,13 @@ MENU_PRINCIPAL MENU
MENUITEM SEPARATOR
POPUP "&View Layers"
{
MENUITEM "Main GPU", IDM_MGPU, CHECKED
MENUITEM "Main BG 0", IDM_MBG0, CHECKED
MENUITEM "Main BG 1", IDM_MBG1, CHECKED
MENUITEM "Main BG 2", IDM_MBG2, CHECKED
MENUITEM "Main BG 3", IDM_MBG3, CHECKED
MENUITEM SEPARATOR
MENUITEM "Sub GPU", IDM_SGPU, CHECKED
MENUITEM "Sub BG 0", IDM_SBG0, CHECKED
MENUITEM "Sub BG 1", IDM_SBG1, CHECKED
MENUITEM "Sub BG 2", IDM_SBG2, CHECKED