diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-11-29 07:24:21 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-11-29 20:26:42 +0100 |
commit | e8620eaa9a0079406fea2b3e8d8965262e983499 (patch) | |
tree | 354a86d391b4aa88eed40803611e9eac1b12cd1d /src/video_core/renderer_opengl | |
parent | Merge pull request #1768 from greggameplayer/patch-2 (diff) | |
download | yuzu-e8620eaa9a0079406fea2b3e8d8965262e983499.tar yuzu-e8620eaa9a0079406fea2b3e8d8965262e983499.tar.gz yuzu-e8620eaa9a0079406fea2b3e8d8965262e983499.tar.bz2 yuzu-e8620eaa9a0079406fea2b3e8d8965262e983499.tar.lz yuzu-e8620eaa9a0079406fea2b3e8d8965262e983499.tar.xz yuzu-e8620eaa9a0079406fea2b3e8d8965262e983499.tar.zst yuzu-e8620eaa9a0079406fea2b3e8d8965262e983499.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h index b757f5f44..4970aafed 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.h +++ b/src/video_core/renderer_opengl/gl_shader_manager.h @@ -60,6 +60,17 @@ public: } void ApplyTo(OpenGLState& state) { + UpdatePipeline(); + state.draw.shader_program = 0; + state.draw.program_pipeline = pipeline.handle; + state.geometry_shaders.enabled = (gs != 0); + } + +private: + void UpdatePipeline() { + // Avoid updating the pipeline when values have no changed + if (old_vs == vs && old_fs == fs && old_gs == gs) + return; // Workaround for AMD bug glUseProgramStages(pipeline.handle, GL_VERTEX_SHADER_BIT | GL_GEOMETRY_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, @@ -68,14 +79,16 @@ public: glUseProgramStages(pipeline.handle, GL_VERTEX_SHADER_BIT, vs); glUseProgramStages(pipeline.handle, GL_GEOMETRY_SHADER_BIT, gs); glUseProgramStages(pipeline.handle, GL_FRAGMENT_SHADER_BIT, fs); - state.draw.shader_program = 0; - state.draw.program_pipeline = pipeline.handle; - state.geometry_shaders.enabled = (gs != 0); + + // Update the old values + old_vs = vs; + old_fs = fs; + old_gs = gs; } -private: OGLPipeline pipeline; GLuint vs{}, fs{}, gs{}; + GLuint old_vs{}, old_fs{}, old_gs{}; }; } // namespace OpenGL::GLShader |