From ee21237d6a562f2d9ab439427467443ce86f8379 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sun, 21 Nov 2010 14:47:28 +0000 Subject: [PATCH] Polish, fix and otherwise improve the video plugin configuration dialog: - Add some info about a backend's feature set (MSAA, Real XFB, EFB to RAM, ..) to VideoConfig - Gray out options if they aren't supported by the backend or if changing them doesn't affect anything (e.g. changing STC mode if STC is disabled) - Allow signed bytes for D3D11. Not sure if this causes glitches, but it should work - Call wxEvent.Skip() in the event function handlers, not sure if this fixes any bugs but the old code definitely caused bugs during development of this patch - Fix a memory leak in the configuration dialog if D3D11 is used - Other minor stuff that doesn't need to be mentioned or which I forgot git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6450 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/VideoCommon/Src/TextureCacheBase.cpp | 8 +- .../Core/VideoCommon/Src/TextureCacheBase.h | 2 - Source/Core/VideoCommon/Src/VertexLoader.cpp | 4 +- Source/Core/VideoCommon/Src/VideoCommon.h | 3 +- Source/Core/VideoCommon/Src/VideoConfig.cpp | 10 +- Source/Core/VideoCommon/Src/VideoConfig.h | 15 ++- .../VideoUICommon/Src/VideoConfigDiag.cpp | 106 ++++++++++++------ .../Core/VideoUICommon/Src/VideoConfigDiag.h | 76 +++++++++++-- .../Src/FramebufferManager.cpp | 2 +- .../Plugin_VideoDX11/Src/VertexManager.cpp | 10 +- Source/Plugins/Plugin_VideoDX11/Src/main.cpp | 20 +++- Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 18 +-- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 17 ++- 13 files changed, 207 insertions(+), 84 deletions(-) diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index f0a5f2d639..5cd164866d 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -162,7 +162,7 @@ void TextureCache::ClearRenderTargets() iter = textures.begin(), tcend = textures.end(); for (; iter!=tcend; ++iter) - iter->second->isRenderTarget = false; + iter->second->isRenderTarget = false; } TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, @@ -314,7 +314,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, if (pcfmt == PC_TEX_FMT_NONE) pcfmt = TexDecoder_Decode(temp, ptr, expandedWidth, - expandedHeight, texformat, tlutaddr, tlutfmt, !g_texture_cache->isOGL()); + expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures); isPow2 = !((width & (width - 1)) || (height & (height - 1))); texLevels = (isPow2 && UseNativeMips && maxlevel) ? @@ -376,7 +376,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, expandedWidth = (currentWidth + bsw) & (~bsw); expandedHeight = (currentHeight + bsh) & (~bsh); - TexDecoder_Decode(temp, ptr, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, !g_texture_cache->isOGL()); + TexDecoder_Decode(temp, ptr, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures); entry->Load(currentWidth, currentHeight, expandedWidth, level); ptr += ((std::max(mipWidth, bsw) * std::max(mipHeight, bsh) * bsdepth) >> 1); @@ -429,7 +429,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, { // TODO: these values differ slightly from the DX9/11 values, // do they need to? or can this be removed - if (g_texture_cache->isOGL()) + if (g_ActiveConfig.backend_info.APIType == API_OPENGL) { switch(copyfmt) { diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.h b/Source/Core/VideoCommon/Src/TextureCacheBase.h index d434bec5f6..8ba959342e 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.h +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.h @@ -97,8 +97,6 @@ private: typedef std::map TexCache; static TexCache textures; - - virtual bool isOGL() { return false; } // Hacks for TextureDecode_real support }; extern TextureCache *g_texture_cache; diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index 2f146da617..4cd2731759 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -291,7 +291,7 @@ void VertexLoader::CompileVertexTranslator() vtx_decl.num_normals = 0; if (m_VtxDesc.Normal != NOT_PRESENT) { m_VertexSize += VertexLoader_Normal::GetSize(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3); - TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3, g_Config.bAllowSignedBytes); + TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3, g_Config.backend_info.bAllowSignedBytes); if (pFunc == 0) { char temp[256]; @@ -310,7 +310,7 @@ void VertexLoader::CompileVertexTranslator() { vtx_decl.normal_gl_type = (vtx_attr.NormalFormat == FORMAT_BYTE)? VAR_BYTE : VAR_UNSIGNED_BYTE; int native_size = 4; - if (vtx_attr.NormalFormat == FORMAT_BYTE && !g_Config.bAllowSignedBytes) + if (vtx_attr.NormalFormat == FORMAT_BYTE && !g_Config.backend_info.bAllowSignedBytes) { vtx_decl.normal_gl_type = VAR_SHORT; native_size = 8; diff --git a/Source/Core/VideoCommon/Src/VideoCommon.h b/Source/Core/VideoCommon/Src/VideoCommon.h index f3737729f3..43cac32e74 100644 --- a/Source/Core/VideoCommon/Src/VideoCommon.h +++ b/Source/Core/VideoCommon/Src/VideoCommon.h @@ -153,7 +153,8 @@ typedef enum API_OPENGL, API_D3D9, API_D3D11, - API_GLSL + API_GLSL, + API_NONE } API_TYPE; #endif // _VIDEOCOMMON_H diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 494b765f74..bd4d522a73 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -34,11 +34,17 @@ void UpdateActiveConfig() VideoConfig::VideoConfig() { bRunning = false; - bAllowSignedBytes = !IsD3D(); - + // Needed for the first frame, I think fAspectRatioHackW = 1; fAspectRatioHackH = 1; + + // disable all features by default + backend_info.APIType = API_NONE; + backend_info.bAllowSignedBytes = false; + backend_info.bUseRGBATextures = false; + backend_info.bSupportsEFBToRAM = false; + backend_info.bSupportsRealXFB = false; } void VideoConfig::Load(const char *ini_file) diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 0bfa4bf755..0436102f57 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -28,6 +28,7 @@ #include "Common.h" #include "VideoCommon.h" +#include #include // Log in two categories, and save three other options in the same byte @@ -143,7 +144,19 @@ struct VideoConfig int iAdapter; // Static config per API - bool bAllowSignedBytes; + struct + { + API_TYPE APIType; + + std::vector Adapters; // for D3D9 and D3D11 + std::vector AAModes; + std::vector PPShaders; // post-processing shaders + + bool bUseRGBATextures; // used for D3D11 in TextureCache + bool bSupportsEFBToRAM; + bool bSupportsRealXFB; + bool bAllowSignedBytes; // D3D9 doesn't support signed bytes (?) + } backend_info; }; extern VideoConfig g_Config; diff --git a/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp b/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp index a8f4aff139..22a3ed9e09 100644 --- a/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp +++ b/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp @@ -7,9 +7,6 @@ template class BoolSetting; template class BoolSetting; -typedef BoolSetting SettingCheckBox; -typedef BoolSetting SettingRadioButton; - template <> SettingCheckBox::BoolSetting(wxWindow* parent, const wxString& label, bool &setting, bool reverse, long style) : wxCheckBox(parent, -1, label, wxDefaultPosition, wxDefaultSize, style) @@ -41,6 +38,7 @@ SettingChoice::SettingChoice(wxWindow* parent, int &setting, int num, const wxSt void SettingChoice::UpdateValue(wxCommandEvent& ev) { m_setting = ev.GetInt(); + ev.Skip(); } void VideoConfigDiag::CloseDiag(wxCommandEvent&) @@ -48,11 +46,7 @@ void VideoConfigDiag::CloseDiag(wxCommandEvent&) Close(); } -VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, - const std::vector &adapters, - const std::vector &aamodes, - const std::vector &ppshader - ) +VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title) : wxDialog(parent, -1, wxString(wxT("Dolphin ")).append(wxString::FromAscii(title.c_str())).append(wxT(" Graphics Configuration")), wxDefaultPosition, wxDefaultSize) @@ -82,17 +76,18 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, //wxChoice* const choice_gfxapi = new SettingChoice(page_general, // g_gfxapi, sizeof(gfxapi_choices)/sizeof(*gfxapi_choices), gfxapi_choices); //szr_basic->Add(choice_gfxapi, 1, 0, 0); + // TODO: Connect with Event_Backend() //} // adapter // for D3D only - if (adapters.size()) + if (g_Config.backend_info.Adapters.size()) { szr_basic->Add(new wxStaticText(page_general, -1, wxT("Adapter:")), 1, wxALIGN_CENTER_VERTICAL, 5); wxChoice* const choice_adapter = new SettingChoice(page_general, vconfig.iAdapter); std::vector::const_iterator - it = adapters.begin(), - itend = adapters.end(); + it = g_Config.backend_info.Adapters.begin(), + itend = g_Config.backend_info.Adapters.end(); for (; it != itend; ++it) choice_adapter->AppendString(wxString::FromAscii(it->c_str())); @@ -131,15 +126,15 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, 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), 0, wxBOTTOM | wxLEFT, 5); - if (aamodes.size()) + if (g_Config.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 = aamodes.begin(), - itend = aamodes.end(); + it = g_Config.backend_info.AAModes.begin(), + itend = g_Config.backend_info.AAModes.end(); for (; it != itend; ++it) choice_aamode->AppendString(wxString::FromAscii(it->c_str())); @@ -182,10 +177,25 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_general, wxT("Copy")); group_efb->Add(group_efbcopy, 0, wxEXPAND | wxBOTTOM, 5); - group_efbcopy->Add(new SettingCheckBox(page_general, wxT("Enable"), vconfig.bEFBCopyEnable), 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); + SettingCheckBox* efbcopy_enable = new SettingCheckBox(page_general, wxT("Enable"), vconfig.bEFBCopyEnable); + _connect_macro_(efbcopy_enable, VideoConfigDiag::Event_EfbCopy, wxEVT_COMMAND_CHECKBOX_CLICKED, this); + efbcopy_texture = new SettingRadioButton(page_general, wxT("Texture"), vconfig.bCopyEFBToTexture, false, wxRB_GROUP); + efbcopy_ram = new SettingRadioButton(page_general, wxT("RAM"), vconfig.bCopyEFBToTexture, true); + group_efbcopy->Add(efbcopy_enable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); group_efbcopy->AddStretchSpacer(1); - group_efbcopy->Add(new SettingRadioButton(page_general, wxT("Texture"), vconfig.bCopyEFBToTexture, false, wxRB_GROUP), 0, wxRIGHT, 5); - group_efbcopy->Add(new SettingRadioButton(page_general, wxT("RAM"), vconfig.bCopyEFBToTexture, true), 0, wxRIGHT, 5); + group_efbcopy->Add(efbcopy_texture, 0, wxRIGHT, 5); + group_efbcopy->Add(efbcopy_ram, 0, wxRIGHT, 5); + if (!g_Config.backend_info.bSupportsEFBToRAM) + { + efbcopy_ram->Disable(); + g_Config.bCopyEFBToTexture = true; + efbcopy_texture->SetValue(true); + } + if (!g_Config.bEFBCopyEnable) + { + efbcopy_ram->Disable(); + efbcopy_texture->Disable(); + } } // - safe texture cache @@ -193,28 +203,36 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, wxStaticBoxSizer* const group_safetex = new wxStaticBoxSizer(wxHORIZONTAL, page_general, wxT("Safe Texture Cache")); szr_general->Add(group_safetex, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); - // safe texture cache - group_safetex->Add(new SettingCheckBox(page_general, wxT("Enable"), vconfig.bSafeTextureCache), 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); + SettingCheckBox* stc_enable = new SettingCheckBox(page_general, wxT("Enable"), vconfig.bSafeTextureCache); + _connect_macro_(stc_enable, VideoConfigDiag::Event_Stc, wxEVT_COMMAND_CHECKBOX_CLICKED, this); + group_safetex->Add(stc_enable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); group_safetex->AddStretchSpacer(1); - wxRadioButton* stc_btn = new wxRadioButton(page_general, -1, wxT("Safe"), + stc_safe = new wxRadioButton(page_general, -1, wxT("Safe"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); - _connect_macro_(stc_btn, VideoConfigDiag::Event_StcSafe, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); - group_safetex->Add(stc_btn, 0, wxRIGHT, 5); + _connect_macro_(stc_safe, VideoConfigDiag::Event_StcSafe, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); + group_safetex->Add(stc_safe, 0, wxRIGHT, 5); if (0 == vconfig.iSafeTextureCache_ColorSamples) - stc_btn->SetValue(true); + stc_safe->SetValue(true); - stc_btn = new wxRadioButton(page_general, -1, wxT("Normal")); - _connect_macro_(stc_btn, VideoConfigDiag::Event_StcNormal, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); - group_safetex->Add(stc_btn, 0, wxRIGHT, 5); + stc_normal = new wxRadioButton(page_general, -1, wxT("Normal")); + _connect_macro_(stc_normal, VideoConfigDiag::Event_StcNormal, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); + group_safetex->Add(stc_normal, 0, wxRIGHT, 5); if (512 == vconfig.iSafeTextureCache_ColorSamples) - stc_btn->SetValue(true); + stc_normal->SetValue(true); - stc_btn = new wxRadioButton(page_general, -1, wxT("Fast")); - _connect_macro_(stc_btn, VideoConfigDiag::Event_StcFast, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); - group_safetex->Add(stc_btn, 0, wxRIGHT, 5); + stc_fast = new wxRadioButton(page_general, -1, wxT("Fast")); + _connect_macro_(stc_fast, VideoConfigDiag::Event_StcFast, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this); + group_safetex->Add(stc_fast, 0, wxRIGHT, 5); if (128 == vconfig.iSafeTextureCache_ColorSamples) - stc_btn->SetValue(true); + stc_fast->SetValue(true); + + if (!g_Config.bSafeTextureCache) + { + stc_safe->Disable(); + stc_normal->Disable(); + stc_fast->Disable(); + } } } @@ -261,10 +279,24 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, wxStaticBoxSizer* const group_xfb = new wxStaticBoxSizer(wxHORIZONTAL, page_advanced, wxT("XFB")); szr_advanced->Add(group_xfb, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); - group_xfb->Add(new SettingCheckBox(page_advanced, wxT("Enable"), vconfig.bUseXFB), 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); + SettingCheckBox* enable_xfb = new SettingCheckBox(page_advanced, wxT("Enable"), vconfig.bUseXFB); + _connect_macro_(enable_xfb, VideoConfigDiag::Event_Xfb, wxEVT_COMMAND_CHECKBOX_CLICKED, this); + virtual_xfb = new SettingRadioButton(page_advanced, wxT("Virtual"), vconfig.bUseRealXFB, true, wxRB_GROUP); + real_xfb = new SettingRadioButton(page_advanced, wxT("Real"), vconfig.bUseRealXFB); + group_xfb->Add(enable_xfb, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); group_xfb->AddStretchSpacer(1); - group_xfb->Add(new SettingRadioButton(page_advanced, wxT("Virtual"), vconfig.bUseRealXFB, true, wxRB_GROUP), 0, wxRIGHT, 5); - group_xfb->Add(new SettingRadioButton(page_advanced, wxT("Real"), vconfig.bUseRealXFB), 0, wxRIGHT, 5); + group_xfb->Add(virtual_xfb, 0, wxRIGHT, 5); + group_xfb->Add(real_xfb, 0, wxRIGHT, 5); + + if (!g_Config.backend_info.bSupportsRealXFB) + real_xfb->Disable(); + g_Config.bUseRealXFB = false; + virtual_xfb->SetValue(true); + } + if (!g_Config.bUseXFB) + { + real_xfb->Disable(); + virtual_xfb->Disable(); } // - utility @@ -294,7 +326,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, szr_misc->Add(new SettingCheckBox(page_advanced, wxT("Enable Hotkeys"), vconfig.bOSDHotKey)); // postproc shader - if (ppshader.size()) + if (g_Config.backend_info.PPShaders.size()) { szr_misc->Add(new wxStaticText(page_advanced, -1, wxT("Post-Processing Shader:")), 1, wxALIGN_CENTER_VERTICAL, 0); @@ -302,8 +334,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, choice_ppshader->AppendString(wxT("(off)")); std::vector::const_iterator - it = ppshader.begin(), - itend = ppshader.end(); + it = g_Config.backend_info.PPShaders.begin(), + itend = g_Config.backend_info.PPShaders.end(); for (; it != itend; ++it) choice_ppshader->AppendString(wxString::FromAscii(it->c_str())); diff --git a/Source/Core/VideoUICommon/Src/VideoConfigDiag.h b/Source/Core/VideoUICommon/Src/VideoConfigDiag.h index 2a5dbdf836..6a7d28df88 100644 --- a/Source/Core/VideoUICommon/Src/VideoConfigDiag.h +++ b/Source/Core/VideoUICommon/Src/VideoConfigDiag.h @@ -26,12 +26,16 @@ public: void UpdateValue(wxCommandEvent& ev) { m_setting = (ev.GetInt() != 0) ^ m_reverse; + ev.Skip(); } private: bool &m_setting; const bool m_reverse; }; +typedef BoolSetting SettingCheckBox; +typedef BoolSetting SettingRadioButton; + class SettingChoice : public wxChoice { public: @@ -44,17 +48,49 @@ private: class VideoConfigDiag : public wxDialog { public: - VideoConfigDiag(wxWindow* parent, const std::string &title, - const std::vector &adapters = std::vector(), - const std::vector &aamodes = std::vector(), - const std::vector &ppshader = std::vector()); + VideoConfigDiag(wxWindow* parent, const std::string &title); VideoConfig &vconfig; protected: - void Event_StcSafe(wxCommandEvent &) { vconfig.iSafeTextureCache_ColorSamples = 0; } - void Event_StcNormal(wxCommandEvent &) { vconfig.iSafeTextureCache_ColorSamples = 512; } - void Event_StcFast(wxCommandEvent &) { vconfig.iSafeTextureCache_ColorSamples = 128; } + void Event_Backend(wxCommandEvent &ev) { ev.Skip(); } // TODO + void Event_Adapter(wxCommandEvent &ev) { ev.Skip(); } // TODO + + void Event_EfbCopy(wxCommandEvent &ev) + { + if (ev.GetInt() == 0) + { + efbcopy_texture->Disable(); + efbcopy_ram->Disable(); + } + else + { + efbcopy_texture->Enable(); + if (vconfig.backend_info.bSupportsEFBToRAM) + efbcopy_ram->Enable(); + } + ev.Skip(); + } + + void Event_Stc(wxCommandEvent &ev) + { + if (ev.GetInt() == 0) + { + stc_safe->Disable(); + stc_normal->Disable(); + stc_fast->Disable(); + } + else + { + stc_safe->Enable(); + stc_normal->Enable(); + stc_fast->Enable(); + } + ev.Skip(); + } + void Event_StcSafe(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 0; ev.Skip(); } + void Event_StcNormal(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 512; ev.Skip(); } + void Event_StcFast(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 128; ev.Skip(); } void Event_PPShader(wxCommandEvent &ev) { @@ -63,9 +99,35 @@ protected: vconfig.sPostProcessingShader = ev.GetString().mb_str(); else vconfig.sPostProcessingShader.clear(); + ev.Skip(); + } + + void Event_Xfb(wxCommandEvent &ev) + { + if (ev.GetInt() == 0) + { + virtual_xfb->Disable(); + real_xfb->Disable(); + } + else + { + virtual_xfb->Enable(); + if(vconfig.backend_info.bSupportsRealXFB) real_xfb->Enable(); + } + ev.Skip(); } void CloseDiag(wxCommandEvent&); + + wxRadioButton* stc_safe; + wxRadioButton* stc_normal; + wxRadioButton* stc_fast; + + SettingRadioButton* efbcopy_texture; + SettingRadioButton* efbcopy_ram; + + SettingRadioButton* virtual_xfb; + SettingRadioButton* real_xfb; }; #endif diff --git a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp index 332c792d88..3d540fb571 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/FramebufferManager.cpp @@ -147,7 +147,7 @@ void XFBSource::CopyEFB() D3D::context->RSSetViewports(1, &vp); D3D::context->OMSetRenderTargets(1, &tex->GetRTV(), NULL); D3D::SetLinearCopySampler(); - + D3D::drawShadedTexQuad(FramebufferManager::GetEFBColorTexture()->GetSRV(), sourceRc.AsRECT(), Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(), PixelShaderCache::GetColorCopyProgram(), VertexShaderCache::GetSimpleVertexShader(), diff --git a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp index 6b8086f630..ff928fbf26 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp @@ -82,15 +82,7 @@ void VertexManager::DestroyDeviceObjects() SAFE_RELEASE(m_indexBuffer); } -VertexManager::VertexManager() : - m_indexBufferCursor(0), - m_vertexBufferCursor(0), - m_vertexDrawOffset(0), - m_triangleDrawIndex(0), - m_lineDrawIndex(0), - m_pointDrawIndex(0), - m_indexBuffer(NULL), - m_vertexBuffer(NULL) +VertexManager::VertexManager() { CreateDeviceObjects(); } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp index 6112daf069..5066a79ac3 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp @@ -152,8 +152,6 @@ void DllConfig(void *_hParent) { g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx11.ini").c_str()); - std::vector adapters; - IDXGIFactory* factory; IDXGIAdapter* ad; const HRESULT hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory); @@ -163,18 +161,30 @@ void DllConfig(void *_hParent) char tmpstr[512] = {}; DXGI_ADAPTER_DESC desc; - while (factory->EnumAdapters((UINT)adapters.size(), &ad) != DXGI_ERROR_NOT_FOUND) + while (factory->EnumAdapters((UINT)g_Config.backend_info.Adapters.size(), &ad) != DXGI_ERROR_NOT_FOUND) { ad->GetDesc(&desc); WideCharToMultiByte(/*CP_UTF8*/CP_ACP, 0, desc.Description, -1, tmpstr, 512, 0, false); - adapters.push_back(tmpstr); + g_Config.backend_info.Adapters.push_back(tmpstr); + ad->Release(); } - VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, "Direct3D11", adapters); + 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.bSupportsEFBToRAM = false; + g_Config.backend_info.bSupportsRealXFB = false; + g_Config.backend_info.bAllowSignedBytes = true; + +#if defined(HAVE_WX) && HAVE_WX + VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, "Direct3D11"); diag->ShowModal(); diag->Destroy(); +#endif + UpdateActiveConfig(); g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx11.ini").c_str()); + + factory->Release(); } void Initialize(void *init) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index b7fb41ffac..c04edf8866 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -161,29 +161,33 @@ void DllConfig(void *_hParent) if (!s_PluginInitialized) D3D::Init(); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); - UpdateActiveConfig(); -#if defined(HAVE_WX) && HAVE_WX + + g_Config.backend_info.APIType = API_D3D9; + g_Config.backend_info.bUseRGBATextures = false; + g_Config.backend_info.bSupportsEFBToRAM = true; + g_Config.backend_info.bSupportsRealXFB = true; + g_Config.backend_info.bAllowSignedBytes = false; // adapters - std::vector adapters; for (int i = 0; i < D3D::GetNumAdapters(); ++i) - adapters.push_back(D3D::GetAdapter(i).ident.Description); + g_Config.backend_info.Adapters.push_back(D3D::GetAdapter(i).ident.Description); // aamodes - std::vector aamodes; if (g_Config.iAdapter < D3D::GetNumAdapters()) { const D3D::Adapter &adapter = D3D::GetAdapter(g_Config.iAdapter); for (int i = 0; i < adapter.aa_levels.size(); ++i) - aamodes.push_back(adapter.aa_levels[i].name); + g_Config.backend_info.AAModes.push_back(adapter.aa_levels[i].name); } - VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, "Direct3D9", adapters, aamodes); +#if defined(HAVE_WX) && HAVE_WX + VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, "Direct3D9"); diag->ShowModal(); diag->Destroy(); #endif g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); + UpdateActiveConfig(); if (!s_PluginInitialized) D3D::Shutdown(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 9e6176d1fd..4e2aa6072b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -168,20 +168,25 @@ void DllConfig(void *_hParent) g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str()); g_Config.UpdateProjectionHack(); UpdateActiveConfig(); -#if defined(HAVE_WX) && HAVE_WX - std::vector adapters; std::string caamodes[] = {"None", "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA"}; - std::vector aamodes(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes)); + g_Config.backend_info.AAModes = std::vector(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes)); - std::vector shaders; - GetShaders(shaders); + GetShaders(g_Config.backend_info.PPShaders); - VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, "OpenGL", adapters, aamodes, shaders); + g_Config.backend_info.APIType = API_OPENGL; + g_Config.backend_info.bUseRGBATextures = false; + g_Config.backend_info.bSupportsEFBToRAM = true; + g_Config.backend_info.bSupportsRealXFB = true; + g_Config.backend_info.bAllowSignedBytes = true; + +#if defined(HAVE_WX) && HAVE_WX + VideoConfigDiag *const diag = new VideoConfigDiag((wxWindow*)_hParent, "OpenGL"); diag->ShowModal(); diag->Destroy(); #endif g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str()); + UpdateActiveConfig(); } void Initialize(void *init)