summaryrefslogtreecommitdiff
path: root/servers/rendering/rasterizer_rd/shader_compiler_rd.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-04-16 23:52:00 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-04-17 12:35:41 -0300
commit0e1c66d9fced8f9d3a8fbd87ddfd2c29a9ed2679 (patch)
tree20628329f16f74383806fecf9e3135816636e6fb /servers/rendering/rasterizer_rd/shader_compiler_rd.h
parent30ab5c9baae1cad3e157d906395a4eb8cef77e42 (diff)
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.
Diffstat (limited to 'servers/rendering/rasterizer_rd/shader_compiler_rd.h')
-rw-r--r--servers/rendering/rasterizer_rd/shader_compiler_rd.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.h b/servers/rendering/rasterizer_rd/shader_compiler_rd.h
index 7d78469e9c..16d53197a7 100644
--- a/servers/rendering/rasterizer_rd/shader_compiler_rd.h
+++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.h
@@ -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);