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:
authorClément Foucault <foucault.clem@gmail.com>2019-03-22 05:53:13 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-03-22 05:53:21 +0300
commitc49a70bcd113904b239079413e32fc1228776967 (patch)
treed94b9f28d6d0cdf90aec84d0261af2cd537be3f3 /source/blender/nodes
parent875b50f94f993eabcd03e3c4485ba3a4b0990df8 (diff)
Eevee: Add small optimisation for Curve Mapping nodes
This remove the RGB texture lookups if the curve is only used for "Luma" correction and does not affect individual RGB channels.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index f57d1bfbc9e..2b4c3581fc0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -115,6 +115,7 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UN
{
float *array, layer;
int size;
+ bool use_opti = true;
CurveMapping *cumap = node->storage;
@@ -139,15 +140,38 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UN
ext_rgba[a][1] = 0.0f;
ext_rgba[a][3] = 0.0f;
}
+
+ /* Check if rgb comps are just linear. */
+ if (a < 3) {
+ if (range_rgba[a] != 1.0f ||
+ ext_rgba[a][1] != 1.0f ||
+ ext_rgba[a][2] != 1.0f ||
+ cm->totpoint != 2 ||
+ cm->curve[0].x != 0.0f ||
+ cm->curve[0].y != 0.0f ||
+ cm->curve[1].x != 1.0f ||
+ cm->curve[1].y != 1.0f)
+ {
+ use_opti = false;
+ }
+ }
}
- return GPU_stack_link(mat, node, "curves_rgb", in, out, tex,
- GPU_constant(&layer),
- GPU_uniform(range_rgba),
- GPU_uniform(ext_rgba[0]),
- GPU_uniform(ext_rgba[1]),
- GPU_uniform(ext_rgba[2]),
- GPU_uniform(ext_rgba[3]));
+ if (use_opti) {
+ return GPU_stack_link(mat, node, "curves_rgb_opti", in, out, tex,
+ GPU_constant(&layer),
+ GPU_uniform(range_rgba),
+ GPU_uniform(ext_rgba[3]));
+ }
+ else {
+ return GPU_stack_link(mat, node, "curves_rgb", in, out, tex,
+ GPU_constant(&layer),
+ GPU_uniform(range_rgba),
+ GPU_uniform(ext_rgba[0]),
+ GPU_uniform(ext_rgba[1]),
+ GPU_uniform(ext_rgba[2]),
+ GPU_uniform(ext_rgba[3]));
+ }
}
void register_node_type_sh_curve_rgb(void)