DX11: Fix two crashes. One occured when trying to run a game with D3D 10.0 level hardware, the other one when closing a game when MSAA was disabled.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6494 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2010-11-28 17:25:19 +00:00
parent fb9387a38e
commit c540995193
3 changed files with 19 additions and 13 deletions

View File

@ -143,24 +143,21 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
SettingChoice* const choice_aamode = new SettingChoice(page_general, vconfig.iMultisampleMode);
if (vconfig.backend_info.AAModes.size())
std::vector<std::string>::const_iterator
it = vconfig.backend_info.AAModes.begin(),
itend = vconfig.backend_info.AAModes.end();
for (; it != itend; ++it)
choice_aamode->AppendString(wxString::FromAscii(it->c_str()));
if (vconfig.backend_info.AAModes.size() <= 1)
{
std::vector<std::string>::const_iterator
it = vconfig.backend_info.AAModes.begin(),
itend = vconfig.backend_info.AAModes.end();
for (; it != itend; ++it)
choice_aamode->AppendString(wxString::FromAscii(it->c_str()));
}
else
{
choice_aamode->AppendString(wxString::FromAscii("(not supported)"));
vconfig.iMultisampleMode = 0;
choice_aamode->Disable();
text_aamode->Disable();
}
choice_aamode->Select(vconfig.iMultisampleMode);
szr_enh->Add(choice_aamode);
szr_enh->Add(new SettingCheckBox(page_general, wxT("Load Native Mipmaps"), vconfig.bUseNativeMips));
szr_enh->Add(new SettingCheckBox(page_general, wxT("EFB Scaled Copy"), vconfig.bCopyEFBScaled));

View File

@ -169,6 +169,10 @@ void EnumAAModes(IDXGIAdapter* adapter, std::vector<DXGI_SAMPLE_DESC>& aa_modes)
HRESULT hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &feat_level, &context);
if (FAILED(hr) || feat_level == D3D_FEATURE_LEVEL_10_0)
{
DXGI_SAMPLE_DESC desc;
desc.Count = 1;
desc.Quality = 0;
aa_modes.push_back(desc);
SAFE_RELEASE(context);
SAFE_RELEASE(device);
return;
@ -241,7 +245,7 @@ HRESULT Create(HWND wnd)
// get supported AA modes
aa_modes.clear();
EnumAAModes(adapter, aa_modes);
if (g_Config.iMultisampleMode >= aa_modes.size())
if (g_Config.iMultisampleMode >= (int)aa_modes.size())
{
g_Config.iMultisampleMode = 0;
UpdateActiveConfig();

View File

@ -126,6 +126,11 @@ FramebufferManager::FramebufferManager()
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.resolved_depth_tex->GetTex(), "EFB depth resolve texture");
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.resolved_depth_tex->GetSRV(), "EFB depth resolve texture shader resource view");
}
else
{
m_efb.resolved_color_tex = NULL;
m_efb.resolved_depth_tex = NULL;
}
}
FramebufferManager::~FramebufferManager()