diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-21 19:55:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-04-06 17:22:17 +0300 |
commit | b5f58c1ad9b19f3fe7ee06a4ab5ec5498dfc0652 (patch) | |
tree | 54db8c7e24bdfa585e849ede412be4ac86c5702b /intern/cycles/render/shader.h | |
parent | 36f352a4e45202a6a45aa608ee083f30a4db2c81 (diff) |
Cycles: Experiment with making previews more interactive
There were two major problems with the interactivity of material previews:
- Beckmann tables were re-generated on every material tweak.
This is because preview scene is not set to be persistent, so re-triggering
the render leads to the full scene re-sync.
- Images could take rather noticeable time to load with OIIO from the disk
on every tweak.
This patch addressed this two issues in the following way:
- Beckmann tables are now static on CPU memory.
They're couple of hundred kilobytes only, so wouldn't expect this to be
an issue. And they're needed for almost every render anyway.
This actually also makes blackbody table to be static, but it's even smaller
than beckmann table.
Not totally happy with this approach, but others seems to complicate things
quite a bit with all this render engine life time and so..
- For preview rendering all images are considered to be built-in. This means
instead of OIIO which re-loads images on every re-render they're coming
from ImBuf cache which is fully manageable from blender side and unused
images gets freed later.
This would make it impossible to have mipmapping with OSL for now, but we'll
be working on that later anyway and don't think mipmaps are really so crucial
for the material preview.
This seems to be a better alternative to making preview scene persistent,
because of much optimal memory control from blender side.
Reviewers: brecht, juicyfruit, campbellbarton, dingto
Subscribers: eyecandy, venomgfx
Differential Revision: https://developer.blender.org/D1132
Diffstat (limited to 'intern/cycles/render/shader.h')
-rw-r--r-- | intern/cycles/render/shader.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h index 1dee47c7731..a1d697a7b7b 100644 --- a/intern/cycles/render/shader.h +++ b/intern/cycles/render/shader.h @@ -36,6 +36,7 @@ #include "util_map.h" #include "util_param.h" #include "util_string.h" +#include "util_thread.h" #include "util_types.h" CCL_NAMESPACE_BEGIN @@ -171,8 +172,9 @@ protected: typedef unordered_map<ustring, uint, ustringHash> AttributeIDMap; AttributeIDMap unique_attribute_id; - vector<float> blackbody_table; - vector<float> beckmann_table; + thread_mutex lookup_table_mutex; + static vector<float> blackbody_table; + static vector<float> beckmann_table; size_t blackbody_table_offset; size_t beckmann_table_offset; |