Page MenuHome

Cycles: Don't sync unneccessary attributes for final renders
ClosedPublic

Authored by Lukas Stockner (lukasstockner97) on Oct 9 2016, 2:14 PM.

Details

Summary

Currently, the required attributes aren't updated after shader optimization to avoid repeated re-evaluation of them while tweaking shaders in the viewport.
However, that's not a concern in regular F12 renders, so this commit avoids the unneccessary attributes in that case.

Diff Detail

Repository
rB Blender

Event Timeline

I'm not sure this works? Shaders are compiled after the scene has already been exported, so changing the requested attributes at that point would have no effect.

it works for attributes like uv map and vertex color

test file

optimization for uv tangent / normal map is still missing (:

Lukas Stockner (lukasstockner97) edited edge metadata.

Hm, I looked into this again and it really was the wrong approach...
This is both shorter and actually works as far as I can see.

Seems like a good approach. The downside of this patch is that the simplification is no longer multithreaded. It should be possible to multithreaded BlenderSync::sync_materials though, so that it's even faster than before due to multithreaded Blender material export.

Ah, yes, I forgot to commit that change.
If it's possible to multithread all of sync_materials, that's even better, but I wasn't sure about the Blender-side code...

intern/cycles/blender/blender_shader.cpp
1212

Please bother to do benchmarks on real scenes rather than just wacking threading code into somewhere inside of an inner loop.

Ideally threading should start as early as possible (in this case, export the whole material), otherwise synchronization overhead in the current task scheduler implementation might make things slower than they were before making things threaded.

intern/cycles/render/graph.cpp
212

Why that's needed here for simplified but not for finalized?

Please double-check out testsuite is till passing, otherwise LGTM after more careful and complete dig.

intern/cycles/blender/blender_shader.cpp
1212

Ok, re-read code more carefully. This is pushing the outer loop data. While in theory we can do the whole material sync from thread current code should be good enough already.

1221

IMO safer to always for pool.wait_work(). If there is no work to be done it'll be almost NOOP. ut if we'll be using pool for something else than non-preview tasks it'll save us from possible issues related on missing wait_work.

This revision is now accepted and ready to land.Mar 21 2017, 4:10 PM
This revision was automatically updated to reflect the committed changes.