yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

shader_cache: Correct versioning and size calculation.

This commit is contained in:
Fernando Sahmkow 2019-06-20 15:02:53 -04:00 committed by ReinUsesLisp
parent 97c8c9f49a
commit 51ba60b27e
2 changed files with 7 additions and 2 deletions

View File

@ -103,15 +103,20 @@ constexpr std::tuple<const char*, const char*, u32> GetPrimitiveDescription(GLen
/// Calculates the size of a program stream
std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) {
constexpr std::size_t start_offset = 10;
constexpr u64 key = 0xE2400FFFFF07000FULL;
constexpr u64 mask =0xFFFFFFFFFF7FFFFFULL;
std::size_t offset = start_offset;
std::size_t size = start_offset * sizeof(u64);
while (offset < program.size()) {
const u64 instruction = program[offset];
if (!IsSchedInstruction(offset, start_offset)) {
if (instruction == 0 || (instruction >> 52) == 0x50b) {
if ((instruction & mask) == key) {
// End on Maxwell's "nop" instruction
break;
}
if (instruction == 0) {
break;
}
}
size += sizeof(u64);
offset++;

View File

@ -34,7 +34,7 @@ enum class PrecompiledEntryKind : u32 {
Dump,
};
constexpr u32 NativeVersion = 3;
constexpr u32 NativeVersion = 4;
// Making sure sizes doesn't change by accident
static_assert(sizeof(BaseBindings) == 16);