Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2022-02-08 14:12:30 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2022-02-08 14:37:25 +0300
commit460d1a4cb36a6ae222721a9721c627292fdd77ec (patch)
tree67796d16336ac1860f5762c1bea75eba97c156b8 /source/blender/gpu/shaders
parent3267c91b4d5caab7da8aef071a446dd2e86f86a9 (diff)
Eevee: support the no-op Bump node optimization like in Cycles.
A Bump node without a Height input is meaningless and does nothing. As such, it is available as an old workaround that allows making Node Group inputs that default to normal when not connected, by routing via a no-op Bump node before doing math. Cycles specifically recognizes this use case and either bypasses the node, or converts it into a Geometry Normal node, but Eevee was still evaluating it as usual. That incurred performance cost, and also normalized the vector unlike Cycles. This implements the same bypass logic for Eevee. Since I'm not sure if it's possible to totally remove the node at this stage, it emits a no-op function call to copy the input vector. Differential Revision: https://developer.blender.org/D14045
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_math_util.glsl5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_math_util.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_math_util.glsl
index c6203bc36ab..2a98d9fadd0 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_math_util.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_math_util.glsl
@@ -109,6 +109,11 @@ void vector_normalize(vec3 normal, out vec3 outnormal)
outnormal = normalize(normal);
}
+void vector_copy(vec3 normal, out vec3 outnormal)
+{
+ outnormal = normal;
+}
+
/* Matirx Math */
mat3 euler_to_mat3(vec3 euler)