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:
authorDalai Felinto <dfelinto@gmail.com>2017-09-05 17:33:08 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-09-05 17:40:27 +0300
commit518e7685790f28789bbe795f370ee3b1a5f776c6 (patch)
tree0e578f7f491c77174653b1ace70f002632cf1b4a /source/blender/gpu/shaders
parentbffa57e6d83d157cb81a631a92cd20e7958a69a4 (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/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index b205c90cc79..b060031c27f 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2861,6 +2861,14 @@ void node_bsdf_principled_clearcoat(vec4 base_color, float subsurface, vec3 subs
float clearcoat_roughness, float ior, float transmission, float transmission_roughness, vec3 N, vec3 CN, vec3 T, vec3 I, float ssr_id, out Closure result)
{
#ifdef EEVEE_ENGINE
+ if (clearcoat == 0.0) {
+ node_bsdf_principled_simple(
+ base_color, subsurface, subsurface_radius, subsurface_color, metallic, specular,
+ specular_tint, roughness, anisotropic, anisotropic_rotation, sheen, sheen_tint, clearcoat,
+ clearcoat_roughness, ior, transmission, transmission_roughness, N, CN, T, I, ssr_id, result);
+ return;
+ }
+
vec3 diffuse, f0, ssr_spec;
convert_metallic_to_specular_tinted(base_color.rgb, metallic, specular, specular_tint, diffuse, f0);