diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-09-23 00:47:57 -0500 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-09-23 00:47:57 -0500 |
| commit | bab91494d53f15d804834ba5d11730b0e855ebd8 (patch) | |
| tree | a86cd67ea34aa3497955dceb501794275e4e7f04 /Source/Core/VideoCommon | |
| parent | d84312c799816e8835e6bed562f216bf19725761 (diff) | |
| parent | 1da6469c62fa1b4fd669a48cb583e161d5cb2713 (diff) | |
Merge branch 'master' into android-core-control
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/BPStructs.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/DriverDetails.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/DriverDetails.h | 16 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/LightingShaderGen.h | 24 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 41 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.h | 1 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/ShaderGenCommon.h | 31 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/TextureConversionShader.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoader.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexShaderGen.h | 1 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VideoConfig.cpp | 170 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VideoConfig.h | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/x64DLCache.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/x64TextureDecoder.cpp | 6 |
15 files changed, 148 insertions, 169 deletions
diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 00cecf0082..9f885e7953 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -200,19 +200,19 @@ void BPWritten(const BPCmd& bp) bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode); // Set LogicOp Blending Mode - if (bp.changes & 2) + if (bp.changes & 0xF002) // logicopenable | logicmode SetLogicOpMode(); // Set Dithering Mode - if (bp.changes & 4) + if (bp.changes & 4) // dither SetDitherMode(); // Set Blending Mode - if (bp.changes & 0xFF1) + if (bp.changes & 0xFF1) // blendenable | alphaupdate | dstfactor | srcfactor | subtract SetBlendMode(); // Set Color Mask - if (bp.changes & 0x18) + if (bp.changes & 0x18) // colorupdate | alphaupdate SetColorMask(); } break; diff --git a/Source/Core/VideoCommon/Src/DriverDetails.cpp b/Source/Core/VideoCommon/Src/DriverDetails.cpp index cdecc71cd1..779edf91e8 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.cpp +++ b/Source/Core/VideoCommon/Src/DriverDetails.cpp @@ -30,6 +30,8 @@ namespace DriverDetails {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_NODYNUBOACCESS, 14.0, -1.0, true}, {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENCENTROID, 14.0, -1.0, true}, {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENINFOLOG, -1.0, -1.0, true}, + {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_ANNIHILATEDUBOS, 41.0, 46.0, true}, + {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENSWAP, -1.0, -1.0, true}, {VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENUBO, 900, 916, true}, {VENDOR_MESA, DRIVER_R600, BUG_BROKENUBO, 900, 913, true}, {VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true}, diff --git a/Source/Core/VideoCommon/Src/DriverDetails.h b/Source/Core/VideoCommon/Src/DriverDetails.h index dc0d2900eb..a9a9b40f54 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.h +++ b/Source/Core/VideoCommon/Src/DriverDetails.h @@ -99,6 +99,22 @@ namespace DriverDetails // to be broken. We just get flickering/black rendering when using pinned memory here -- degasus - 2013/08/20 // Please see issue #6105 on google code. Let's hope buffer storage solves this issues. BUG_BROKENPINNEDMEMORY, + // Bug: Entirely broken UBOs + // Affected devices: Qualcomm/Adreno + // Started Version: ? (Noticed on v45) + // Ended Version: -1 + // Uniform buffers are entirely broken on Qualcomm drivers with v45 + // Trying to use the uniform buffers causes a malloc to fail inside the driver + // To be safe, blanket drivers from v41 - v45 + BUG_ANNIHILATEDUBOS, + // Bug : Can't draw on screen text and clear correctly. + // Affected devices: Qualcomm/Adreno + // Started Version: ? + // Ended Version: ? + // Current code for drawing on screen text and clearing the framebuffer doesn't work on Adreno + // Drawing on screen text causes the whole screen to swizzle in a terrible fashion + // Clearing the framebuffer causes one to never see a frame. + BUG_BROKENSWAP, }; // Initializes our internal vendor, device family, and driver version diff --git a/Source/Core/VideoCommon/Src/LightingShaderGen.h b/Source/Core/VideoCommon/Src/LightingShaderGen.h index fc107a2e2b..17dd0a6273 100644 --- a/Source/Core/VideoCommon/Src/LightingShaderGen.h +++ b/Source/Core/VideoCommon/Src/LightingShaderGen.h @@ -25,6 +25,19 @@ #define LIGHT_DIR "%s[5*%d+4]" #define LIGHT_DIR_PARAMS(lightsName, index) (lightsName), (index) +/** + * Common uid data used for shader generators that use lighting calculations. + */ +struct LightingUidData +{ + u32 matsource : 4; // 4x1 bit + u32 enablelighting : 4; // 4x1 bit + u32 ambsource : 4; // 4x1 bit + u32 diffusefunc : 8; // 4x2 bits + u32 attnfunc : 8; // 4x2 bits + u32 light_mask : 32; // 4x8 bits +}; + template<class T> static void GenerateLightShader(T& object, LightingUidData& uid_data, int index, int litchan_index, const char* lightsName, int coloralpha) @@ -65,15 +78,18 @@ static void GenerateLightShader(T& object, LightingUidData& uid_data, int index, "ldir = ldir / dist;\n" "attn = max(0.0f, dot(ldir, " LIGHT_DIR".xyz));\n", LIGHT_DIR_PARAMS(lightsName, index)); - object.Write("attn = max(0.0f, dot(" LIGHT_COSATT".xyz, float3(1.0f, attn, attn*attn))) / dot(" LIGHT_DISTATT".xyz, float3(1.0f,dist,dist2));\n", - LIGHT_COSATT_PARAMS(lightsName, index), LIGHT_DISTATT_PARAMS(lightsName, index)); + // attn*attn may overflow + object.Write("attn = max(0.0f, " LIGHT_COSATT".x + " LIGHT_COSATT".y*attn + " LIGHT_COSATT".z*attn*attn) / dot(" LIGHT_DISTATT".xyz, float3(1.0f,dist,dist2));\n", + LIGHT_COSATT_PARAMS(lightsName, index), LIGHT_COSATT_PARAMS(lightsName, index), LIGHT_COSATT_PARAMS(lightsName, index), LIGHT_DISTATT_PARAMS(lightsName, index)); } else if (chan.attnfunc == 1) { // specular object.Write("ldir = normalize(" LIGHT_POS".xyz);\n", LIGHT_POS_PARAMS(lightsName, index)); object.Write("attn = (dot(_norm0,ldir) >= 0.0f) ? max(0.0f, dot(_norm0, " LIGHT_DIR".xyz)) : 0.0f;\n", LIGHT_DIR_PARAMS(lightsName, index)); - object.Write("attn = max(0.0f, dot(" LIGHT_COSATT".xyz, float3(1,attn,attn*attn))) / dot(" LIGHT_DISTATT".xyz, float3(1,attn,attn*attn));\n", - LIGHT_COSATT_PARAMS(lightsName, index), LIGHT_DISTATT_PARAMS(lightsName, index)); + // attn*attn may overflow + object.Write("attn = max(0.0f, " LIGHT_COSATT".x + " LIGHT_COSATT".y*attn + " LIGHT_COSATT".z*attn*attn) / (" LIGHT_DISTATT".x + " LIGHT_DISTATT".y*attn + " LIGHT_DISTATT".z*attn*attn);\n", + LIGHT_COSATT_PARAMS(lightsName, index), LIGHT_COSATT_PARAMS(lightsName, index), LIGHT_COSATT_PARAMS(lightsName, index), + LIGHT_DISTATT_PARAMS(lightsName, index), LIGHT_DISTATT_PARAMS(lightsName, index), LIGHT_DISTATT_PARAMS(lightsName, index)); } switch (chan.diffusefunc) diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp index a9c6977d42..211244c457 100644 --- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp @@ -5,6 +5,7 @@ #include "OCLTextureDecoder.h" #include "../OpenCL.h" +#include "CommonPaths.h" #include "FileUtil.h" #include <fcntl.h> @@ -138,7 +139,7 @@ void TexDecoder_OpenCL_Initialize() if (err) { std::string code; - filename = File::GetUserPath(D_OPENCL_IDX) + "TextureDecoder.cl"; + filename = File::GetSysDirectory() + OPENCL_DIR DIR_SEP "TextureDecoder.cl"; if (!File::ReadFileToString(true, filename.c_str(), code)) { ERROR_LOG(VIDEO, "Failed to load OpenCL code %s - file is missing?", filename.c_str()); diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index b4ad513d37..03d1677b2c 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -212,24 +212,9 @@ struct RegisterState bool AuxStored; }; -static char swapModeTable[4][5]; - static char text[16384]; -static inline void BuildSwapModeTable() -{ - static const char *swapColors = "rgba"; - for (int i = 0; i < 4; i++) - { - swapModeTable[i][0] = swapColors[bpmem.tevksel[i*2].swap1]; - swapModeTable[i][1] = swapColors[bpmem.tevksel[i*2].swap2]; - swapModeTable[i][2] = swapColors[bpmem.tevksel[i*2+1].swap1]; - swapModeTable[i][3] = swapColors[bpmem.tevksel[i*2+1].swap2]; - swapModeTable[i][4] = '\0'; - } -} - -template<class T> static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE ApiType, RegisterState RegisterStates[4]); +template<class T> static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE ApiType, RegisterState RegisterStates[4], const char swapModeTable[4][5]); template<class T> static inline void SampleTexture(T& out, const char *texcoords, const char *texswap, int texmap, API_TYPE ApiType); template<class T> static inline void WriteAlphaTest(T& out, pixel_shader_uid_data& uid_data, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode, bool per_pixel_depth); template<class T> static inline void WriteFog(T& out, pixel_shader_uid_data& uid_data); @@ -324,9 +309,9 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T if (ApiType == API_OPENGL) { - out.Write("COLOROUT(ocol0)\n"); + out.Write("out vec4 ocol0;\n"); if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND) - out.Write("COLOROUT(ocol1)\n"); + out.Write("out vec4 ocol1;\n"); if (per_pixel_depth) out.Write("#define depth gl_FragDepth\n"); @@ -595,9 +580,19 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T } // Uid fields for BuildSwapModeTable are set in WriteStage - BuildSwapModeTable(); + char swapModeTable[4][5]; + const char* swapColors = "rgba"; + for (int i = 0; i < 4; i++) + { + swapModeTable[i][0] = swapColors[bpmem.tevksel[i*2].swap1]; + swapModeTable[i][1] = swapColors[bpmem.tevksel[i*2].swap2]; + swapModeTable[i][2] = swapColors[bpmem.tevksel[i*2+1].swap1]; + swapModeTable[i][3] = swapColors[bpmem.tevksel[i*2+1].swap2]; + swapModeTable[i][4] = '\0'; + } + for (unsigned int i = 0; i < numStages; i++) - WriteStage<T>(out, uid_data, i, ApiType, RegisterStates); // build the equation for this stage + WriteStage<T>(out, uid_data, i, ApiType, RegisterStates, swapModeTable); // build the equation for this stage #define MY_STRUCT_OFFSET(str,elem) ((u32)((u64)&(str).elem-(u64)&(str))) bool enable_pl = g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting; @@ -767,7 +762,7 @@ static const char *TEVCMPAlphaOPTable[16] = }; template<class T> -static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE ApiType, RegisterState RegisterStates[4]) +static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE ApiType, RegisterState RegisterStates[4], const char swapModeTable[4][5]) { int texcoord = bpmem.tevorders[n/2].getTexCoord(n&1); bool bHasTexCoord = (u32)texcoord < bpmem.genMode.numtexgens; @@ -881,7 +876,7 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP uid_data.stagehash[n].tevksel_swap2b = bpmem.tevksel[i*2+1].swap2; uid_data.stagehash[n].tevorders_colorchan = bpmem.tevorders[n / 2].getColorChan(n & 1); - char *rasswap = swapModeTable[bpmem.combiners[n].alphaC.rswap]; + const char *rasswap = swapModeTable[bpmem.combiners[n].alphaC.rswap]; out.Write("rastemp = %s.%s;\n", tevRasTable[bpmem.tevorders[n / 2].getColorChan(n & 1)], rasswap); out.Write("crastemp = frac(rastemp * (255.0f/256.0f)) * (256.0f/255.0f);\n"); } @@ -907,7 +902,7 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP uid_data.stagehash[n].tevorders_texmap= bpmem.tevorders[n/2].getTexMap(n&1); - char *texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap]; + const char *texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap]; int texmap = bpmem.tevorders[n/2].getTexMap(n&1); uid_data.SetTevindrefTexmap(i, texmap); diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.h b/Source/Core/VideoCommon/Src/PixelShaderGen.h index 7763cbd574..5fbf28cd69 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.h +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.h @@ -8,6 +8,7 @@ #include "VideoCommon.h" #include "ShaderGenCommon.h" #include "BPMemory.h" +#include "LightingShaderGen.h" #define I_COLORS "color" #define I_KCOLORS "k" diff --git a/Source/Core/VideoCommon/Src/ShaderGenCommon.h b/Source/Core/VideoCommon/Src/ShaderGenCommon.h index a804c08f13..31ec8d3e71 100644 --- a/Source/Core/VideoCommon/Src/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/Src/ShaderGenCommon.h @@ -88,26 +88,18 @@ public: bool operator == (const ShaderUid& obj) const { - return memcmp(this->values, obj.values, sizeof(values)) == 0; + return memcmp(this->values, obj.values, data.NumValues() * sizeof(*values)) == 0; } bool operator != (const ShaderUid& obj) const { - return memcmp(this->values, obj.values, sizeof(values)) != 0; + return memcmp(this->values, obj.values, data.NumValues() * sizeof(*values)) != 0; } // determines the storage order inside STL containers bool operator < (const ShaderUid& obj) const { - // TODO: Store last frame used and order by that? makes much more sense anyway... - for (unsigned int i = 0; i < data.NumValues(); ++i) - { - if (this->values[i] < obj.values[i]) - return true; - else if (this->values[i] > obj.values[i]) - return false; - } - return false; + return memcmp(this->values, obj.values, data.NumValues() * sizeof(*values)) < 0; } template<class T> @@ -199,23 +191,6 @@ static inline void DeclareUniform(T& object, API_TYPE api_type, bool using_ubos, object.Write(";\n"); } -#pragma pack(1) -/** - * Common uid data used for shader generators that use lighting calculations. - */ -struct LightingUidData -{ - u32 matsource : 4; // 4x1 bit - u32 enablelighting : 4; // 4x1 bit - u32 ambsource : 4; // 4x1 bit - u32 diffusefunc : 8; // 4x2 bits - u32 attnfunc : 8; // 4x2 bits - u32 light_mask : 32; // 4x8 bits - - u32 NumValues() const { return sizeof(LightingUidData); } -}; -#pragma pack() - /** * Checks if there has been */ diff --git a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp index de5198c9fe..bf2f2737ea 100644 --- a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp @@ -96,7 +96,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) if (ApiType == API_OPENGL) { - WRITE(p, " COLOROUT(ocol0)\n"); + WRITE(p, " out vec4 ocol0;\n"); WRITE(p, " VARYIN float2 uv0;\n"); WRITE(p, "void main()\n"); } diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index babaff83a5..825e9c6558 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -217,7 +217,7 @@ void VertexLoader::CompileVertexTranslator() PanicAlert("Trying to recompile a vertex translator"); m_compiledCode = GetCodePtr(); - ABI_EmitPrologue(4); + ABI_PushAllCalleeSavedRegsAndAdjustStack(); // Start loop here const u8 *loop_start = GetCodePtr(); @@ -499,7 +499,8 @@ void VertexLoader::CompileVertexTranslator() #endif J_CC(CC_NZ, loop_start, true); - ABI_EmitEpilogue(4); + ABI_PopAllCalleeSavedRegsAndAdjustStack(); + RET(); #endif m_NativeFmt->Initialize(vtx_decl); } diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.h b/Source/Core/VideoCommon/Src/VertexShaderGen.h index ab9a378107..0ec703c07f 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.h +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.h @@ -9,6 +9,7 @@ #include "XFMemory.h" #include "VideoCommon.h" #include "ShaderGenCommon.h" +#include "LightingShaderGen.h" // TODO should be reordered #define SHADER_POSITION_ATTRIB 0 diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 707aec734c..e81807985a 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -120,30 +120,45 @@ void VideoConfig::Load(const char *ini_file) OSD::AddMessage("Warning: Shader Debugging is enabled, performance will suffer heavily", 15000); } -void VideoConfig::GameIniLoad(const char *ini_file) +void VideoConfig::GameIniLoad(const char* default_ini_file, const char* local_ini_file) { - IniFile iniFile; - iniFile.Load(ini_file); + bool gfx_override_exists = false; + + // XXX: Again, bad place to put OSD messages at (see delroth's comment above) + // XXX: This will add an OSD message for each projection hack value... meh +#define CHECK_SETTING(section, key, var) do { \ + decltype(var) temp = var; \ + if (iniFile.GetIfExists(section, key, &var) && var != temp) { \ + char buf[256]; \ + snprintf(buf, sizeof(buf), "Note: Option \"%s\" is overridden by game ini.", key); \ + OSD::AddMessage(buf, 7500); \ + gfx_override_exists = true; \ + } \ + } while (0) - iniFile.GetIfExists("Video_Hardware", "VSync", &bVSync); - - iniFile.GetIfExists("Video_Settings", "wideScreenHack", &bWidescreenHack); - iniFile.GetIfExists("Video_Settings", "AspectRatio", &iAspectRatio); - iniFile.GetIfExists("Video_Settings", "Crop", &bCrop); - iniFile.GetIfExists("Video_Settings", "UseXFB", &bUseXFB); - iniFile.GetIfExists("Video_Settings", "UseRealXFB", &bUseRealXFB); - iniFile.GetIfExists("Video_Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples); - iniFile.GetIfExists("Video_Settings", "DLOptimize", &iCompileDLsLevel); - iniFile.GetIfExists("Video_Settings", "HiresTextures", &bHiresTextures); - iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo); - iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation); - iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle); - iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting); - iniFile.GetIfExists("Video_Settings", "HackedBufferUpload", &bHackedBufferUpload); - iniFile.GetIfExists("Video_Settings", "FastDepthCalc", &bFastDepthCalc); - iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode); + IniFile iniFile; + iniFile.Load(default_ini_file); + iniFile.Load(local_ini_file, true); + + CHECK_SETTING("Video_Hardware", "VSync", bVSync); + + CHECK_SETTING("Video_Settings", "wideScreenHack", bWidescreenHack); + CHECK_SETTING("Video_Settings", "AspectRatio", iAspectRatio); + CHECK_SETTING("Video_Settings", "Crop", bCrop); + CHECK_SETTING("Video_Settings", "UseXFB", bUseXFB); + CHECK_SETTING("Video_Settings", "UseRealXFB", bUseRealXFB); + CHECK_SETTING("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); + CHECK_SETTING("Video_Settings", "DLOptimize", iCompileDLsLevel); + CHECK_SETTING("Video_Settings", "HiresTextures", bHiresTextures); + CHECK_SETTING("Video_Settings", "AnaglyphStereo", bAnaglyphStereo); + CHECK_SETTING("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); + CHECK_SETTING("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); + CHECK_SETTING("Video_Settings", "EnablePixelLighting", bEnablePixelLighting); + CHECK_SETTING("Video_Settings", "HackedBufferUpload", bHackedBufferUpload); + CHECK_SETTING("Video_Settings", "FastDepthCalc", bFastDepthCalc); + CHECK_SETTING("Video_Settings", "MSAA", iMultisampleMode); int tmp = -9000; - iniFile.GetIfExists("Video_Settings", "EFBScale", &tmp); // integral + CHECK_SETTING("Video_Settings", "EFBScale", tmp); // integral if (tmp != -9000) { if (tmp != SCALE_FORCE_INTEGRAL) @@ -169,33 +184,36 @@ void VideoConfig::GameIniLoad(const char *ini_file) } } - iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass); - iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog); - iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL); - iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder); - - iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering); - iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x) - iniFile.GetIfExists("Video_Enhancements", "PostProcessingShader", &sPostProcessingShader); - iniFile.GetIfExists("Video_Enhancements", "Enable3dVision", &b3DVision); - - iniFile.GetIfExists("Video_Hacks", "EFBAccessEnable", &bEFBAccessEnable); - iniFile.GetIfExists("Video_Hacks", "DlistCachingEnable", &bDlistCachingEnable); - iniFile.GetIfExists("Video_Hacks", "EFBCopyEnable", &bEFBCopyEnable); - iniFile.GetIfExists("Video_Hacks", "EFBToTextureEnable", &bCopyEFBToTexture); - iniFile.GetIfExists("Video_Hacks", "EFBScaledCopy", &bCopyEFBScaled); - iniFile.GetIfExists("Video_Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable); - iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges); - - iniFile.GetIfExists("Video", "ProjectionHack", &iPhackvalue[0]); - iniFile.GetIfExists("Video", "PH_SZNear", &iPhackvalue[1]); - iniFile.GetIfExists("Video", "PH_SZFar", &iPhackvalue[2]); - iniFile.GetIfExists("Video", "PH_ExtraParam", &iPhackvalue[3]); - iniFile.GetIfExists("Video", "PH_ZNear", &sPhackvalue[0]); - iniFile.GetIfExists("Video", "PH_ZFar", &sPhackvalue[1]); - iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack); - iniFile.GetIfExists("Video", "UseBBox", &bUseBBox); - iniFile.GetIfExists("Video", "PerfQueriesEnable", &bPerfQueriesEnable); + CHECK_SETTING("Video_Settings", "DstAlphaPass", bDstAlphaPass); + CHECK_SETTING("Video_Settings", "DisableFog", bDisableFog); + CHECK_SETTING("Video_Settings", "EnableOpenCL", bEnableOpenCL); + CHECK_SETTING("Video_Settings", "OMPDecoder", bOMPDecoder); + + CHECK_SETTING("Video_Enhancements", "ForceFiltering", bForceFiltering); + CHECK_SETTING("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x) + CHECK_SETTING("Video_Enhancements", "PostProcessingShader", sPostProcessingShader); + CHECK_SETTING("Video_Enhancements", "Enable3dVision", b3DVision); + + CHECK_SETTING("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable); + CHECK_SETTING("Video_Hacks", "DlistCachingEnable", bDlistCachingEnable); + CHECK_SETTING("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable); + CHECK_SETTING("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture); + CHECK_SETTING("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled); + CHECK_SETTING("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); + CHECK_SETTING("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); + + CHECK_SETTING("Video", "ProjectionHack", iPhackvalue[0]); + CHECK_SETTING("Video", "PH_SZNear", iPhackvalue[1]); + CHECK_SETTING("Video", "PH_SZFar", iPhackvalue[2]); + CHECK_SETTING("Video", "PH_ExtraParam", iPhackvalue[3]); + CHECK_SETTING("Video", "PH_ZNear", sPhackvalue[0]); + CHECK_SETTING("Video", "PH_ZFar", sPhackvalue[1]); + CHECK_SETTING("Video", "ZTPSpeedupHack", bZTPSpeedHack); + CHECK_SETTING("Video", "UseBBox", bUseBBox); + CHECK_SETTING("Video", "PerfQueriesEnable", bPerfQueriesEnable); + + if (gfx_override_exists) + OSD::AddMessage("Warning: Opening the graphics configuration will reset settings and might cause issues!", 10000); } void VideoConfig::VerifyValidity() @@ -262,7 +280,7 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable); iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable); iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable); - iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture); + iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture); iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled); iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); @@ -273,60 +291,6 @@ void VideoConfig::Save(const char *ini_file) iniFile.Save(ini_file); } -void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini) -{ - // wxWidgets doesn't provide us with a nice way to change 3-state checkboxes into 2-state ones - // This would allow us to make the "default config" dialog layout to be 2-state based, but the - // "game config" layout to be 3-state based (with the 3rd state being "use default") - // Since we can't do that, we instead just save anything which differs from the default config - // TODO: Make this less ugly - - VideoConfig defCfg; - defCfg.Load(default_ini); - - IniFile iniFile; - iniFile.Load(game_ini); - - #define SET_IF_DIFFERS(section, key, member) { if ((member) != (defCfg.member)) iniFile.Set((section), (key), (member)); else iniFile.DeleteKey((section), (key)); } - - SET_IF_DIFFERS("Video_Hardware", "VSync", bVSync); - - SET_IF_DIFFERS("Video_Settings", "wideScreenHack", bWidescreenHack); - SET_IF_DIFFERS("Video_Settings", "AspectRatio", iAspectRatio); - SET_IF_DIFFERS("Video_Settings", "Crop", bCrop); - SET_IF_DIFFERS("Video_Settings", "UseXFB", bUseXFB); - SET_IF_DIFFERS("Video_Settings", "UseRealXFB", bUseRealXFB); - SET_IF_DIFFERS("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); - SET_IF_DIFFERS("Video_Settings", "DLOptimize", iCompileDLsLevel); - SET_IF_DIFFERS("Video_Settings", "HiresTextures", bHiresTextures); - 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", "EnablePixelLighting", bEnablePixelLighting); - SET_IF_DIFFERS("Video_Settings", "FastDepthCalc", bFastDepthCalc); - SET_IF_DIFFERS("Video_Settings", "MSAA", iMultisampleMode); - SET_IF_DIFFERS("Video_Settings", "EFBScale", iEFBScale); // integral - SET_IF_DIFFERS("Video_Settings", "DstAlphaPass", bDstAlphaPass); - SET_IF_DIFFERS("Video_Settings", "DisableFog", bDisableFog); - SET_IF_DIFFERS("Video_Settings", "EnableOpenCL", bEnableOpenCL); - SET_IF_DIFFERS("Video_Settings", "OMPDecoder", bOMPDecoder); - - SET_IF_DIFFERS("Video_Enhancements", "ForceFiltering", bForceFiltering); - SET_IF_DIFFERS("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x) - SET_IF_DIFFERS("Video_Enhancements", "PostProcessingShader", sPostProcessingShader); - SET_IF_DIFFERS("Video_Enhancements", "Enable3dVision", b3DVision); - - SET_IF_DIFFERS("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable); - SET_IF_DIFFERS("Video_Hacks", "DlistCachingEnable", bDlistCachingEnable); - SET_IF_DIFFERS("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable); - SET_IF_DIFFERS("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture); - SET_IF_DIFFERS("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled); - SET_IF_DIFFERS("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable); - SET_IF_DIFFERS("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges); - - iniFile.Save(game_ini); -} - bool VideoConfig::IsVSync() { return Core::isTabPressed ? false : bVSync; diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 4a773d30e7..cfb4a1ccde 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -50,7 +50,7 @@ struct VideoConfig { VideoConfig(); void Load(const char *ini_file); - void GameIniLoad(const char *ini_file); + void GameIniLoad(const char* default_ini, const char* game_ini); void VerifyValidity(); void Save(const char *ini_file); void GameIniSave(const char* default_ini, const char* game_ini); diff --git a/Source/Core/VideoCommon/Src/x64DLCache.cpp b/Source/Core/VideoCommon/Src/x64DLCache.cpp index ae32ea5ea9..b412c2e274 100644 --- a/Source/Core/VideoCommon/Src/x64DLCache.cpp +++ b/Source/Core/VideoCommon/Src/x64DLCache.cpp @@ -409,7 +409,7 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl) emitter.AlignCode4(); dl->compiled_code = emitter.GetCodePtr(); - emitter.ABI_EmitPrologue(4); + emitter.ABI_PushAllCalleeSavedRegsAndAdjustStack(); while (g_pVideoData < end) { @@ -572,7 +572,8 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl) break; } } - emitter.ABI_EmitEpilogue(4); + emitter.ABI_PopAllCalleeSavedRegsAndAdjustStack(); + emitter.RET(); INCSTAT(stats.numDListsCalled); INCSTAT(stats.thisFrame.numDListsCalled); Statistics::SwapDL(); diff --git a/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp b/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp index e12b62d5a7..4c26509878 100644 --- a/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/x64TextureDecoder.cpp @@ -28,6 +28,12 @@ #include <tmmintrin.h> #endif +// This avoids a harmless warning from a system header in Clang; +// see http://llvm.org/bugs/show_bug.cgi?id=16093 +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wshadow" +#endif + bool TexFmt_Overlay_Enable=false; bool TexFmt_Overlay_Center=false; |
