diff options
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 2 | ||||
-rw-r--r-- | drivers/gles2/shaders/stdlib.glsl | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index a5e85424b7..1e30f0dfa1 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -1016,6 +1016,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { actions[RS::SHADER_CANVAS_ITEM].usage_defines["isinf"] = "#define IS_INF_USED\n"; actions[RS::SHADER_CANVAS_ITEM].usage_defines["isnan"] = "#define IS_NAN_USED\n"; actions[RS::SHADER_CANVAS_ITEM].usage_defines["trunc"] = "#define TRUNC_USED\n"; + actions[RS::SHADER_CANVAS_ITEM].usage_defines["fma"] = "#define FMA_USED\n"; /** SPATIAL SHADER **/ @@ -1126,6 +1127,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { actions[RS::SHADER_SPATIAL].usage_defines["isinf"] = "#define IS_INF_USED\n"; actions[RS::SHADER_SPATIAL].usage_defines["isnan"] = "#define IS_NAN_USED\n"; actions[RS::SHADER_SPATIAL].usage_defines["trunc"] = "#define TRUNC_USED\n"; + actions[RS::SHADER_SPATIAL].usage_defines["fma"] = "#define FMA_USED\n"; actions[RS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n"; actions[RS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n"; diff --git a/drivers/gles2/shaders/stdlib.glsl b/drivers/gles2/shaders/stdlib.glsl index 9c74418743..807036dda6 100644 --- a/drivers/gles2/shaders/stdlib.glsl +++ b/drivers/gles2/shaders/stdlib.glsl @@ -417,4 +417,24 @@ highp mat4 outerProduct(highp vec4 c, highp vec4 r) { #endif +#if defined(FMA_USED) + +highp float fma(highp float a, highp float b, highp float c) { + return a * b + c; +} + +highp vec2 fma(highp vec2 a, highp vec2 b, highp vec2 c) { + return a * b + c; +} + +highp vec3 fma(highp vec3 a, highp vec3 b, highp vec3 c) { + return a * b + c; +} + +highp vec4 fma(highp vec4 a, highp vec4 b, highp vec4 c) { + return a * b + c; +} + +#endif + #endif |