From 786ad514df8a91103c12ec178366395622eef5a4 Mon Sep 17 00:00:00 2001 From: smosages Date: Sun, 19 Feb 2023 15:35:05 +0100 Subject: [PATCH] Move ShaderWarning definitions into rendering_server --- editor/plugins/text_shader_editor.cpp | 5 ----- servers/rendering_server.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp index ffd95648167..abe7275595d 100644 --- a/editor/plugins/text_shader_editor.cpp +++ b/editor/plugins/text_shader_editor.cpp @@ -1051,11 +1051,6 @@ void TextShaderEditor::_make_context_menu(bool p_selection, Vector2 p_position) } TextShaderEditor::TextShaderEditor() { - GLOBAL_DEF("debug/shader_language/warnings/enable", true); - GLOBAL_DEF("debug/shader_language/warnings/treat_warnings_as_errors", false); - for (int i = 0; i < (int)ShaderWarning::WARNING_MAX; i++) { - GLOBAL_DEF("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code((ShaderWarning::Code)i).to_lower(), true); - } _update_warnings(false); shader_editor = memnew(ShaderTextEditor); diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 3d0443b494d..3dab356d113 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -35,6 +35,7 @@ #include "core/variant/typed_array.h" #include "servers/rendering/rendering_server_globals.h" #include "servers/rendering/shader_language.h" +#include "servers/rendering/shader_warnings.h" RenderingServer *RenderingServer::singleton = nullptr; RenderingServer *(*RenderingServer::create_func)() = nullptr; @@ -2978,6 +2979,15 @@ void RenderingServer::init() { GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/opengl/max_lights_per_object", PROPERTY_HINT_RANGE, "2,1024,1"), 8); GLOBAL_DEF_RST_BASIC("xr/shaders/enabled", false); + + GLOBAL_DEF("debug/shader_language/warnings/enable", true); + GLOBAL_DEF("debug/shader_language/warnings/treat_warnings_as_errors", false); + +#ifdef DEBUG_ENABLED + for (int i = 0; i < (int)ShaderWarning::WARNING_MAX; i++) { + GLOBAL_DEF("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code((ShaderWarning::Code)i).to_lower(), true); + } +#endif } RenderingServer::~RenderingServer() {