summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2021-06-09 12:33:41 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2021-10-04 13:57:44 +0300
commit6873ecaaf9b2c5ad35487b1ff1d4be17770d7aab (patch)
treede4cd78ab2cb88ef311b740fb3ace2640d85de76 /tests
parenta8f53dccedd052db4d54cd90d3fc693c60c922de (diff)
Added support for uniform arrays in shaders
Diffstat (limited to 'tests')
-rw-r--r--tests/test_shader_lang.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/tests/test_shader_lang.cpp b/tests/test_shader_lang.cpp
index 6d58eb63cc..5598852f29 100644
--- a/tests/test_shader_lang.cpp
+++ b/tests/test_shader_lang.cpp
@@ -125,23 +125,28 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
ucode += _prestr(E.value.precision);
ucode += _typestr(E.value.type);
ucode += " " + String(E.key);
+ if (E.value.array_size > 0) {
+ ucode += "[";
+ ucode += itos(E.value.array_size);
+ ucode += "]";
+ } else {
+ if (E.value.default_value.size()) {
+ ucode += " = " + get_constant_text(E.value.type, E.value.default_value);
+ }
- if (E.value.default_value.size()) {
- ucode += " = " + get_constant_text(E.value.type, E.value.default_value);
- }
-
- static const char *hint_name[SL::ShaderNode::Uniform::HINT_MAX] = {
- "",
- "color",
- "range",
- "albedo",
- "normal",
- "black",
- "white"
- };
-
- if (E.value.hint) {
- ucode += " : " + String(hint_name[E.value.hint]);
+ static const char *hint_name[SL::ShaderNode::Uniform::HINT_MAX] = {
+ "",
+ "color",
+ "range",
+ "albedo",
+ "normal",
+ "black",
+ "white"
+ };
+
+ if (E.value.hint) {
+ ucode += " : " + String(hint_name[E.value.hint]);
+ }
}
code += ucode + "\n";