summaryrefslogtreecommitdiffstats
path: root/servers/rendering/shader_warnings.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-07-15 16:19:22 +0200
committerGitHub <noreply@github.com>2021-07-15 16:19:22 +0200
commit64fb4fac89ddc51f35a3e727783f4f40dc9eca8f (patch)
tree7c585aa20c41ae40830e6d40aa328f6a962fada0 /servers/rendering/shader_warnings.cpp
parent3f12765a7e3489d1d3b687c84efbfcab58442bc9 (diff)
parent5100eed012eb22f4717a124d23be90fca21d6174 (diff)
downloadredot-engine-64fb4fac89ddc51f35a3e727783f4f40dc9eca8f.tar.gz
Merge pull request #49996 from Chaosus/shader_localvar_warning
Added a shader warning about unused local variable
Diffstat (limited to 'servers/rendering/shader_warnings.cpp')
-rw-r--r--servers/rendering/shader_warnings.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/servers/rendering/shader_warnings.cpp b/servers/rendering/shader_warnings.cpp
index aa11b4e397..0c1d6408c9 100644
--- a/servers/rendering/shader_warnings.cpp
+++ b/servers/rendering/shader_warnings.cpp
@@ -59,6 +59,8 @@ String ShaderWarning::get_message() const {
return vformat("The uniform '%s' is declared but never used.", subject);
case UNUSED_VARYING:
return vformat("The varying '%s' is declared but never used.", subject);
+ case UNUSED_LOCAL_VARIABLE:
+ return vformat("The local variable '%s' is declared but never used.", subject);
default:
break;
}
@@ -79,6 +81,7 @@ String ShaderWarning::get_name_from_code(Code p_code) {
"UNUSED_STRUCT",
"UNUSED_UNIFORM",
"UNUSED_VARYING",
+ "UNUSED_LOCAL_VARIABLE",
};
static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names.");
@@ -106,6 +109,7 @@ static void init_code_to_flags_map() {
code_to_flags_map->insert(ShaderWarning::UNUSED_STRUCT, ShaderWarning::UNUSED_STRUCT_FLAG);
code_to_flags_map->insert(ShaderWarning::UNUSED_UNIFORM, ShaderWarning::UNUSED_UNIFORM_FLAG);
code_to_flags_map->insert(ShaderWarning::UNUSED_VARYING, ShaderWarning::UNUSED_VARYING_FLAG);
+ code_to_flags_map->insert(ShaderWarning::UNUSED_LOCAL_VARIABLE, ShaderWarning::UNUSED_LOCAL_VARIABLE_FLAG);
}
ShaderWarning::CodeFlags ShaderWarning::get_flags_from_codemap(const Map<Code, bool> &p_map) {