Page MenuHome

Fix T52441: Principle BSDF clearcoat optimisation bug
ClosedPublic

Authored by Dalai Felinto (dfelinto) on Sep 4 2017, 5:49 PM.

Details

Summary

An alternative would be to remove this optimization altogether, and
always use the node_bsdf_principled_clearcoat shader.

Diff Detail

Repository
rB Blender
Branch
temp-fix-principled-coat
Build Status
Buildable 791
Build 791: arc lint + arc unit

Event Timeline

This is the alternative: P525

Alternative, move "optimization" to glsl shader

This revision is now accepted and ready to land.Sep 4 2017, 7:35 PM
Brecht Van Lommel (brecht) edited edge metadata.EditedSep 4 2017, 7:49 PM

So you confirmed that this fixes the slowdown? If so seems fine to me.

Also I think you accidentally added the wrong reviewer.

So you confirmed that this fixes the slowdown? If so seems fine to me

Which slowdown are you referring to?

The issue I tackled (T52441) is that to implement the optimization (i.e., use principled_simple instead of principled_clearcoat) in the C side, we would need to force shader recompilation every time the clearcoat value changed from 0.0 to anything else, and vice-versa.

Adding branching in glsl is far from ideal, but in Linux NVidia and AMD - testing with Clt+Alt+D 23 + Alt+A: "Material Shader Pass" - I got similar numbers for clearcoat 0.0, and 1.0, with and without the patch. @Clément Foucault (fclem) got some worse results in his system, but I suspect the issue is with the lack of a better shader profiling system.

Note: to try this without the patch you need to force shader recompilation after you change clearcoar from/to 0.0.

For me this seems to be an acceptable workaround although branching might not be that performant.

I was referring to the 2.22ms -> 2.84ms slowdown mentioned in the report. I was just wondering if that's entirely solved or if it's somewhere in between.

Branching by itself isn't necessarily slow, I mainly would expect additional uniforms or extra register pressure from a more complex shader to have an impact. But if you confirmed it's solved then that's fine of course.

This revision was automatically updated to reflect the committed changes.