Remove UID Checker.

Kind of pointless now that multiple shaders with the same UID are
now fundementally impossible.
This commit is contained in:
Scott Mansell
2016-01-17 01:57:59 +13:00
parent 24e5d21780
commit 95469ec225
11 changed files with 0 additions and 145 deletions

View File

@ -154,74 +154,6 @@ public:
private:
std::vector<bool> constant_usage; // TODO: Is vector<bool> appropriate here?
};
/**
* Checks if there has been
*/
template <class UidT, class CodeT>
class UidChecker
{
public:
void Invalidate()
{
m_shaders.clear();
m_uids.clear();
}
void AddToIndexAndCheck(CodeT& new_code, const UidT& new_uid, const char* shader_type,
const char* dump_prefix)
{
bool uid_is_indexed = std::find(m_uids.begin(), m_uids.end(), new_uid) != m_uids.end();
if (!uid_is_indexed)
{
m_uids.push_back(new_uid);
m_shaders[new_uid] = new_code.GetBuffer();
}
else
{
// uid is already in the index => check if there's a shader with the same uid but different
// code
auto& old_code = m_shaders[new_uid];
if (old_code != new_code.GetBuffer())
{
static int num_failures = 0;
std::string temp =
StringFromFormat("%s%ssuid_mismatch_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(),
dump_prefix, ++num_failures);
// TODO: Should also dump uids
std::ofstream file;
OpenFStream(file, temp, std::ios_base::out);
file << "Old shader code:\n" << old_code;
file << "\n\nNew shader code:\n" << new_code.GetBuffer();
file << "\n\nShader uid:\n";
for (unsigned int i = 0; i < new_uid.GetUidDataSize(); ++i)
{
u8 value = new_uid.GetUidDataRaw()[i];
if ((i % 4) == 0)
{
auto last_value =
(i + 3 < new_uid.GetUidDataSize() - 1) ? i + 3 : new_uid.GetUidDataSize();
file << std::setfill(' ') << std::dec;
file << "Values " << std::setw(2) << i << " - " << last_value << ": ";
}
file << std::setw(2) << std::setfill('0') << std::hex << value << std::setw(1);
if ((i % 4) < 3)
file << ' ';
else
file << std::endl;
}
ERROR_LOG(VIDEO, "%s shader uid mismatch! See %s for details", shader_type, temp.c_str());
}
}
}
private:
std::map<UidT, std::string> m_shaders;
std::vector<UidT> m_uids;
};
template <class T>
inline void DefineOutputMember(T& object, API_TYPE api_type, const char* qualifier,