Skip to content

Commit

Permalink
Remove option to be able to select the render buffer type for fullscr…
Browse files Browse the repository at this point in the history
…een and force it to swap (Swap works better for fullscreen)

Also one slight change, made it to enable the D3DPRESENTFLAG_LOCKABLE_BACKBUFFER when framebuffer is enabled since we automatically disable antialiasing when the framebuffer is enabeld anyway
  • Loading branch information
death-droid committed Oct 12, 2012
1 parent 3a70396 commit 344aa6d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 76 deletions.
43 changes: 0 additions & 43 deletions Config.cpp
Expand Up @@ -117,22 +117,6 @@ const char* strDXDeviceDescs[] = { "HAL", "REF" };
/*
* Constants
*/
/*
D3DFMT_D16_LOCKABLE = 70,
D3DFMT_D32 = 71,
D3DFMT_D15S1 = 73,
D3DFMT_D24S8 = 75,
D3DFMT_D16 = 80,
D3DFMT_D24X8 = 77,
D3DFMT_D24X4S4 = 79,
*/

BufferSettingInfo DirectXRenderBufferSettings[] =
{
"Copy", 1, D3DSWAPEFFECT_COPY,
"Flip (def)", 1, D3DSWAPEFFECT_FLIP,
};

BufferSettingInfo DirectXDepthBufferSetting[] =
{
"16-bit (def)", D3DFMT_D16, D3DFMT_D16,
Expand All @@ -151,7 +135,6 @@ const SettingInfo OnScreenDisplaySettings[] =
"Display Debug Information With Core Msgs", ONSCREEN_DISPLAY_DEBUG_INFORMATION_WITH_CORE_MSG,
};

int numberOfDirectXRenderBufferSettings = sizeof(DirectXRenderBufferSettings)/sizeof(BufferSettingInfo);
int numberOfDirectXDepthBufferSettings = sizeof(DirectXDepthBufferSetting)/sizeof(BufferSettingInfo);

void WriteConfiguration(void);
Expand Down Expand Up @@ -357,9 +340,6 @@ void WriteConfiguration(void)
fprintf(f, "DisplayOnscreenFPS ");
fprintf(f, "%d\n", options.bDisplayOnscreenFPS);

fprintf(f, "FrameBufferType ");
fprintf(f, "%d\n", options.RenderBufferSetting);

fprintf(f, "DirectXDepthBufferSetting ");
fprintf(f, "%d\n", (uint32)options.DirectXDepthBufferSetting);

