summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-12-02 05:48:55 +0100
committerGitHub <noreply@github.com>2018-12-02 05:48:55 +0100
commit80aa124b1d9da66148ea8d00e563ca7337182e68 (patch)
tree529861d7ee3e480eaf86cb83250236a6230659b6 /src/video_core
parentMerge pull request #1795 from ReinUsesLisp/vc-cleanup (diff)
parentgl_shader_manager: Update pipeline when programs have changed (diff)
downloadyuzu-80aa124b1d9da66148ea8d00e563ca7337182e68.tar
yuzu-80aa124b1d9da66148ea8d00e563ca7337182e68.tar.gz
yuzu-80aa124b1d9da66148ea8d00e563ca7337182e68.tar.bz2
yuzu-80aa124b1d9da66148ea8d00e563ca7337182e68.tar.lz
yuzu-80aa124b1d9da66148ea8d00e563ca7337182e68.tar.xz
yuzu-80aa124b1d9da66148ea8d00e563ca7337182e68.tar.zst
yuzu-80aa124b1d9da66148ea8d00e563ca7337182e68.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_manager.h21
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