Other solution is to just size the array to the actual size of the allocation minus header size.
I actually prefer this solution. It also has the advantage of making size checks easier.
This was not supposed to be included here. We can make a separate PR for printing times.
I think the code is doing "the right thing", but you're right that the naming is quite misleading. Does this look better? https://projects.blender.org/blender/blender/commit/efe3ae226a85a7806804215…
We early exit in batch_compile
before creating the subprocess:
size_t required_size = offsetof(ShaderSourceHeader, source_start) + item.sources.size();
item.do_async_compilation =…
I gave it a try but I ended up reverting it.
next_src += BLI_strncpy_rlen(next_src, src.c_str(), src.size() + 1) + 1;
It may be the right choice if the code needed actual concats, but here we…
I didn't know this idiom. It's kind of weid because it goes against the standard. Most compilers seem to support it but may still warn about its use.
C99 standardized char source_start []
…