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.