mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-28 22:36:26 -05:00
shader_cache: Correct versioning and size calculation.
This commit is contained in:
parent
97c8c9f49a
commit
51ba60b27e
2 changed files with 7 additions and 2 deletions
|
@ -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++;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue