diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/shader_language.cpp | 40 | ||||
-rw-r--r-- | servers/rendering/shader_language.h | 8 |
2 files changed, 29 insertions, 19 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index a84944ffc2..0127fcf813 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -214,8 +214,8 @@ const char *ShaderLanguage::token_names[TK_MAX] = { "FILTER_LINEAR", "FILTER_NEAREST_MIPMAP", "FILTER_LINEAR_MIPMAP", - "FILTER_NEAREST_MIPMAP_ANISOTROPY", - "FILTER_LINEAR_MIPMAP_ANISOTROPY", + "FILTER_NEAREST_MIPMAP_ANISOTROPIC", + "FILTER_LINEAR_MIPMAP_ANISOTROPIC", "REPEAT_ENABLE", "REPEAT_DISABLE", "SHADER_TYPE", @@ -328,8 +328,8 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] = { { TK_FILTER_LINEAR, "filter_linear" }, { TK_FILTER_NEAREST_MIPMAP, "filter_nearest_mipmap" }, { TK_FILTER_LINEAR_MIPMAP, "filter_linear_mipmap" }, - { TK_FILTER_NEAREST_MIPMAP_ANISOTROPY, "filter_nearest_mipmap_anisotropy" }, - { TK_FILTER_LINEAR_MIPMAP_ANISOTROPY, "filter_linear_mipmap_anisotropy" }, + { TK_FILTER_NEAREST_MIPMAP_ANISOTROPIC, "filter_nearest_mipmap_anisotropic" }, + { TK_FILTER_LINEAR_MIPMAP_ANISOTROPIC, "filter_linear_mipmap_anisotropic" }, { TK_REPEAT_ENABLE, "repeat_enable" }, { TK_REPEAT_DISABLE, "repeat_disable" }, { TK_SHADER_TYPE, "shader_type" }, @@ -4850,11 +4850,6 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons if (shader->structs.has(identifier)) { pstruct = shader->structs[identifier].shader_struct; -#ifdef DEBUG_ENABLED - if (check_warnings && HAS_WARNING(ShaderWarning::UNUSED_STRUCT_FLAG) && used_structs.has(identifier)) { - used_structs[identifier].used = true; - } -#endif // DEBUG_ENABLED struct_init = true; } @@ -6420,6 +6415,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun String struct_name = ""; if (is_struct) { struct_name = tk.text; +#ifdef DEBUG_ENABLED + if (check_warnings && HAS_WARNING(ShaderWarning::UNUSED_STRUCT_FLAG) && used_structs.has(struct_name)) { + used_structs[struct_name].used = true; + } +#endif // DEBUG_ENABLED } bool is_const = false; @@ -7638,6 +7638,11 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct if (shader->structs.has(tk.text)) { struct_name = tk.text; +#ifdef DEBUG_ENABLED + if (check_warnings && HAS_WARNING(ShaderWarning::UNUSED_STRUCT_FLAG) && used_structs.has(struct_name)) { + used_structs[struct_name].used = true; + } +#endif // DEBUG_ENABLED struct_dt = true; if (use_precision) { _set_error("Precision modifier cannot be used on structs."); @@ -8106,10 +8111,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct uniform2.filter = FILTER_NEAREST_MIPMAP; } else if (tk.type == TK_FILTER_LINEAR_MIPMAP) { uniform2.filter = FILTER_LINEAR_MIPMAP; - } else if (tk.type == TK_FILTER_NEAREST_MIPMAP_ANISOTROPY) { - uniform2.filter = FILTER_NEAREST_MIPMAP_ANISOTROPY; - } else if (tk.type == TK_FILTER_LINEAR_MIPMAP_ANISOTROPY) { - uniform2.filter = FILTER_LINEAR_MIPMAP_ANISOTROPY; + } else if (tk.type == TK_FILTER_NEAREST_MIPMAP_ANISOTROPIC) { + uniform2.filter = FILTER_NEAREST_MIPMAP_ANISOTROPIC; + } else if (tk.type == TK_FILTER_LINEAR_MIPMAP_ANISOTROPIC) { + uniform2.filter = FILTER_LINEAR_MIPMAP_ANISOTROPIC; } else if (tk.type == TK_REPEAT_DISABLE) { uniform2.repeat = REPEAT_DISABLE; } else if (tk.type == TK_REPEAT_ENABLE) { @@ -8745,6 +8750,11 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct if (shader->structs.has(tk.text)) { is_struct = true; param_struct_name = tk.text; +#ifdef DEBUG_ENABLED + if (check_warnings && HAS_WARNING(ShaderWarning::UNUSED_STRUCT_FLAG) && used_structs.has(param_struct_name)) { + used_structs[param_struct_name].used = true; + } +#endif // DEBUG_ENABLED if (use_precision) { _set_error("Precision modifier cannot be used on structs."); return ERR_PARSE_ERROR; @@ -9559,10 +9569,10 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_ if (options.is_empty()) { options.push_back("filter_linear"); options.push_back("filter_linear_mipmap"); - options.push_back("filter_linear_mipmap_anisotropy"); + options.push_back("filter_linear_mipmap_anisotropic"); options.push_back("filter_nearest"); options.push_back("filter_nearest_mipmap"); - options.push_back("filter_nearest_mipmap_anisotropy"); + options.push_back("filter_nearest_mipmap_anisotropic"); options.push_back("hint_albedo"); options.push_back("hint_anisotropy"); options.push_back("hint_black"); diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h index 02a2ef3a67..8502a250b6 100644 --- a/servers/rendering/shader_language.h +++ b/servers/rendering/shader_language.h @@ -179,8 +179,8 @@ public: TK_FILTER_LINEAR, TK_FILTER_NEAREST_MIPMAP, TK_FILTER_LINEAR_MIPMAP, - TK_FILTER_NEAREST_MIPMAP_ANISOTROPY, - TK_FILTER_LINEAR_MIPMAP_ANISOTROPY, + TK_FILTER_NEAREST_MIPMAP_ANISOTROPIC, + TK_FILTER_LINEAR_MIPMAP_ANISOTROPIC, TK_REPEAT_ENABLE, TK_REPEAT_DISABLE, TK_SHADER_TYPE, @@ -322,8 +322,8 @@ public: FILTER_LINEAR, FILTER_NEAREST_MIPMAP, FILTER_LINEAR_MIPMAP, - FILTER_NEAREST_MIPMAP_ANISOTROPY, - FILTER_LINEAR_MIPMAP_ANISOTROPY, + FILTER_NEAREST_MIPMAP_ANISOTROPIC, + FILTER_LINEAR_MIPMAP_ANISOTROPIC, FILTER_DEFAULT, }; |