summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-08-24 23:56:31 +1200
committerMatthew Parlane <parlane@gmail.com>2013-08-24 23:56:31 +1200
commit5548e7743831079d850e618c4e6b7da4769241c7 (patch)
treea2a9ca8e26f602b1eadc701e6de886f55a00854b /Source/Core/VideoCommon
parent6907a326530d2771f9a39d72cebe54d391172c1b (diff)
parent66c50ebf191b1b8d3d4cb696203a1cc225085eb7 (diff)
Merge branch 'master' into wii-network
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/DriverDetails.cpp60
-rw-r--r--Source/Core/VideoCommon/Src/DriverDetails.h26
-rw-r--r--Source/Core/VideoCommon/Src/OnScreenDisplay.cpp110
-rw-r--r--Source/Core/VideoCommon/Src/OnScreenDisplay.h18
-rw-r--r--Source/Core/VideoCommon/Src/VideoConfig.cpp2
-rw-r--r--Source/Core/VideoCommon/Src/VideoConfig.h3
6 files changed, 96 insertions, 123 deletions
diff --git a/Source/Core/VideoCommon/Src/DriverDetails.cpp b/Source/Core/VideoCommon/Src/DriverDetails.cpp
index 85b7d3a47f..0a115e1354 100644
--- a/Source/Core/VideoCommon/Src/DriverDetails.cpp
+++ b/Source/Core/VideoCommon/Src/DriverDetails.cpp
@@ -11,8 +11,9 @@ namespace DriverDetails
{
struct BugInfo
{
+ Vendor m_vendor; // which vendor has the error
+ Driver m_driver; // which driver has the error
Bug m_bug; // Which bug it is
- u32 m_devfamily; // Which device(family) has the error
double m_versionstart; // When it started
double m_versionend; // When it ended
bool m_hasbug; // Does it have it?
@@ -21,40 +22,27 @@ namespace DriverDetails
// Local members
Vendor m_vendor = VENDOR_UNKNOWN;
Driver m_driver = DRIVER_UNKNOWN;
- u32 m_devfamily = 0;
double m_version = 0.0;
// This is a list of all known bugs for each vendor
// We use this to check if the device and driver has a issue
- BugInfo m_qualcommbugs[] = {
- {BUG_NODYNUBOACCESS, 300, 14.0, -1.0},
- {BUG_BROKENCENTROID, 300, 14.0, -1.0},
- {BUG_BROKENINFOLOG, 300, -1.0, -1.0},
+ BugInfo m_known_bugs[] = {
+ {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_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},
};
- std::map<std::pair<Vendor, Bug>, BugInfo> m_bugs;
-
- // Private function
- void InitBugMap()
- {
- switch(m_driver)
- {
- case DRIVER_QUALCOMM:
- for (unsigned int a = 0; a < (sizeof(m_qualcommbugs) / sizeof(BugInfo)); ++a)
- m_bugs[std::make_pair(m_vendor, m_qualcommbugs[a].m_bug)] = m_qualcommbugs[a];
- break;
- default:
- break;
- }
- }
+ std::map<Bug, BugInfo> m_bugs;
- void Init(Vendor vendor, Driver driver, const u32 devfamily, const double version)
+ void Init(Vendor vendor, Driver driver, const double version)
{
m_vendor = vendor;
m_driver = driver;
- m_devfamily = devfamily;
m_version = version;
- InitBugMap();
+
if (driver == DRIVER_UNKNOWN)
switch(vendor)
{
@@ -68,12 +56,6 @@ namespace DriverDetails
case VENDOR_INTEL:
m_driver = DRIVER_INTEL;
break;
- case VENDOR_ARM:
- m_driver = DRIVER_ARM;
- break;
- case VENDOR_QUALCOMM:
- m_driver = DRIVER_QUALCOMM;
- break;
case VENDOR_IMGTEC:
m_driver = DRIVER_IMGTEC;
break;
@@ -83,16 +65,22 @@ namespace DriverDetails
default:
break;
}
-
- for (auto it = m_bugs.begin(); it != m_bugs.end(); ++it)
- if (it->second.m_devfamily == m_devfamily)
- if (it->second.m_versionend == -1.0 || (it->second.m_versionstart <= m_version && it->second.m_versionend > m_version))
- it->second.m_hasbug = true;
+
+ for(unsigned int a = 0; a < (sizeof(m_known_bugs) / sizeof(BugInfo)); ++a)
+ {
+ if(
+ ( m_known_bugs[a].m_vendor == m_vendor || m_known_bugs[a].m_vendor == VENDOR_ALL ) &&
+ ( m_known_bugs[a].m_driver == m_driver || m_known_bugs[a].m_driver == DRIVER_ALL ) &&
+ ( m_known_bugs[a].m_versionstart <= m_version || m_known_bugs[a].m_versionstart == -1 ) &&
+ ( m_known_bugs[a].m_versionend > m_version || m_known_bugs[a].m_versionend == -1 )
+ )
+ m_bugs.insert(std::make_pair(m_known_bugs[a].m_bug, m_known_bugs[a]));
+ }
}
bool HasBug(Bug bug)
{
- auto it = m_bugs.find(std::make_pair(m_vendor, bug));
+ auto it = m_bugs.find(bug);
if (it == m_bugs.end())
return false;
return it->second.m_hasbug;
diff --git a/Source/Core/VideoCommon/Src/DriverDetails.h b/Source/Core/VideoCommon/Src/DriverDetails.h
index cb8b104eea..efb0c7c6c0 100644
--- a/Source/Core/VideoCommon/Src/DriverDetails.h
+++ b/Source/Core/VideoCommon/Src/DriverDetails.h
@@ -10,7 +10,8 @@ namespace DriverDetails
// Tegra and Nvidia are separated out due to such substantial differences
enum Vendor
{
- VENDOR_NVIDIA = 0,
+ VENDOR_ALL = 0,
+ VENDOR_NVIDIA,
VENDOR_ATI,
VENDOR_INTEL,
VENDOR_ARM,
@@ -18,20 +19,25 @@ namespace DriverDetails
VENDOR_IMGTEC,
VENDOR_TEGRA,
VENDOR_VIVANTE,
+ VENDOR_MESA,
VENDOR_UNKNOWN
};
// Enum of known drivers
enum Driver
{
- DRIVER_NVIDIA = 0, // Official Nvidia, including mobile GPU
+ DRIVER_ALL = 0,
+ DRIVER_NVIDIA, // Official Nvidia, including mobile GPU
DRIVER_NOUVEAU, // OSS nouveau
DRIVER_ATI, // Official ATI
- DRIVER_RADEONHD, // OSS Radeon
+ DRIVER_R600, // OSS Radeon
DRIVER_INTEL, // Official Intel
- DRIVER_ARM, // Official Mali driver
+ DRIVER_I965, // OSS Intel
+ DRIVER_ARM_4XX, // Official Mali driver
+ DRIVER_ARM_T6XX, // Official Mali driver
DRIVER_LIMA, // OSS Mali driver
- DRIVER_QUALCOMM, // Official Adreno driver
+ DRIVER_QUALCOMM_3XX, // Official Adreno driver 3xx
+ DRIVER_QUALCOMM_2XX, // Official Adreno driver 2xx
DRIVER_FREEDRENO, // OSS Adreno driver
DRIVER_IMGTEC, // OSS PowerVR driver
DRIVER_VIVANTE, // Official vivante driver
@@ -69,10 +75,18 @@ namespace DriverDetails
// Adreno devices /always/ return 0 when querying GL_INFO_LOG_LENGTH
// They also max out at 1024 bytes(1023 characters + null terminator) for the log
BUG_BROKENINFOLOG,
+ // Bug: UBO buffer offset broken
+ // Affected devices: all mesa drivers
+ // Started Version: 9.0 (mesa doesn't support ubo before)
+ // Ended Version: up to 9.2
+ // The offset of glBindBufferRange was ignored on all Mesa Gallium3D drivers until 9.1.3
+ // Nouveau stored the offset as u16 which isn't enough for all cases with range until 9.1.6
+ // I965 has broken data fetches from uniform buffers which results in a dithering until 9.2.0
+ BUG_BROKENUBO,
};
// Initializes our internal vendor, device family, and driver version
- void Init(Vendor vendor, Driver driver, const u32 devfamily, const double version);
+ void Init(Vendor vendor, Driver driver, const double version);
// Once Vendor and driver version is set, this will return if it has the applicable bug passed to it.
bool HasBug(Bug bug);
diff --git a/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp b/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp
index 29a3837a9a..b66c2019c9 100644
--- a/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp
+++ b/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp
@@ -11,51 +11,27 @@
#include "RenderBase.h"
#include "Timer.h"
-#include <vector>
+#include <map>
+#include <string>
namespace OSD
{
-struct MESSAGE
+struct Message
{
- MESSAGE() {}
- MESSAGE(const char* p, u32 dw)
- {
- strncpy(str, p, 255);
- str[255] = '\0';
- dwTimeStamp = dw;
- }
- char str[256];
- u32 dwTimeStamp;
-};
-
-class OSDCALLBACK
-{
-private:
- CallbackPtr m_functionptr;
- CallbackType m_type;
- u32 m_data;
-public:
- OSDCALLBACK(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData)
- {
- m_type = OnType;
- m_functionptr = FuncPtr;
- m_data = UserData;
- }
- void Call()
- {
- m_functionptr(m_data);
- }
+ Message() {}
+ Message(const std::string& s, u32 ts) : str(s), timestamp(ts) {}
- CallbackType Type() { return m_type; }
+ std::string str;
+ u32 timestamp;
};
-std::vector<OSDCALLBACK> m_callbacks;
-static std::list<MESSAGE> s_listMsgs;
+static std::multimap<CallbackType, Callback> s_callbacks;
+static std::list<Message> s_msgList;
-void AddMessage(const char* pstr, u32 ms)
+void AddMessage(const std::string& str, u32 ms)
{
- s_listMsgs.push_back(MESSAGE(pstr, Common::Timer::GetTimeMs() + ms));
+ s_msgList.push_back(Message(str, Common::Timer::GetTimeMs() + ms));
}
void DrawMessages()
@@ -63,58 +39,50 @@ void DrawMessages()
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages)
return;
- if (s_listMsgs.size() > 0)
+ int left = 25, top = 15;
+ auto it = s_msgList.begin();
+ while (it != s_msgList.end())
{
- int left = 25, top = 15;
- std::list<MESSAGE>::iterator it = s_listMsgs.begin();
- while (it != s_listMsgs.end())
+ int time_left = (int)(it->timestamp - Common::Timer::GetTimeMs());
+ u32 alpha = 255;
+
+ if (time_left < 1024)
{
- int time_left = (int)(it->dwTimeStamp - Common::Timer::GetTimeMs());
- int alpha = 255;
-
- if (time_left < 1024)
- {
- alpha = time_left >> 2;
- if (time_left < 0)
- alpha = 0;
- }
-
- alpha <<= 24;
-
- g_renderer->RenderText(it->str, left+1, top+1, 0x000000|alpha);
- g_renderer->RenderText(it->str, left, top, 0xffff30|alpha);
- top += 15;
-
- if (time_left <= 0)
- it = s_listMsgs.erase(it);
- else
- ++it;
+ alpha = time_left >> 2;
+ if (time_left < 0)
+ alpha = 0;
}
+
+ alpha <<= 24;
+
+ g_renderer->RenderText(it->str.c_str(), left + 1, top + 1, 0x000000 | alpha);
+ g_renderer->RenderText(it->str.c_str(), left, top, 0xffff30 | alpha);
+ top += 15;
+
+ if (time_left <= 0)
+ it = s_msgList.erase(it);
+ else
+ ++it;
}
}
void ClearMessages()
{
- std::list<MESSAGE>::iterator it = s_listMsgs.begin();
-
- while (it != s_listMsgs.end())
- {
- it = s_listMsgs.erase(it);
- }
+ s_msgList.clear();
}
// On-Screen Display Callbacks
-void AddCallback(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData)
+void AddCallback(CallbackType type, Callback cb)
{
- m_callbacks.push_back(OSDCALLBACK(OnType, FuncPtr, UserData));
+ s_callbacks.insert(std::pair<CallbackType, Callback>(type, cb));
}
-void DoCallbacks(CallbackType OnType)
+void DoCallbacks(CallbackType type)
{
- for (auto it = m_callbacks.begin(); it != m_callbacks.end(); ++it)
+ auto it_bounds = s_callbacks.equal_range(type);
+ for (auto it = it_bounds.first; it != it_bounds.second; ++it)
{
- if (it->Type() == OnType)
- it->Call();
+ it->second();
}
}
diff --git a/Source/Core/VideoCommon/Src/OnScreenDisplay.h b/Source/Core/VideoCommon/Src/OnScreenDisplay.h
index ef7d899e1f..a4a377b5d7 100644
--- a/Source/Core/VideoCommon/Src/OnScreenDisplay.h
+++ b/Source/Core/VideoCommon/Src/OnScreenDisplay.h
@@ -5,11 +5,13 @@
#ifndef _OSD_H_
#define _OSD_H_
-namespace OSD
-{
+#include <functional>
+#include <string>
+namespace OSD
+{
// On-screen message display
-void AddMessage(const char* str, u32 ms = 2000);
+void AddMessage(const std::string& str, u32 ms = 2000);
void DrawMessages(); // draw the current messages on the screen. Only call once per frame.
void ClearMessages();
@@ -20,12 +22,10 @@ enum CallbackType
OSD_ONFRAME,
OSD_SHUTDOWN
};
-typedef void(*CallbackPtr)(u32);
+typedef std::function<void()> Callback;
-void AddCallback(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData);
-
-void DoCallbacks(CallbackType OnType);
-} // namespace
+void AddCallback(CallbackType type, Callback cb);
+void DoCallbacks(CallbackType type);
+} // namespace OSD
#endif // _OSD_H_
-
diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp
index 6b6c796015..707aec734c 100644
--- a/Source/Core/VideoCommon/Src/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp
@@ -97,6 +97,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false);
iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);
+ iniFile.Get("Hacks", "ForceDualSourceBlend", &bForceDualSourceBlend, false);
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
@@ -265,6 +266,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
+ iniFile.Set("Hacks", "ForceDualSourceBlend", bForceDualSourceBlend);
iniFile.Set("Hardware", "Adapter", iAdapter);
diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h
index b856683595..4a773d30e7 100644
--- a/Source/Core/VideoCommon/Src/VideoConfig.h
+++ b/Source/Core/VideoCommon/Src/VideoConfig.h
@@ -124,7 +124,8 @@ struct VideoConfig
bool bEnablePixelLighting;
bool bHackedBufferUpload;
bool bFastDepthCalc;
-
+ //for dx9-backend
+ bool bForceDualSourceBlend;
int iLog; // CONF_ bits
int iSaveTargetId; // TODO: Should be dropped