summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorYuri Rubinsky <chaosus89@gmail.com>2022-10-03 14:01:46 +0300
committerYuri Rubinsky <chaosus89@gmail.com>2022-10-03 15:06:20 +0300
commita2c32590ee3a6a540bbcbc96b775d8b1a314707d (patch)
treef9188bc7c7b74ead45376749d407a2275ec5516f /servers
parentd331b803b8e63b0dab406a12c21805a17ee0a6a8 (diff)
Fix global uniform crash at editor startup
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/shader_compiler.cpp8
-rw-r--r--servers/rendering/shader_compiler.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp
index ab5b8af794..1d83cc9de7 100644
--- a/servers/rendering/shader_compiler.cpp
+++ b/servers/rendering/shader_compiler.cpp
@@ -32,8 +32,8 @@
#include "core/config/project_settings.h"
#include "core/os/os.h"
+#include "servers/rendering/rendering_server_globals.h"
#include "servers/rendering/shader_types.h"
-#include "servers/rendering_server.h"
#define SL ShaderLanguage
@@ -1348,8 +1348,8 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
return code;
}
-ShaderLanguage::DataType ShaderCompiler::_get_variable_type(const StringName &p_type) {
- RS::GlobalShaderParameterType gvt = RS::get_singleton()->global_shader_parameter_get_type(p_type);
+ShaderLanguage::DataType ShaderCompiler::_get_global_shader_uniform_type(const StringName &p_name) {
+ RS::GlobalShaderParameterType gvt = RSG::material_storage->global_shader_parameter_get_type(p_name);
return (ShaderLanguage::DataType)RS::global_shader_uniform_type_get_shader_datatype(gvt);
}
@@ -1358,7 +1358,7 @@ Error ShaderCompiler::compile(RS::ShaderMode p_mode, const String &p_code, Ident
info.functions = ShaderTypes::get_singleton()->get_functions(p_mode);
info.render_modes = ShaderTypes::get_singleton()->get_modes(p_mode);
info.shader_types = ShaderTypes::get_singleton()->get_types();
- info.global_shader_uniform_type_func = _get_variable_type;
+ info.global_shader_uniform_type_func = _get_global_shader_uniform_type;
Error err = parser.compile(p_code, info);
diff --git a/servers/rendering/shader_compiler.h b/servers/rendering/shader_compiler.h
index 1ad43daf5f..4cbe93afb2 100644
--- a/servers/rendering/shader_compiler.h
+++ b/servers/rendering/shader_compiler.h
@@ -122,7 +122,7 @@ private:
DefaultIdentifierActions actions;
- static ShaderLanguage::DataType _get_variable_type(const StringName &p_type);
+ static ShaderLanguage::DataType _get_global_shader_uniform_type(const StringName &p_name);
public:
Error compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);