Fix applying anti-aliasing without having to open the gfx config. Thanks to skid for pointing out the VerifyValidity problem to me ;)

Fixes issue 4498.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7574 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2011-05-31 20:16:59 +00:00
parent 39cbd73e02
commit 84906edf61
5 changed files with 37 additions and 44 deletions

View File

@ -113,8 +113,6 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
VerifyValidity();
// Load common settings
iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
bool bTmp;
@ -173,8 +171,6 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.GetIfExists("Video", "PH_ZNear", &sPhackvalue[0]);
iniFile.GetIfExists("Video", "PH_ZFar", &sPhackvalue[1]);
iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
VerifyValidity();
}
void VideoConfig::VerifyValidity()

View File

@ -149,6 +149,7 @@ struct VideoConfig
int iAdapter;
// Static config per API
// TODO: Move this out of VideoConfig
struct
{
API_TYPE APIType;

View File

@ -80,19 +80,6 @@ std::string VideoBackend::GetName()
void InitBackendInfo()
{
g_Config.backend_info.APIType = API_D3D11;
g_Config.backend_info.bUseRGBATextures = true; // the GX formats barely match any D3D11 formats
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsFormatReinterpretation = true;
g_Config.backend_info.bSupportsPixelLighting = true;
}
void VideoBackend::ShowConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
InitBackendInfo();
HRESULT hr = DX11::D3D::LoadDXGI();
if (SUCCEEDED(hr)) hr = DX11::D3D::LoadD3D();
if (FAILED(hr))
@ -101,6 +88,13 @@ void VideoBackend::ShowConfig(void *_hParent)
return;
}
g_Config.backend_info.APIType = API_D3D11;
g_Config.backend_info.bUseRGBATextures = true; // the GX formats barely match any D3D11 formats
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bSupportsDualSourceBlend = true;
g_Config.backend_info.bSupportsFormatReinterpretation = true;
g_Config.backend_info.bSupportsPixelLighting = true;
IDXGIFactory* factory;
IDXGIAdapter* ad;
hr = DX11::PCreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory);
@ -140,12 +134,16 @@ void VideoBackend::ShowConfig(void *_hParent)
// Clear ppshaders string vector
g_Config.backend_info.PPShaders.clear();
VideoConfigDiag diag((wxWindow*)_hParent, _trans("Direct3D11"), "gfx_dx11");
diag.ShowModal();
g_Config.backend_info.Adapters.clear();
DX11::D3D::UnloadDXGI();
DX11::D3D::UnloadD3D();
}
void VideoBackend::ShowConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
InitBackendInfo();
VideoConfigDiag diag((wxWindow*)_hParent, _trans("Direct3D11"), "gfx_dx11");
diag.ShowModal();
#endif
}
@ -157,7 +155,8 @@ bool VideoBackend::Initialize(void *&window_handle)
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str());
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue);
g_Config.UpdateProjectionHack();
g_Config.VerifyValidity();
UpdateActiveConfig();
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Loading - Please wait."));

View File

@ -88,6 +88,8 @@ std::string VideoBackend::GetName()
void InitBackendInfo()
{
DX9::D3D::Init();
g_Config.backend_info.APIType = API_D3D9;
g_Config.backend_info.bUseRGBATextures = false;
g_Config.backend_info.bSupports3DVision = true;
@ -95,15 +97,8 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsFormatReinterpretation = true;
const int shaderModel = ((DX9::D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF);
const int maxConstants = (shaderModel < 3) ? 32 : ((shaderModel < 4) ? 224 : 65536);
const int maxConstants = (shaderModel < 3) ? 32 : ((shaderModel < 4) ? 224 : 65536);
g_Config.backend_info.bSupportsPixelLighting = C_PLIGHTS + 40 <= maxConstants && C_PMATERIALS + 4 <= maxConstants;
}
void VideoBackend::ShowConfig(void* parent)
{
#if defined(HAVE_WX) && HAVE_WX
DX9::D3D::Init();
InitBackendInfo();
// adapters
g_Config.backend_info.Adapters.clear();
@ -122,12 +117,16 @@ void VideoBackend::ShowConfig(void* parent)
// Clear ppshaders string vector
g_Config.backend_info.PPShaders.clear();
DX9::D3D::Shutdown();
}
void VideoBackend::ShowConfig(void* parent)
{
#if defined(HAVE_WX) && HAVE_WX
InitBackendInfo();
VideoConfigDiag diag((wxWindow*)parent, _trans("Direct3D9"), "gfx_dx9");
diag.ShowModal();
g_Config.backend_info.Adapters.clear();
DX9::D3D::Shutdown();
#endif
}
@ -139,8 +138,8 @@ bool VideoBackend::Initialize(void *&window_handle)
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx9.ini").c_str());
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue);
g_Config.UpdateProjectionHack();
g_Config.VerifyValidity();
UpdateActiveConfig();
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Loading - Please wait."));

View File

@ -135,12 +135,6 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsDualSourceBlend = false; // supported, but broken
g_Config.backend_info.bSupportsFormatReinterpretation = false;
g_Config.backend_info.bSupportsPixelLighting = true;
}
void VideoBackend::ShowConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
InitBackendInfo();
// aamodes
const char* caamodes[] = {"None", "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA"};
@ -148,7 +142,12 @@ void VideoBackend::ShowConfig(void *_hParent)
// pp shaders
GetShaders(g_Config.backend_info.PPShaders);
}
void VideoBackend::ShowConfig(void *_hParent)
{
#if defined(HAVE_WX) && HAVE_WX
InitBackendInfo();
VideoConfigDiag diag((wxWindow*)_hParent, "OpenGL", "gfx_opengl");
diag.ShowModal();
#endif
@ -162,9 +161,8 @@ bool VideoBackend::Initialize(void *&window_handle)
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_opengl.ini").c_str());
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
g_Config.UpdateProjectionHack();
g_Config.VerifyValidity();
UpdateActiveConfig();
if (!OpenGL_Create(window_handle))