summaryrefslogtreecommitdiff
path: root/servers/rendering/shader_compiler.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2023-05-12 15:08:03 +0200
committerGitHub <noreply@github.com>2023-05-12 15:08:03 +0200
commit2ac4e3bb30517998916bb6b81b7b76788276038c (patch)
tree245bf4614ff38f3b0fcac813c1dde8c39b57732d /servers/rendering/shader_compiler.cpp
parentfdf66b3472e5ca254a4f90c32f26c4702d46828b (diff)
parentfa8b32cbd4503e73a840bd1a1dd32d2a88cc3f45 (diff)
Merge pull request #76998 from akien-mga/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.3) - 4th batch
Diffstat (limited to 'servers/rendering/shader_compiler.cpp')
-rw-r--r--servers/rendering/shader_compiler.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp
index 8737d3b217..1f889572df 100644
--- a/servers/rendering/shader_compiler.cpp
+++ b/servers/rendering/shader_compiler.cpp
@@ -441,7 +441,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
String code;
switch (p_node->type) {
- case SL::Node::TYPE_SHADER: {
+ case SL::Node::NODE_TYPE_SHADER: {
SL::ShaderNode *pnode = (SL::ShaderNode *)p_node;
for (int i = 0; i < pnode->render_modes.size(); i++) {
@@ -786,11 +786,11 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
//code+=dump_node_code(pnode->body,p_level);
} break;
- case SL::Node::TYPE_STRUCT: {
+ case SL::Node::NODE_TYPE_STRUCT: {
} break;
- case SL::Node::TYPE_FUNCTION: {
+ case SL::Node::NODE_TYPE_FUNCTION: {
} break;
- case SL::Node::TYPE_BLOCK: {
+ case SL::Node::NODE_TYPE_BLOCK: {
SL::BlockNode *bnode = (SL::BlockNode *)p_node;
//variables
@@ -801,7 +801,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
for (int i = 0; i < bnode->statements.size(); i++) {
String scode = _dump_node_code(bnode->statements[i], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
- if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement) {
+ if (bnode->statements[i]->type == SL::Node::NODE_TYPE_CONTROL_FLOW || bnode->single_statement) {
code += scode; //use directly
if (bnode->use_comma_between_statements && i + 1 < bnode->statements.size()) {
code += ",";
@@ -815,7 +815,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
} break;
- case SL::Node::TYPE_VARIABLE_DECLARATION: {
+ case SL::Node::NODE_TYPE_VARIABLE_DECLARATION: {
SL::VariableDeclarationNode *vdnode = (SL::VariableDeclarationNode *)p_node;
String declaration;
@@ -873,7 +873,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
code += declaration;
} break;
- case SL::Node::TYPE_VARIABLE: {
+ case SL::Node::NODE_TYPE_VARIABLE: {
SL::VariableNode *vnode = (SL::VariableNode *)p_node;
bool use_fragment_varying = false;
@@ -966,7 +966,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
} break;
- case SL::Node::TYPE_ARRAY_CONSTRUCT: {
+ case SL::Node::NODE_TYPE_ARRAY_CONSTRUCT: {
SL::ArrayConstructNode *acnode = (SL::ArrayConstructNode *)p_node;
int sz = acnode->initializer.size();
if (acnode->datatype == SL::TYPE_STRUCT) {
@@ -986,7 +986,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
code += ")";
} break;
- case SL::Node::TYPE_ARRAY: {
+ case SL::Node::NODE_TYPE_ARRAY: {
SL::ArrayNode *anode = (SL::ArrayNode *)p_node;
bool use_fragment_varying = false;
@@ -1077,7 +1077,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
} break;
- case SL::Node::TYPE_CONSTANT: {
+ case SL::Node::NODE_TYPE_CONSTANT: {
SL::ConstantNode *cnode = (SL::ConstantNode *)p_node;
if (cnode->array_size == 0) {
@@ -1104,7 +1104,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
} break;
- case SL::Node::TYPE_OPERATOR: {
+ case SL::Node::NODE_TYPE_OPERATOR: {
SL::OperatorNode *onode = (SL::OperatorNode *)p_node;
switch (onode->op) {
@@ -1135,7 +1135,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
case SL::OP_CALL:
case SL::OP_STRUCT:
case SL::OP_CONSTRUCT: {
- ERR_FAIL_COND_V(onode->arguments[0]->type != SL::Node::TYPE_VARIABLE, String());
+ ERR_FAIL_COND_V(onode->arguments[0]->type != SL::Node::NODE_TYPE_VARIABLE, String());
const SL::VariableNode *vnode = static_cast<const SL::VariableNode *>(onode->arguments[0]);
const SL::FunctionNode *func = nullptr;
const bool is_internal_func = internal_functions.has(vnode->name);
@@ -1205,12 +1205,12 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
bool done = false;
do {
switch (node->type) {
- case SL::Node::TYPE_VARIABLE: {
+ case SL::Node::NODE_TYPE_VARIABLE: {
name = static_cast<const SL::VariableNode *>(node)->name;
done = true;
found = true;
} break;
- case SL::Node::TYPE_MEMBER: {
+ case SL::Node::NODE_TYPE_MEMBER: {
node = static_cast<const SL::MemberNode *>(node)->owner;
} break;
default: {
@@ -1232,12 +1232,12 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
bool correct_texture_uniform = false;
switch (onode->arguments[i]->type) {
- case SL::Node::TYPE_VARIABLE: {
+ case SL::Node::NODE_TYPE_VARIABLE: {
const SL::VariableNode *varnode = static_cast<const SL::VariableNode *>(onode->arguments[i]);
texture_uniform = varnode->name;
correct_texture_uniform = true;
} break;
- case SL::Node::TYPE_ARRAY: {
+ case SL::Node::NODE_TYPE_ARRAY: {
const SL::ArrayNode *anode = static_cast<const SL::ArrayNode *>(onode->arguments[i]);
texture_uniform = anode->name;
correct_texture_uniform = true;
@@ -1366,7 +1366,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
} break;
- case SL::Node::TYPE_CONTROL_FLOW: {
+ case SL::Node::NODE_TYPE_CONTROL_FLOW: {
SL::ControlFlowNode *cfnode = (SL::ControlFlowNode *)p_node;
if (cfnode->flow_op == SL::FLOW_OP_IF) {
code += _mktab(p_level) + "if (" + _dump_node_code(cfnode->expressions[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + ")\n";
@@ -1418,7 +1418,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
}
} break;
- case SL::Node::TYPE_MEMBER: {
+ case SL::Node::NODE_TYPE_MEMBER: {
SL::MemberNode *mnode = (SL::MemberNode *)p_node;
code = _dump_node_code(mnode->owner, p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + "." + mnode->name;
if (mnode->index_expression != nullptr) {