diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-04-16 19:50:12 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-04-22 17:36:25 +0200 |
commit | 644588fd883fb45bf6d1cb7895e98ec65120c7f1 (patch) | |
tree | bba62ddc70e779d34591d5c37746dcc38238c8b1 /src/video_core/renderer_opengl/gl_shader_cache.cpp | |
parent | Address Feedback. (diff) | |
download | yuzu-644588fd883fb45bf6d1cb7895e98ec65120c7f1.tar yuzu-644588fd883fb45bf6d1cb7895e98ec65120c7f1.tar.gz yuzu-644588fd883fb45bf6d1cb7895e98ec65120c7f1.tar.bz2 yuzu-644588fd883fb45bf6d1cb7895e98ec65120c7f1.tar.lz yuzu-644588fd883fb45bf6d1cb7895e98ec65120c7f1.tar.xz yuzu-644588fd883fb45bf6d1cb7895e98ec65120c7f1.tar.zst yuzu-644588fd883fb45bf6d1cb7895e98ec65120c7f1.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_cache.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 6d2ff20f9..f63156b8d 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -448,7 +448,7 @@ Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) { // Look up shader in the cache based on address const auto cpu_addr{memory_manager.GpuToCpuAddress(address)}; - Shader shader{cpu_addr ? TryGet(*cpu_addr) : nullptr}; + Shader shader{cpu_addr ? TryGet(*cpu_addr) : null_shader}; if (shader) { return last_shaders[static_cast<std::size_t>(program)] = shader; } @@ -477,7 +477,12 @@ Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) { const std::size_t size_in_bytes = code.size() * sizeof(u64); shader = CachedShader::CreateFromCache(params, found->second, size_in_bytes); } - Register(shader); + + if (cpu_addr) { + Register(shader); + } else { + null_shader = shader; + } return last_shaders[static_cast<std::size_t>(program)] = shader; } @@ -486,7 +491,7 @@ Shader ShaderCacheOpenGL::GetComputeKernel(GPUVAddr code_addr) { auto& memory_manager{system.GPU().MemoryManager()}; const auto cpu_addr{memory_manager.GpuToCpuAddress(code_addr)}; - auto kernel = cpu_addr ? TryGet(*cpu_addr) : nullptr; + auto kernel = cpu_addr ? TryGet(*cpu_addr) : null_kernel; if (kernel) { return kernel; } @@ -507,7 +512,11 @@ Shader ShaderCacheOpenGL::GetComputeKernel(GPUVAddr code_addr) { kernel = CachedShader::CreateFromCache(params, found->second, size_in_bytes); } - Register(kernel); + if (cpu_addr) { + Register(kernel); + } else { + null_kernel = kernel; + } return kernel; } |