diff options
author | bunnei <bunneidev@gmail.com> | 2019-01-07 20:22:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 20:22:30 +0100 |
commit | 23ebd4920e851a91bba0f2da70b7f63ee6b49dc3 (patch) | |
tree | 6b85aee5889aca55284c3b03b2ae9b72522532a1 /src/video_core/renderer_opengl | |
parent | Merge pull request #1989 from lioncash/set (diff) | |
parent | gl_shader_cache: Use dirty flags for shaders (diff) | |
download | yuzu-23ebd4920e851a91bba0f2da70b7f63ee6b49dc3.tar yuzu-23ebd4920e851a91bba0f2da70b7f63ee6b49dc3.tar.gz yuzu-23ebd4920e851a91bba0f2da70b7f63ee6b49dc3.tar.bz2 yuzu-23ebd4920e851a91bba0f2da70b7f63ee6b49dc3.tar.lz yuzu-23ebd4920e851a91bba0f2da70b7f63ee6b49dc3.tar.xz yuzu-23ebd4920e851a91bba0f2da70b7f63ee6b49dc3.tar.zst yuzu-23ebd4920e851a91bba0f2da70b7f63ee6b49dc3.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 6 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 4 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 089daf96f..37f01d4f7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -293,7 +293,7 @@ DrawParameters RasterizerOpenGL::SetupDraw() { void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) { MICROPROFILE_SCOPE(OpenGL_Shader); - const auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); + auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); // Next available bindpoints to use when uploading the const buffers and textures to the GLSL // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points. @@ -376,6 +376,8 @@ void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) { } SyncClipEnabled(clip_distances); + + gpu.dirty_flags.shaders = false; } void RasterizerOpenGL::SetupCachedFramebuffer(const FramebufferCacheKey& fbkey, diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index aea6bf1af..c785fffa3 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -188,6 +188,10 @@ void CachedShader::CalculateProperties() { ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer) : RasterizerCache{rasterizer} {} Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) { + if (!Core::System::GetInstance().GPU().Maxwell3D().dirty_flags.shaders) { + return last_shaders[static_cast<u32>(program)]; + } + const VAddr program_addr{GetShaderAddress(program)}; // Look up shader in the cache based on address @@ -199,7 +203,7 @@ Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) { Register(shader); } - return shader; + return last_shaders[static_cast<u32>(program)] = shader; } } // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index de3671acf..768747968 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h @@ -4,6 +4,7 @@ #pragma once +#include <array> #include <map> #include <memory> @@ -115,6 +116,9 @@ public: /// Gets the current specified shader stage program Shader GetStageProgram(Maxwell::ShaderProgram program); + +private: + std::array<Shader, Maxwell::MaxShaderProgram> last_shaders; }; } // namespace OpenGL |