diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index 636c1b39e8..0cf1971e53 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -250,6 +250,16 @@ void ReloadAllPostShaderInfo(Draw::DrawContext *draw) { LoadPostShaderInfo(draw, directories); } +void RemoveUnknownPostShaders(std::vector *names) { + for (auto iter = names->begin(); iter != names->end(); ) { + if (GetPostShaderInfo(*iter) == nullptr) { + iter = names->erase(iter); + } else { + ++iter; + } + } +} + const ShaderInfo *GetPostShaderInfo(const std::string &name) { for (size_t i = 0; i < shaderInfo.size(); i++) { if (shaderInfo[i].section == name) diff --git a/GPU/Common/PostShader.h b/GPU/Common/PostShader.h index 06fc69a159..4b4061988c 100644 --- a/GPU/Common/PostShader.h +++ b/GPU/Common/PostShader.h @@ -114,3 +114,4 @@ const std::vector &GetAllPostShaderInfo(); const TextureShaderInfo *GetTextureShaderInfo(const std::string &name); const std::vector &GetAllTextureShaderInfo(); +void RemoveUnknownPostShaders(std::vector *names); diff --git a/GPU/Common/PresentationCommon.cpp b/GPU/Common/PresentationCommon.cpp index e07eec1499..f8837e2808 100644 --- a/GPU/Common/PresentationCommon.cpp +++ b/GPU/Common/PresentationCommon.cpp @@ -879,6 +879,7 @@ void PresentationCommon::CalculateRenderResolution(int *width, int *height, int std::vector shaderInfo; if (!g_Config.vPostShaderNames.empty()) { ReloadAllPostShaderInfo(draw_); + RemoveUnknownPostShaders(&g_Config.vPostShaderNames); shaderInfo = GetFullPostShadersChain(g_Config.vPostShaderNames); } diff --git a/assets/shaders/defaultshaders.ini b/assets/shaders/defaultshaders.ini index 2a33454069..b6412bb357 100644 --- a/assets/shaders/defaultshaders.ini +++ b/assets/shaders/defaultshaders.ini @@ -28,11 +28,6 @@ Name=Vignette Author=Henrik Fragment=vignette.fsh Vertex=fxaa.vsh -[Grayscale] -Name=Grayscale -Author=Henrik -Fragment=grayscale.fsh -Vertex=fxaa.vsh [Bloom] Name=Bloom Fragment=bloom.fsh diff --git a/assets/shaders/grayscale.fsh b/assets/shaders/grayscale.fsh deleted file mode 100644 index f309204e12..0000000000 --- a/assets/shaders/grayscale.fsh +++ /dev/null @@ -1,16 +0,0 @@ -// Simple grayscale shader - -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -uniform sampler2D sampler0; -varying vec2 v_texcoord0; - -void main() { - vec3 rgb = texture2D(sampler0, v_texcoord0.xy).xyz; - float luma = dot(rgb, vec3(0.299, 0.587, 0.114)); - gl_FragColor.rgb = vec3(luma, luma, luma); - gl_FragColor.a = 1.0; -}