diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-09-05 17:33:08 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-09-05 17:40:27 +0300 |
commit | 518e7685790f28789bbe795f370ee3b1a5f776c6 (patch) | |
tree | 0e578f7f491c77174653b1ace70f002632cf1b4a /source/blender/nodes | |
parent | bffa57e6d83d157cb81a631a92cd20e7958a69a4 (diff) |
Fix T52441: Principle BSDF clearcoat
Since the change to prevent shader recompilation at every update, we got
a regression when clearcoat was used.
Basically at the shader build time we would determine if the shader
needed clear coat, and if it didin't, it would build a different GLSL
program.
However if later the user updated the clearcoat value so that it would
then require the full clearcoat shader, the user wouldn't get it until
manually forcing the shader to recompile, or reopening the file.
We now handle the optimization in the GLSL code. That adds a minimum
overhead due to branching. But the overall performance seems unchanged
(tested on linux in AMD and NVidia).
Reviewers: pascal, brecht, fclem
Differential Revision: https://developer.blender.org/D2822
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c index 1ec77bc9189..29a6d062947 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c @@ -98,13 +98,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeE &in[19].link); } - /* Only use complex versions when needed. */ - if (!in[12].link && (in[12].vec[0] == 0.0f)) { - return GPU_stack_link(mat, node, "node_bsdf_principled_simple", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&node->ssr_id)); - } - else { - return GPU_stack_link(mat, node, "node_bsdf_principled_clearcoat", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&node->ssr_id)); - } + return GPU_stack_link(mat, node, "node_bsdf_principled_clearcoat", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&node->ssr_id)); } static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node) |