diff options
author | clayjohn <claynjohn@gmail.com> | 2023-02-08 12:37:20 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2023-02-08 12:56:15 -0800 |
commit | 04a9933f2e877e7212d1a54a893d90677ec096ca (patch) | |
tree | e667eb3c90faec68658e4257be2e1cd4db4d0735 /scene/resources | |
parent | ccd4caa3de9e89376f339aa76219941d1c83a482 (diff) |
Mark fma function as high end so it isn't used with the gl_compatibility renderer
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/visual_shader_nodes.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 0695492e7f..7550f598f8 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -3349,10 +3349,10 @@ String VisualShaderNodeUVFunc::generate_code(Shader::Mode p_mode, VisualShader:: switch (func) { case FUNC_PANNING: { - code += vformat(" %s = fma(%s, %s, %s);\n", p_output_vars[0], offset_pivot, scale, uv); + code += vformat(" %s = %s * %s + %s;\n", p_output_vars[0], offset_pivot, scale, uv); } break; case FUNC_SCALING: { - code += vformat(" %s = fma((%s - %s), %s, %s);\n", p_output_vars[0], uv, offset_pivot, scale, offset_pivot); + code += vformat(" %s = (%s - %s) * %s + %s;\n", p_output_vars[0], uv, offset_pivot, scale, offset_pivot); } break; default: break; @@ -7482,6 +7482,9 @@ String VisualShaderNodeMultiplyAdd::get_output_port_name(int p_port) const { } String VisualShaderNodeMultiplyAdd::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + return " " + p_output_vars[0] + " = (" + p_input_vars[0] + " * " + p_input_vars[1] + ") + " + p_input_vars[2] + ";\n"; + } return " " + p_output_vars[0] + " = fma(" + p_input_vars[0] + ", " + p_input_vars[1] + ", " + p_input_vars[2] + ");\n"; } |