Merge pull request #37462 from Chaosus/shader_fix_const_order

[3.2] Fix shader constant sorting
This commit is contained in:
Rémi Verschelde
2020-04-29 09:41:49 +02:00
committed by GitHub
4 changed files with 15 additions and 10 deletions

View File

@ -5156,6 +5156,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
while (true) {
ShaderNode::Constant constant;
constant.name = name;
constant.type = type;
constant.precision = precision;
constant.initializer = NULL;
@ -5190,6 +5191,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
}
shader->constants[name] = constant;
shader->vconstants.push_back(constant);
if (tk.type == TK_COMMA) {
tk = _get_token();
if (tk.type != TK_IDENTIFIER) {

View File

@ -512,6 +512,7 @@ public:
struct ShaderNode : public Node {
struct Constant {
StringName name;
DataType type;
DataPrecision precision;
ConstantNode *initializer;
@ -577,6 +578,7 @@ public:
Vector<StringName> render_modes;
Vector<Function> functions;
Vector<Constant> vconstants;
ShaderNode() :
Node(TYPE_SHADER) {}