[Bf-cycles] MAX_CLOSURE limit

Thomas Dinges blender at dingto.org
Tue Jul 30 11:36:47 CEST 2013

Increased the maximum to 64 now, couldn't find a noticeable performance 
problem after doing that on CPU and GPU. More tests are welcome though.


Am 30.07.2013 02:05, schrieb Thomas Dinges:
> That is not possible, as it's used as an array size in the code.
> ShaderClosure closure[MAX_CLOSURE];
> Brecht, I will run some tests and increase to probably 64 if that
> doesn't cause performance problems. (32 was still too low for that
> example file).
> Am 30.07.2013 01:54, schrieb Dan McGrath:
>> Hi,
>> Curious, why not just make it a preference option and let the user
>> control it, with the default being something sane?
>> On Mon, Jul 29, 2013 at 7:32 PM, Brecht Van Lommel
>> <brechtvanlommel at pandora.be> wrote:
>>> I think this can be increased. The limit was quite low initially
>>> because increasing it made CUDA render slower, but last time I
>>> increased it there wasn't actually any performance difference, so
>>> probably it can be increased further without problems. Just do a quick
>>> test to confirm that it has no or very minimal impact and then you can
>>> increase the limit.
>>> The extra memory usage is probably not an issue, it's just a few KB
>>> per thread I guess.
>>> On Tue, Jul 30, 2013 at 12:20 AM, Thomas Dinges <blender at dingto.org> wrote:
>>>> Hi Brecht,
>>>> today I got a blend file from a friend, which has a lot of closure nodes
>>>> in one tree.
>>>> It's some kind of dispersion node setup with lots of shaders, about 30
>>>> glass shaders, combined with about 30 add shaders.
>>>> The problem here is, that after some amount of add closures, it just
>>>> ignores more. I checked the code and increased MAX_CLOSURE to 32, which
>>>> then allows Cycles to use more of that tree.
>>>> Maybe this kind of setup can be achieved differently, without using that
>>>> many closures.
>>>> I guess it's a corner case, otherwise we would have gotten bug reports
>>>> about that limit before.
>>>> Anyway, would there be problems with increasing MAX_CLOSURE? As it's
>>>> used for our ShaderClosure struct, probably a higher memory footprint?
>>>> I will check if I can upload the .blend file later, if needed.
>>>> Best regards,
>>>> Thomas
>>>> --
>>>> Thomas Dinges
>>>> Blender Developer, Artist and Musician
>>>> www.dingto.org

Thomas Dinges
Blender Developer, Artist and Musician


More information about the Bf-cycles mailing list