Optimize include files to improve `shader_language.h` compilation speed
This commit is contained in:
parent
d9f6e33663
commit
422f7b280f
|
@ -205,7 +205,7 @@ void ShaderTextEditor::_check_shader_mode() {
|
||||||
|
|
||||||
static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_variable) {
|
static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_variable) {
|
||||||
RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_variable);
|
RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_variable);
|
||||||
return RS::global_variable_type_get_shader_datatype(gvt);
|
return (ShaderLanguage::DataType)RS::global_variable_type_get_shader_datatype(gvt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options) {
|
void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options) {
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include "scene/gui/text_edit.h"
|
#include "scene/gui/text_edit.h"
|
||||||
#include "scene/main/timer.h"
|
#include "scene/main/timer.h"
|
||||||
#include "scene/resources/shader.h"
|
#include "scene/resources/shader.h"
|
||||||
#include "servers/rendering/shader_language.h"
|
#include "servers/rendering/shader_warnings.h"
|
||||||
|
|
||||||
class ShaderTextEditor : public CodeTextEditor {
|
class ShaderTextEditor : public CodeTextEditor {
|
||||||
GDCLASS(ShaderTextEditor, CodeTextEditor);
|
GDCLASS(ShaderTextEditor, CodeTextEditor);
|
||||||
|
|
|
@ -3914,7 +3914,7 @@ void VisualShaderEditor::_preview_size_changed() {
|
||||||
|
|
||||||
static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_variable) {
|
static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_variable) {
|
||||||
RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_variable);
|
RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_variable);
|
||||||
return RS::global_variable_type_get_shader_datatype(gvt);
|
return (ShaderLanguage::DataType)RS::global_variable_type_get_shader_datatype(gvt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualShaderEditor::_update_preview() {
|
void VisualShaderEditor::_update_preview() {
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "shader_globals_editor.h"
|
#include "shader_globals_editor.h"
|
||||||
#include "editor_node.h"
|
#include "editor_node.h"
|
||||||
|
#include "servers/rendering/shader_language.h"
|
||||||
|
|
||||||
static const char *global_var_type_names[RS::GLOBAL_VAR_TYPE_MAX] = {
|
static const char *global_var_type_names[RS::GLOBAL_VAR_TYPE_MAX] = {
|
||||||
"bool",
|
"bool",
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "core/templates/self_list.h"
|
#include "core/templates/self_list.h"
|
||||||
#include "scene/resources/shader.h"
|
#include "scene/resources/shader.h"
|
||||||
#include "scene/resources/texture.h"
|
#include "scene/resources/texture.h"
|
||||||
#include "servers/rendering/shader_language.h"
|
|
||||||
#include "servers/rendering_server.h"
|
#include "servers/rendering_server.h"
|
||||||
|
|
||||||
class Material : public Resource {
|
class Material : public Resource {
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
|
#include "servers/rendering/shader_types.h"
|
||||||
#include "servers/rendering_server.h"
|
#include "servers/rendering_server.h"
|
||||||
|
|
||||||
#define SL ShaderLanguage
|
#define SL ShaderLanguage
|
||||||
|
@ -1333,7 +1334,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
|
||||||
|
|
||||||
ShaderLanguage::DataType ShaderCompiler::_get_variable_type(const StringName &p_type) {
|
ShaderLanguage::DataType ShaderCompiler::_get_variable_type(const StringName &p_type) {
|
||||||
RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_type);
|
RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_type);
|
||||||
return RS::global_variable_type_get_shader_datatype(gvt);
|
return (ShaderLanguage::DataType)RS::global_variable_type_get_shader_datatype(gvt);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error ShaderCompiler::compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
|
Error ShaderCompiler::compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
|
|
||||||
#include "core/templates/pair.h"
|
#include "core/templates/pair.h"
|
||||||
#include "servers/rendering/shader_language.h"
|
#include "servers/rendering/shader_language.h"
|
||||||
#include "servers/rendering/shader_types.h"
|
|
||||||
#include "servers/rendering_server.h"
|
#include "servers/rendering_server.h"
|
||||||
|
|
||||||
class ShaderCompiler {
|
class ShaderCompiler {
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
#include "servers/rendering/rendering_server_globals.h"
|
#include "servers/rendering/rendering_server_globals.h"
|
||||||
|
#include "servers/rendering/shader_language.h"
|
||||||
|
|
||||||
RenderingServer *RenderingServer::singleton = nullptr;
|
RenderingServer *RenderingServer::singleton = nullptr;
|
||||||
RenderingServer *(*RenderingServer::create_func)() = nullptr;
|
RenderingServer *(*RenderingServer::create_func)() = nullptr;
|
||||||
|
@ -1411,7 +1412,7 @@ Array RenderingServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_su
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ShaderLanguage::DataType RenderingServer::global_variable_type_get_shader_datatype(GlobalVariableType p_type) {
|
int RenderingServer::global_variable_type_get_shader_datatype(GlobalVariableType p_type) {
|
||||||
switch (p_type) {
|
switch (p_type) {
|
||||||
case RS::GLOBAL_VAR_TYPE_BOOL:
|
case RS::GLOBAL_VAR_TYPE_BOOL:
|
||||||
return ShaderLanguage::TYPE_BOOL;
|
return ShaderLanguage::TYPE_BOOL;
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "servers/display_server.h"
|
#include "servers/display_server.h"
|
||||||
#include "servers/rendering/renderer_thread_pool.h"
|
#include "servers/rendering/renderer_thread_pool.h"
|
||||||
#include "servers/rendering/rendering_device.h"
|
#include "servers/rendering/rendering_device.h"
|
||||||
#include "servers/rendering/shader_language.h"
|
|
||||||
|
|
||||||
class RenderingServer : public Object {
|
class RenderingServer : public Object {
|
||||||
GDCLASS(RenderingServer, Object);
|
GDCLASS(RenderingServer, Object);
|
||||||
|
@ -1456,7 +1455,7 @@ public:
|
||||||
virtual void global_variables_load_settings(bool p_load_textures) = 0;
|
virtual void global_variables_load_settings(bool p_load_textures) = 0;
|
||||||
virtual void global_variables_clear() = 0;
|
virtual void global_variables_clear() = 0;
|
||||||
|
|
||||||
static ShaderLanguage::DataType global_variable_type_get_shader_datatype(GlobalVariableType p_type);
|
static int global_variable_type_get_shader_datatype(GlobalVariableType p_type);
|
||||||
|
|
||||||
/* FREE */
|
/* FREE */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue