summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-06-20 15:02:53 -0400
committerGravatar ReinUsesLisp2019-06-20 21:38:34 -0300
commit51ba60b27e54beec476416cd0c7334110bcdb274 (patch)
tree188677f8edf3f463e82a31324db89ab358e87d89 /src
parenttexture_cache: Eliminate linear textures fallthrough (diff)
downloadyuzu-51ba60b27e54beec476416cd0c7334110bcdb274.tar.gz
yuzu-51ba60b27e54beec476416cd0c7334110bcdb274.tar.xz
yuzu-51ba60b27e54beec476416cd0c7334110bcdb274.zip
shader_cache: Correct versioning and size calculation.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_shader_disk_cache.cpp2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 67789db73..02e217b8c 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -103,15 +103,20 @@ constexpr std::tuple<const char*, const char*, u32> GetPrimitiveDescription(GLen
103/// Calculates the size of a program stream 103/// Calculates the size of a program stream
104std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) { 104std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) {
105 constexpr std::size_t start_offset = 10; 105 constexpr std::size_t start_offset = 10;
106 constexpr u64 key = 0xE2400FFFFF07000FULL;
107 constexpr u64 mask =0xFFFFFFFFFF7FFFFFULL;
106 std::size_t offset = start_offset; 108 std::size_t offset = start_offset;
107 std::size_t size = start_offset * sizeof(u64); 109 std::size_t size = start_offset * sizeof(u64);
108 while (offset < program.size()) { 110 while (offset < program.size()) {
109 const u64 instruction = program[offset]; 111 const u64 instruction = program[offset];
110 if (!IsSchedInstruction(offset, start_offset)) { 112 if (!IsSchedInstruction(offset, start_offset)) {
111 if (instruction == 0 || (instruction >> 52) == 0x50b) { 113 if ((instruction & mask) == key) {
112 // End on Maxwell's "nop" instruction 114 // End on Maxwell's "nop" instruction
113 break; 115 break;
114 } 116 }
117 if (instruction == 0) {
118 break;
119 }
115 } 120 }
116 size += sizeof(u64); 121 size += sizeof(u64);
117 offset++; 122 offset++;
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
index 5ec911adc..922c72590 100644
--- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
@@ -34,7 +34,7 @@ enum class PrecompiledEntryKind : u32 {
34 Dump, 34 Dump,
35}; 35};
36 36
37constexpr u32 NativeVersion = 3; 37constexpr u32 NativeVersion = 4;
38 38
39// Making sure sizes doesn't change by accident 39// Making sure sizes doesn't change by accident
40static_assert(sizeof(BaseBindings) == 16); 40static_assert(sizeof(BaseBindings) == 16);