Game-specific video settings:

* Moved the config validity check to reflect the emulator enforced settings at the config dialog
* Removed some obsolete validity checks
* Corrected "EnablePixelLighting" typo in the ini files

Fixes issue 4277.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7374 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau 2011-03-19 00:50:34 +00:00
parent 8cacd4d2d7
commit 4079523346
9 changed files with 32 additions and 43 deletions

View File

@ -259,7 +259,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_enh->Add(native_mips = new SettingCheckBox(page_general, _("Load Native Mipmaps"), wxGetTranslation(native_mips_tooltip), vconfig.bUseNativeMips));
szr_enh->Add(efb_scaled_copy = new SettingCheckBox(page_general, _("EFB Scaled Copy"), wxGetTranslation(scaled_efb_copy_tooltip), vconfig.bCopyEFBScaled));
szr_enh->Add(pixel_lighting = new SettingCheckBox(page_general, _("Pixel Lighting"), wxGetTranslation(pixel_lighting_tooltip), vconfig.bEnablePixelLigting));
szr_enh->Add(pixel_lighting = new SettingCheckBox(page_general, _("Pixel Lighting"), wxGetTranslation(pixel_lighting_tooltip), vconfig.bEnablePixelLighting));
szr_enh->Add(pixel_depth = new SettingCheckBox(page_general, _("Pixel Depth"), wxGetTranslation(pixel_depth_tooltip), vconfig.bEnablePerPixelDepth));
szr_enh->Add(force_filtering = new SettingCheckBox(page_general, _("Force Bi/Trilinear Filtering"), wxGetTranslation(force_filtering_tooltip), vconfig.bForceFiltering));
@ -527,8 +527,8 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
// EFB copy
efbcopy_texture->Enable(vconfig.bEFBCopyEnable);
efbcopy_ram->Enable(vconfig.bEFBCopyEnable && vconfig.backend_info.bSupportsEFBToRAM);
cache_efb_copies->Enable(vconfig.bEFBCopyEnable && vconfig.backend_info.bSupportsEFBToRAM && !vconfig.bCopyEFBToTexture);
efbcopy_ram->Enable(vconfig.bEFBCopyEnable);
cache_efb_copies->Enable(vconfig.bEFBCopyEnable && !vconfig.bCopyEFBToTexture);
// EFB format change emulation
emulate_efb_format_changes->Enable(vconfig.backend_info.bSupportsFormatReinterpretation);
@ -540,7 +540,7 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
// XFB
virtual_xfb->Enable(vconfig.bUseXFB);
real_xfb->Enable(vconfig.bUseXFB && vconfig.backend_info.bSupportsRealXFB);
real_xfb->Enable(vconfig.bUseXFB);
// If emulation hasn't started, yet, always update g_Config.
// Otherwise only update it if we're editing the currently running game's profile
@ -562,6 +562,7 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
void VideoConfigDiag::SetUIValuesFromConfig()
{
if (choice_adapter) choice_adapter->SetSelection(vconfig.iAdapter);
vconfig.VerifyValidity();
choice_aspect->SetSelection(vconfig.iAspectRatio);
widescreen_hack->SetValue(vconfig.bWidescreenHack);
vsync->SetValue(vconfig.bVSync);
@ -571,7 +572,7 @@ void VideoConfigDiag::SetUIValuesFromConfig()
native_mips->SetValue(vconfig.bUseNativeMips);
efb_scaled_copy->SetValue(vconfig.bCopyEFBScaled);
pixel_lighting->SetValue(vconfig.bEnablePixelLigting);
pixel_lighting->SetValue(vconfig.bEnablePixelLighting);
pixel_depth->SetValue(vconfig.bEnablePerPixelDepth);
force_filtering->SetValue(vconfig.bForceFiltering);
_3d_vision->SetValue(vconfig.b3DVision);

View File

@ -64,7 +64,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode)
((u32)bpmem.fog.c_proj_fsel.proj << 3) |
((u32)enableZTexture << 4) | ((u32)bpmem.fogRange.Base.Enabled << 5);
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
for (int i = 0; i < 2; ++i) {
uid->values[3 + i] = xfregs.color[i].enablelighting ?
@ -75,7 +75,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode)
(u32)xfregs.alpha[i].matsource) << 15;
}
}
uid->values[4] |= (g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting) << 31;
uid->values[4] |= (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) << 31;
int hdr = 5;
u32 *pcurvalue = &uid->values[hdr];
@ -445,7 +445,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
WRITE(p, "uniform float4 "I_INDTEXMTX"[6] : register(c%d);\n", C_INDTEXMTX);
WRITE(p, "uniform float4 "I_FOG"[3] : register(c%d);\n", C_FOG);
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
WRITE(p,"typedef struct { float4 col; float4 cosatt; float4 distatt; float4 pos; float4 dir; } Light;\n");
WRITE(p,"typedef struct { Light lights[8]; } s_"I_PLIGHTS";\n");
@ -478,13 +478,13 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
for (int i = 0; i < numTexgen; ++i)
WRITE(p, ",\n in float3 uv%d : TEXCOORD%d", i, i);
WRITE(p, ",\n in float4 clipPos : TEXCOORD%d", numTexgen);
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
WRITE(p, ",\n in float4 Normal : TEXCOORD%d", numTexgen + 1);
}
else
{
// wpos is in w of first 4 texcoords
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
for (int i = 0; i < 8; ++i)
WRITE(p, ",\n in float4 uv%d : TEXCOORD%d", i, i);
@ -528,7 +528,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
" float2 wrappedcoord, tempcoord;\n"
" float4 cc0, cc1, cc2, cprev,crastemp,ckonsttemp;\n\n");
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
if (xfregs.numTexGen.numTexGens < 7)
{

View File

@ -257,7 +257,7 @@ void PixelShaderManager::SetConstants()
s_bFogRangeAdjustChanged = false;
}
if (g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting) // config check added because the code in here was crashing for me inside SetPSConstant4f
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) // config check added because the code in here was crashing for me inside SetPSConstant4f
{
if (nLightsChanged[0] >= 0)
{

View File

@ -45,7 +45,7 @@ void GetVertexShaderId(VERTEXSHADERUID *uid, u32 components)
(u32)xfregs.alpha[i].hex :
(u32)xfregs.alpha[i].matsource) << 15;
}
uid->values[2] |= (g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting) << 31;
uid->values[2] |= (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) << 31;
u32 *pcurvalue = &uid->values[3];
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) {
TexMtxInfo tinfo = xfregs.texMtxInfo[i];
@ -84,11 +84,11 @@ char* GenerateVSOutputStruct(char* p, u32 components, API_TYPE api_type)
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
WRITE(p, " float3 tex%d : TEXCOORD%d;\n", i, i);
WRITE(p, " float4 clipPos : TEXCOORD%d;\n", xfregs.numTexGen.numTexGens);
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
WRITE(p, " float4 Normal : TEXCOORD%d;\n", xfregs.numTexGen.numTexGens + 1);
} else {
// clip position is in w of first 4 texcoords
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
for (int i = 0; i < 8; ++i)
WRITE(p, " float4 tex%d : TEXCOORD%d;\n", i, i);
@ -183,8 +183,10 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
}
WRITE(p, " float4 rawpos : POSITION) {\n");
WRITE(p, "VS_OUTPUT o;\n");
// transforms
if (components & VB_HAS_POSMTXIDX) {
if (components & VB_HAS_POSMTXIDX)
{
if (api_type == API_D3D9)
{
WRITE(p, "int4 indices = D3DCOLORtoUBYTE4(blend_indices);\n");
@ -383,7 +385,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
WRITE(p, "o.tex3.w = o.pos.w;\n");
}
if(g_ActiveConfig.bEnablePixelLigting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
if (xfregs.numTexGen.numTexGens < 7) {
WRITE(p, "o.Normal = float4(_norm0.x,_norm0.y,_norm0.z,pos.z);\n");
@ -405,9 +407,12 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
//write the true depth value, if the game uses depth textures pixel shaders will override with the correct values
//if not early z culling will improve speed
if (is_d3d) {
if (is_d3d)
{
WRITE(p, "o.pos.z = "I_DEPTHPARAMS".x * o.pos.w + o.pos.z * "I_DEPTHPARAMS".y;\n");
} else {
}
else
{
// this results in a scale from -1..0 to -1..1 after perspective
// divide
WRITE(p, "o.pos.z = o.pos.w + o.pos.z * 2.0f;\n");

View File

@ -43,8 +43,6 @@ VideoConfig::VideoConfig()
backend_info.APIType = API_NONE;
backend_info.bAllowSignedBytes = false;
backend_info.bUseRGBATextures = false;
backend_info.bSupportsEFBToRAM = false;
backend_info.bSupportsRealXFB = false;
backend_info.bSupports3DVision = false;
}
@ -81,7 +79,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false);
iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200);
iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0);
iniFile.Get("Settings", "EnablePixelLigting", &bEnablePixelLigting, 0);
iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0);
iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, 0);
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
@ -122,9 +120,6 @@ void VideoConfig::Load(const char *ini_file)
bool bTmp;
iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true);
SetEnableAlert(bTmp);
VerifyValidity();
}
void VideoConfig::GameIniLoad(const char *ini_file)
@ -158,7 +153,7 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo);
iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation);
iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle);
iniFile.GetIfExists("Video_Settings", "EnablePixelLigting", &bEnablePixelLigting);
iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting);
iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth);
iniFile.GetIfExists("Video_Settings", "ShowShaderErrors", &bShowShaderErrors);
@ -217,20 +212,16 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.GetIfExists("Video", "UseNativeMips", &bUseNativeMips);
iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
iniFile.GetIfExists("Video", "DlistCachingEnable", &bDlistCachingEnable);
VerifyValidity();
}
void VideoConfig::VerifyValidity()
{
// TODO: Check iMaxAnisotropy value
if (iAdapter >= (int)backend_info.Adapters.size()) iAdapter = 0;
if (!backend_info.bSupportsEFBToRAM) bCopyEFBToTexture = true;
if (iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0;
if (iMultisampleMode < 0 || iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0;
if (!backend_info.bSupportsRealXFB) bUseRealXFB = false;
if (!backend_info.bSupports3DVision) b3DVision = false;
if (!backend_info.bSupportsFormatReinterpretation) bEFBEmulateFormatChanges = false;
if (!backend_info.bSupportsPixelLighting) bEnablePixelLigting = false;
if (!backend_info.bSupportsPixelLighting) bEnablePixelLighting = false;
}
void VideoConfig::Save(const char *ini_file)
@ -264,7 +255,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Settings", "AnaglyphStereo", bAnaglyphStereo);
iniFile.Set("Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
iniFile.Set("Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
iniFile.Set("Settings", "EnablePixelLigting", bEnablePixelLigting);
iniFile.Set("Settings", "EnablePixelLighting", bEnablePixelLighting);
iniFile.Set("Settings", "EnablePerPixelDepth", bEnablePerPixelDepth);
@ -343,7 +334,7 @@ void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini)
SET_IF_DIFFERS("Video_Settings", "AnaglyphStereo", bAnaglyphStereo);
SET_IF_DIFFERS("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
SET_IF_DIFFERS("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
SET_IF_DIFFERS("Video_Settings", "EnablePixelLigting", bEnablePixelLigting);
SET_IF_DIFFERS("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
SET_IF_DIFFERS("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth);
SET_IF_DIFFERS("Video_Settings", "ShowShaderErrors", bShowShaderErrors);

View File

@ -133,7 +133,7 @@ struct VideoConfig
std::string sPhackvalue[2];
float fAspectRatioHackW, fAspectRatioHackH;
bool bZTPSpeedHack; // The Legend of Zelda: Twilight Princess
bool bEnablePixelLigting;
bool bEnablePixelLighting;
bool bEnablePerPixelDepth;
int iLog; // CONF_ bits
@ -156,8 +156,6 @@ struct VideoConfig
std::vector<std::string> PPShaders; // post-processing shaders
bool bUseRGBATextures; // used for D3D11 in TextureCache
bool bSupportsEFBToRAM;
bool bSupportsRealXFB;
bool bSupports3DVision;
bool bAllowSignedBytes; // D3D9 doesn't support signed bytes (?)
bool bSupportsDualSourceBlend; // only supported by D3D11 and OpenGL

View File

@ -82,8 +82,6 @@ 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.bSupportsEFBToRAM = true;
g_Config.backend_info.bSupportsRealXFB = true;
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bAllowSignedBytes = true;
g_Config.backend_info.bSupportsDualSourceBlend = true;

View File

@ -90,8 +90,6 @@ void InitBackendInfo()
{
g_Config.backend_info.APIType = API_D3D9;
g_Config.backend_info.bUseRGBATextures = true;
g_Config.backend_info.bSupportsEFBToRAM = true;
g_Config.backend_info.bSupportsRealXFB = true;
g_Config.backend_info.bSupports3DVision = true;
g_Config.backend_info.bAllowSignedBytes = false;
g_Config.backend_info.bSupportsDualSourceBlend = false;

View File

@ -131,8 +131,6 @@ void InitBackendInfo()
{
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.bSupports3DVision = false;
g_Config.backend_info.bAllowSignedBytes = true;
g_Config.backend_info.bSupportsDualSourceBlend = false; // supported, but broken