1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Implement global and per instance shader uniforms.

Adds two keywords to shader language for uniforms:
-'global'
-'instance'

This allows them to reference values outside the material.
This commit is contained in:
Juan Linietsky
2020-04-16 23:52:00 -03:00
parent 30ab5c9baa
commit 0e1c66d9fc
49 changed files with 3124 additions and 69 deletions

View File

@@ -57,6 +57,7 @@ public:
ShaderLanguage::ShaderNode::Uniform::Hint hint;
ShaderLanguage::TextureFilter filter;
ShaderLanguage::TextureRepeat repeat;
bool global;
};
Vector<Texture> texture_uniforms;
@@ -70,6 +71,7 @@ public:
String fragment;
String light;
bool uses_global_textures;
bool uses_fragment_time;
bool uses_vertex_time;
};
@@ -86,6 +88,8 @@ public:
int base_texture_binding_index = 0;
int texture_layout_set = 0;
String base_uniform_string;
String global_buffer_array_variable;
String instance_uniform_index_variable;
uint32_t base_varying_index = 0;
};
@@ -113,6 +117,8 @@ private:
DefaultIdentifierActions actions;
static ShaderLanguage::DataType _get_variable_type(const StringName &p_type);
public:
Error compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);