diff --git a/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp b/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp index fb688c1e90..4f50fe4053 100644 --- a/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp +++ b/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp @@ -138,23 +138,30 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con const wxString af_choices[] = {wxT("1x"), wxT("2x"), wxT("4x"), wxT("8x"), wxT("16x")}; szr_enh->Add(new SettingChoice(page_general, vconfig.iMaxAnisotropy, 5, af_choices)); + + wxStaticText* const text_aamode = new wxStaticText(page_general, -1, wxT("Anti-Aliasing:")); + 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()) { - szr_enh->Add(new wxStaticText(page_general, -1, wxT("Anti-Aliasing:")), 1, wxALIGN_CENTER_VERTICAL, 0); - - SettingChoice *const choice_aamode = new SettingChoice(page_general, vconfig.iMultisampleMode); - std::vector::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())); - - choice_aamode->Select(vconfig.iMultisampleMode); - - szr_enh->Add(choice_aamode); } + 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)); szr_enh->Add(new SettingCheckBox(page_general, wxT("Pixel Lighting"), vconfig.bEnablePixelLigting)); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp b/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp index 802f093787..f693f4b48d 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/D3DBase.cpp @@ -161,11 +161,18 @@ void EnumAAModes(IDXGIAdapter* adapter, std::vector& aa_modes) { aa_modes.clear(); + // NOTE: D3D 10.0 doesn't support multisampled resources which are bound as depth buffers AND shader resources. + // Thus, we can't have MSAA with 10.0 level hardware. ID3D11Device* device; ID3D11DeviceContext* context; D3D_FEATURE_LEVEL feat_level; - HRESULT hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, NULL, 0, D3D11_SDK_VERSION, &device, &feat_level, &context); - if (FAILED(hr)) return; + 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) + { + SAFE_RELEASE(context); + SAFE_RELEASE(device); + return; + } for (int samples = 0; samples < D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples) { @@ -234,6 +241,11 @@ HRESULT Create(HWND wnd) // get supported AA modes aa_modes.clear(); EnumAAModes(adapter, aa_modes); + if (g_Config.iMultisampleMode >= aa_modes.size()) + { + g_Config.iMultisampleMode = 0; + UpdateActiveConfig(); + } DXGI_SWAP_CHAIN_DESC swap_chain_desc; memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));