Delete the builtin Grayscale shader. Also make unknown shaders go away from list.

This commit is contained in:
Henrik Rydgård 2022-12-07 22:28:55 +01:00
parent 51493c01ae
commit 70ce76a8d5
5 changed files with 12 additions and 21 deletions

View file

@ -250,6 +250,16 @@ void ReloadAllPostShaderInfo(Draw::DrawContext *draw) {
LoadPostShaderInfo(draw, directories);
}
void RemoveUnknownPostShaders(std::vector<std::string> *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)

View file

@ -114,3 +114,4 @@ const std::vector<ShaderInfo> &GetAllPostShaderInfo();
const TextureShaderInfo *GetTextureShaderInfo(const std::string &name);
const std::vector<TextureShaderInfo> &GetAllTextureShaderInfo();
void RemoveUnknownPostShaders(std::vector<std::string> *names);

View file

@ -879,6 +879,7 @@ void PresentationCommon::CalculateRenderResolution(int *width, int *height, int
std::vector<const ShaderInfo *> shaderInfo;
if (!g_Config.vPostShaderNames.empty()) {
ReloadAllPostShaderInfo(draw_);
RemoveUnknownPostShaders(&g_Config.vPostShaderNames);
shaderInfo = GetFullPostShadersChain(g_Config.vPostShaderNames);
}

View file

@ -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

View file

@ -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;
}