That was a nice and funny hunt, albeit rather time consumming!
To summarize, so far code was using a static global gpu_buffer for pbvh vbo drawing
of 'grid' types (multires mostly?).
There were two issues here:
1) Global gpu buffer was assigned to GPU_PBVH_Buffers->index_buf, but then nearly no
check was done when freeing that buffer, to ensure we were not freeing the global one
(not totally sure this one was actually causing any issue, but was bad and unsafe anyway).
Was solved by adding a flag to GPU_PBVH_Buffers to indicate when we are using some
'common' buffer here, which freeing is handled separately.
2) Main issue: if several multires objects in sculpt mode with different grid size
were present simultaneously, the global gpu buffer had to be resized for each object draw
(i.e., freed and re-allocated), but then the pbvh nodes from other objects storing freed reference
to that global buffer had no way to know that it had been freed, which was causing the segfault & crash.
Was solved by getting rid of that global buffer, and instead allocating one 'grid_commmon_gpu_buffer' per pbvh.
Told ya baby, globals are *PURE EVIL*!
This seems to be illegal and not productive anyway. Do it ahead of
a time now, which solves shading issues in edit mode and prevents
assert from happening.
Issue here is that for Blender, any pass which name starts with 'Diffuse' is considered
a diffuse pass - and it does not really support several passes of the same type in renderresult.
So for now, passtype_from_name() is now checking whether a pass of same type already exists
in render layers, and return 0 (uknown passtype) in this case.
Some adjustments to how bevel edge 'profiles' are adjusted in some
cases. For the bug fix, wanted to handle cases of middle of three
coplanar beveled cases to make profile curve rather than linear
interpolate.
Also undid an earlier decision to make profile plane be perpendicular
to beveled edge i the non-coplanar case.
- add_vertex() can be called from split_vertex() which does not guarantee
to have properly pre-allocate arrays.
- Need to check whether Cycles is compiled with OSL in XML reader.
A bit tricky, need to pass additional information about what the attribute
is and how to deal with it.
BI path stays unchanged, just to make things simplier for now.
Fixes T48555: Cycles GLSL- Incorrect Vertex Color results from Attribute node
Some of these values can get quite large and are hard to read, adding this
makes it easy to read them at a glance.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D2039
We had transparent shadows disabled for some time because they were causing
drivers to crash. Can't reproduce that issue anymore with current drivers,
so will enable them and see how it goes.