Expand Down Expand Up @@ -532,7 +512,6 @@ void ReadConfiguration(void)
options.bForceSoftwareTnL = TRUE;
options.bEnableSSE = TRUE;
options.bEnableVertexShader = FALSE;
options.RenderBufferSetting=1;
options.forceTextureFilter = 0;
options.textureQuality = TXT_QUALITY_DEFAULT;
options.bTexRectOnly = FALSE;
Expand Down Expand Up @@ -614,7 +593,6 @@ void ReadConfiguration(void)
options.bDisplayTooltip = ReadRegistryDwordVal("DisplayTooltip");
options.bHideAdvancedOptions = ReadRegistryDwordVal("HideAdvancedOptions");
options.bDisplayOnscreenFPS = ReadRegistryDwordVal("DisplayOnscreenFPS");
options.RenderBufferSetting = ReadRegistryDwordVal("FrameBufferType");
options.textureEnhancement = ReadRegistryDwordVal("TextureEnhancement");
options.textureEnhancementControl = ReadRegistryDwordVal("TextureEnhancementControl");
options.forceTextureFilter = ReadRegistryDwordVal("ForceTextureFilter");
Expand Down Expand Up @@ -1033,11 +1011,6 @@ typedef struct {


ToolTipMsg ttmsg[] = {
{ //backtome
IDC_DX_SWAP_EFFECT,
"DirectX Frame Buffer Swap Effect",
"Double buffer flip is faster for full screen\n\n"
},
{
IDC_SLIDER_FSAA,
"DirectX Full Screen Mode Anti-Aliasing Setting",
Expand Down Expand Up @@ -2365,21 +2338,10 @@ LRESULT APIENTRY DirectXDialogProc(HWND hDlg, unsigned message, LONG wParam, LON
SendDlgItemMessage(hDlg, IDC_SHOW_FPS, CB_SETCURSEL, i, 0);
}

SendDlgItemMessage(hDlg, IDC_DX_SWAP_EFFECT, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hDlg, IDC_DEPTH_BUFFER, CB_RESETCONTENT, 0, 0);
item = GetDlgItem(hDlg, IDC_SOFTWARE_TNL );
EnableWindow(item, TRUE);

SendDlgItemMessage(hDlg, IDC_DX_SWAP_EFFECT, CB_RESETCONTENT, 0, 0);
for( i=0; i<numberOfDirectXRenderBufferSettings; i++ )
{
SendDlgItemMessage(hDlg, IDC_DX_SWAP_EFFECT, CB_INSERTSTRING, i, (LPARAM) DirectXRenderBufferSettings[i].description);
if( options.RenderBufferSetting == i )
{
SendDlgItemMessage(hDlg, IDC_DX_SWAP_EFFECT, CB_SETCURSEL, i, 0);
}
}

for( i=0; i<numberOfDirectXDepthBufferSettings; i++ )
{
SendDlgItemMessage(hDlg, IDC_DEPTH_BUFFER, CB_INSERTSTRING, i, (LPARAM) DirectXDepthBufferSetting[i].description);
Expand All @@ -2388,8 +2350,6 @@ LRESULT APIENTRY DirectXDialogProc(HWND hDlg, unsigned message, LONG wParam, LON

if( status.bGameIsRunning )
{
item = GetDlgItem(hDlg, IDC_DX_SWAP_EFFECT);
EnableWindow(item, FALSE);
item = GetDlgItem(hDlg, IDC_DEPTH_BUFFER );
EnableWindow(item, FALSE);
item = GetDlgItem(hDlg, IDC_SOFTWARE_TNL );
Expand Down Expand Up @@ -2480,7 +2440,6 @@ LRESULT APIENTRY DirectXDialogProc(HWND hDlg, unsigned message, LONG wParam, LON
ShowItem(hDlg, IDC_DEPTH_BUFFER, FALSE);
ShowItem(hDlg, IDC_SHOW_FPS, FALSE);
ShowItem(hDlg, IDC_FPS_COLOR, FALSE);
ShowItem(hDlg, IDC_DX_SWAP_EFFECT, FALSE);
ShowItem(hDlg, IDC_SETTING_LABEL2, FALSE);
ShowItem(hDlg, IDC_SETTING_LABEL3, FALSE);
ShowItem(hDlg, IDC_LABEL5, FALSE);
Expand All @@ -2493,7 +2452,6 @@ LRESULT APIENTRY DirectXDialogProc(HWND hDlg, unsigned message, LONG wParam, LON
ShowItem(hDlg, IDC_DEPTH_BUFFER, TRUE);
ShowItem(hDlg, IDC_SHOW_FPS, TRUE);
ShowItem(hDlg, IDC_FPS_COLOR, TRUE);
ShowItem(hDlg, IDC_DX_SWAP_EFFECT, TRUE);
ShowItem(hDlg, IDC_SETTING_LABEL2, TRUE);
ShowItem(hDlg, IDC_SETTING_LABEL3, TRUE);
ShowItem(hDlg, IDC_LABEL5, TRUE);
Expand Down Expand Up @@ -2558,7 +2516,6 @@ LRESULT APIENTRY DirectXDialogProc(HWND hDlg, unsigned message, LONG wParam, LON
i = SendDlgItemMessage(hDlg, IDC_SHOW_FPS, CB_GETCURSEL, 0, 0);
options.bDisplayOnscreenFPS = OnScreenDisplaySettings[i].setting;

options.RenderBufferSetting = SendDlgItemMessage(hDlg, IDC_DX_SWAP_EFFECT, CB_GETCURSEL, 0, 0);
options.DirectXDevice = SendDlgItemMessage(hDlg, IDC_DX_DEVICE, CB_GETCURSEL, 0, 0);

options.DirectXDepthBufferSetting = SendDlgItemMessage(hDlg, IDC_DEPTH_BUFFER, CB_GETCURSEL, 0, 0);
Expand Down
2 changes: 0 additions & 2 deletions Config.h
Expand Up @@ -171,8 +171,6 @@ typedef struct {
BOOL bLoadHiResTextures;
BOOL bCacheHiResTextures;

int RenderBufferSetting;

int DirectXDepthBufferSetting;
uint32 DirectXAntiAliasingValue;
uint32 DirectXAnisotropyValue;
Expand Down
18 changes: 8 additions & 10 deletions Device/DirectXDevice/DXGraphicsContext.cpp
Expand Up @@ -338,13 +338,10 @@ bool CDXGraphicsContext::Initialize(HWND hWnd, HWND hWndStatus,
// Clear/Update a few times to ensure that all of the buffers are cleared
if ( m_pd3dDevice )
{
for (int i=0; i<DirectXRenderBufferSettings[options.RenderBufferSetting].number+1; i++ )
{
Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
m_pd3dDevice->BeginScene();
m_pd3dDevice->EndScene();
UpdateFrame();
}
Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
m_pd3dDevice->BeginScene();
m_pd3dDevice->EndScene();
UpdateFrame();
}

MYD3DVIEWPORT vp = {
Expand Down Expand Up @@ -550,7 +547,7 @@ HRESULT CDXGraphicsContext::InitializeD3D()
ZeroMemory( &m_d3dpp, sizeof(m_d3dpp) );

m_d3dpp.Windowed = pDeviceInfo->bWindowed;
m_d3dpp.BackBufferCount = DirectXRenderBufferSettings[options.RenderBufferSetting].number;
m_d3dpp.BackBufferCount = 1;
m_d3dpp.EnableAutoDepthStencil = TRUE; /*m_bUseDepthBuffer;*/
m_d3dpp.AutoDepthStencilFormat = pModeInfo->DepthStencilFormat;
m_d3dpp.AutoDepthStencilFormat = (D3DFORMAT)(DirectXDepthBufferSetting[options.DirectXDepthBufferSetting].number);
Expand Down Expand Up @@ -582,7 +579,8 @@ HRESULT CDXGraphicsContext::InitializeD3D()
if( currentRomOptions.N64FrameBufferEmuType != FRM_BUF_NONE && m_FSAAIsEnabled )
{
m_FSAAIsEnabled = false;
m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
m_d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
TRACE0("FSAA is turned off in order to use BackBuffer emulation");
SetWindowText(g_GraphicsInfo.hStatusBar, "FSAA is turned off in order to use BackBuffer emulation");
}
Expand All @@ -602,7 +600,7 @@ HRESULT CDXGraphicsContext::InitializeD3D()
else
{
if( !m_FSAAIsEnabled )
m_d3dpp.SwapEffect = (D3DSWAPEFFECT)DirectXRenderBufferSettings[options.RenderBufferSetting].setting;
m_d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
else
m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // Anti-Aliasing mode
windowSetting.uDisplayWidth = windowSetting.uFullScreenDisplayWidth;
Expand Down
2 changes: 0 additions & 2 deletions Device/DirectXDevice/DXGraphicsContext.h
Expand Up @@ -100,9 +100,7 @@ struct D3DAdapterInfo
int dwCurrentDevice;
};

extern BufferSettingInfo DirectXRenderBufferSettings[];
extern BufferSettingInfo DirectXDepthBufferSetting[];
extern int numberOfDirectXRenderBufferSettings;
extern int numberOfDirectXDepthBufferSettings;
struct TxtrCacheEntry;

Expand Down
20 changes: 4 additions & 16 deletions Device/FrameBuffer.cpp
Expand Up @@ -402,26 +402,14 @@ bool FrameBufferManager::IsDIaRenderTexture()

// Return -1 if the addr is not in recent frame buffer addr
// Return 1 if the addr is in the frame buffer which is currently being displayed
// Return 2 if the addr is in the 3rd frame buffer if we are using triple buffer
// this function will not return 0 which means the addr is within the current rendering frame buffer
// this should not happen
extern BufferSettingInfo DirectXRenderBufferSettings[];
// this should not happen
int FrameBufferManager::IsAddrInRecentFrameBuffers(uint32 addr)
{
if( addr >= g_uRecentCIInfoPtrs[1]->dwAddr && addr < g_uRecentCIInfoPtrs[1]->dwAddr+g_uRecentCIInfoPtrs[1]->dwMemSize )
if( (addr >= g_uRecentCIInfoPtrs[1]->dwAddr && addr < g_uRecentCIInfoPtrs[1]->dwAddr+g_uRecentCIInfoPtrs[1]->dwMemSize) ||
(addr >= g_uRecentCIInfoPtrs[0]->dwAddr && addr < g_uRecentCIInfoPtrs[0]->dwAddr+g_uRecentCIInfoPtrs[0]->dwMemSize && status.bHandleN64RenderTexture))
return 1;
else if( DirectXRenderBufferSettings[options.RenderBufferSetting].number > 1 &&
addr >= g_uRecentCIInfoPtrs[2]->dwAddr && addr < g_uRecentCIInfoPtrs[2]->dwAddr+g_uRecentCIInfoPtrs[1]->dwMemSize )
{
return 2;
}
else if( addr >= g_uRecentCIInfoPtrs[0]->dwAddr && addr < g_uRecentCIInfoPtrs[0]->dwAddr+g_uRecentCIInfoPtrs[0]->dwMemSize && status.bHandleN64RenderTexture )
{
return 1;
}
{
return -1;
}
return -1;
}

int FrameBufferManager::CheckAddrInBackBuffers(uint32 addr, uint32 memsize, bool copyToRDRAM)
Expand Down
2 changes: 0 additions & 2 deletions Video.rc
Expand Up @@ -67,8 +67,6 @@ DIRECTX DIALOGEX 0, 0, 300, 187
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
COMBOBOX IDC_DX_SWAP_EFFECT,108,30,174,94,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Swap Effect:",IDC_SETTING_LABEL2,12,32,96,8
LTEXT "Depth Buffer Type:",IDC_SETTING_LABEL3,12,50,96,8
COMBOBOX IDC_DEPTH_BUFFER,108,48,64,94,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Force Software Transformation && Lighting",IDC_SOFTWARE_TNL,
Expand Down
1 change: 0 additions & 1 deletion resource.h
Expand Up @@ -88,7 +88,6 @@
#define IDC_FULLSCREEN_FREQUENCY 1085
#define IDC_SOFTWARE_TNL 1086
#define IDC_EDIT_WIDTH 1087
#define IDC_DX_SWAP_EFFECT 1090
#define IDC_SLIDER_FSAA 1092
#define IDC_SLIDER_ANISO 1093
#define IDC_ANTI_ALIASING_TEXT 1094
Expand Down

1 comment on commit 344aa6d

@death-droid
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small note... "force it to swap (Swap works better for fullscreen)"
should of been, "force it to flip(flip works better for fullscreen)"

Please sign in to comment.