GLES2 Batching - prevent baking on VERTEX use in a shader
Using the operator += in a shader is classified as an 'assign', and so is classified as a write rather than a read. This means that we need to prevent vertex baking on either a write or read (i.e. on usage), rather than just on reads.
This commit is contained in:
parent
ae59e22cdd
commit
a4bd66f854
|
@ -1426,7 +1426,7 @@ void RasterizerStorageGLES2::_update_shader(Shader *p_shader) const {
|
||||||
p_shader->canvas_item.uses_time = false;
|
p_shader->canvas_item.uses_time = false;
|
||||||
p_shader->canvas_item.uses_modulate = false;
|
p_shader->canvas_item.uses_modulate = false;
|
||||||
p_shader->canvas_item.uses_color = false;
|
p_shader->canvas_item.uses_color = false;
|
||||||
p_shader->canvas_item.reads_vertex = false;
|
p_shader->canvas_item.uses_vertex = false;
|
||||||
p_shader->canvas_item.batch_flags = 0;
|
p_shader->canvas_item.batch_flags = 0;
|
||||||
|
|
||||||
shaders.actions_canvas.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_ADD);
|
shaders.actions_canvas.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_ADD);
|
||||||
|
@ -1444,8 +1444,7 @@ void RasterizerStorageGLES2::_update_shader(Shader *p_shader) const {
|
||||||
shaders.actions_canvas.usage_flag_pointers["TIME"] = &p_shader->canvas_item.uses_time;
|
shaders.actions_canvas.usage_flag_pointers["TIME"] = &p_shader->canvas_item.uses_time;
|
||||||
shaders.actions_canvas.usage_flag_pointers["MODULATE"] = &p_shader->canvas_item.uses_modulate;
|
shaders.actions_canvas.usage_flag_pointers["MODULATE"] = &p_shader->canvas_item.uses_modulate;
|
||||||
shaders.actions_canvas.usage_flag_pointers["COLOR"] = &p_shader->canvas_item.uses_color;
|
shaders.actions_canvas.usage_flag_pointers["COLOR"] = &p_shader->canvas_item.uses_color;
|
||||||
|
shaders.actions_canvas.usage_flag_pointers["VERTEX"] = &p_shader->canvas_item.uses_vertex;
|
||||||
shaders.actions_canvas.read_flag_pointers["VERTEX"] = &p_shader->canvas_item.reads_vertex;
|
|
||||||
|
|
||||||
actions = &shaders.actions_canvas;
|
actions = &shaders.actions_canvas;
|
||||||
actions->uniforms = &p_shader->uniforms;
|
actions->uniforms = &p_shader->uniforms;
|
||||||
|
@ -1538,7 +1537,7 @@ void RasterizerStorageGLES2::_update_shader(Shader *p_shader) const {
|
||||||
if (p_shader->canvas_item.uses_modulate | p_shader->canvas_item.uses_color) {
|
if (p_shader->canvas_item.uses_modulate | p_shader->canvas_item.uses_color) {
|
||||||
p_shader->canvas_item.batch_flags |= Shader::CanvasItem::PREVENT_COLOR_BAKING;
|
p_shader->canvas_item.batch_flags |= Shader::CanvasItem::PREVENT_COLOR_BAKING;
|
||||||
}
|
}
|
||||||
if (p_shader->canvas_item.reads_vertex) {
|
if (p_shader->canvas_item.uses_vertex) {
|
||||||
p_shader->canvas_item.batch_flags |= Shader::CanvasItem::PREVENT_VERTEX_BAKING;
|
p_shader->canvas_item.batch_flags |= Shader::CanvasItem::PREVENT_VERTEX_BAKING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,7 +461,7 @@ public:
|
||||||
bool uses_time;
|
bool uses_time;
|
||||||
bool uses_modulate;
|
bool uses_modulate;
|
||||||
bool uses_color;
|
bool uses_color;
|
||||||
bool reads_vertex;
|
bool uses_vertex;
|
||||||
|
|
||||||
} canvas_item;
|
} canvas_item;
|
||||||
|
|
||||||
|
|
|
@ -486,10 +486,6 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
|
||||||
*p_actions.write_flag_pointers[var_node->name] = true;
|
*p_actions.write_flag_pointers[var_node->name] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p_assigning && p_actions.read_flag_pointers.has(var_node->name)) {
|
|
||||||
*p_actions.read_flag_pointers[var_node->name] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_default_actions.usage_defines.has(var_node->name) && !used_name_defines.has(var_node->name)) {
|
if (p_default_actions.usage_defines.has(var_node->name) && !used_name_defines.has(var_node->name)) {
|
||||||
String define = p_default_actions.usage_defines[var_node->name];
|
String define = p_default_actions.usage_defines[var_node->name];
|
||||||
String node_name = define.substr(1, define.length());
|
String node_name = define.substr(1, define.length());
|
||||||
|
|
|
@ -44,7 +44,6 @@ public:
|
||||||
Map<StringName, Pair<int *, int> > render_mode_values;
|
Map<StringName, Pair<int *, int> > render_mode_values;
|
||||||
Map<StringName, bool *> render_mode_flags;
|
Map<StringName, bool *> render_mode_flags;
|
||||||
Map<StringName, bool *> usage_flag_pointers;
|
Map<StringName, bool *> usage_flag_pointers;
|
||||||
Map<StringName, bool *> read_flag_pointers;
|
|
||||||
Map<StringName, bool *> write_flag_pointers;
|
Map<StringName, bool *> write_flag_pointers;
|
||||||
|
|
||||||
Map<StringName, ShaderLanguage::ShaderNode::Uniform> *uniforms;
|
Map<StringName, ShaderLanguage::ShaderNode::Uniform> *uniforms;
|
||||||
|
|
Loading…
Reference in New Issue