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
This commit is contained in:
NeoBrainX 2010-11-21 14:47:28 +00:00
parent 86dc8d09fe
commit ee21237d6a
13 changed files with 207 additions and 84 deletions

View file

@ -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)
{

View file

@ -97,8 +97,6 @@ private:
typedef std::map<u32, TCacheEntryBase*> TexCache;
static TexCache textures;
virtual bool isOGL() { return false; } // Hacks for TextureDecode_real support
};
extern TextureCache *g_texture_cache;

View file

@ -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;

View file

@ -153,7 +153,8 @@ typedef enum
API_OPENGL,
API_D3D9,
API_D3D11,
API_GLSL
API_GLSL,
API_NONE
} API_TYPE;
#endif // _VIDEOCOMMON_H

View file

@ -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)

View file

@ -28,6 +28,7 @@
#include "Common.h"
#include "VideoCommon.h"
#include <vector>
#include <string>
// 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<std::string> Adapters; // for D3D9 and D3D11
std::vector<std::string> AAModes;
std::vector<std::string> 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;

View file

@ -7,9 +7,6 @@
template class BoolSetting<wxCheckBox>;
template class BoolSetting<wxRadioButton>;
typedef BoolSetting<wxCheckBox> SettingCheckBox;
typedef BoolSetting<wxRadioButton> 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<std::string> &adapters,
const std::vector<std::string> &aamodes,
const std::vector<std::string> &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<std::string>::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<std::string>::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<std::string>::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()));

View file

@ -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<wxCheckBox> SettingCheckBox;
typedef BoolSetting<wxRadioButton> 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<std::string> &adapters = std::vector<std::string>(),
const std::vector<std::string> &aamodes = std::vector<std::string>(),
const std::vector<std::string> &ppshader = std::vector<std::string>());
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

View file

@ -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();
}

View file

@ -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<std::string> 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)

View file

@ -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<std::string> 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<std::string> 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();

View file

@ -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<std::string> adapters;
std::string caamodes[] = {"None", "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA"};
std::vector<std::string> aamodes(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes));
g_Config.backend_info.AAModes = std::vector<std::string>(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes));
std::vector<std::string> 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)