Fix T53270: crash with multiscatter GGX after recent refactoring.

In fact this was an existing issue when exceeding the number of available
closure, but it's more common now that we set the number to 0 for shadows
and emission
This commit is contained in:
Brecht Van Lommel
2017-11-08 21:58:17 +01:00
parent 1ffa01b6f8
commit 21a535840d
3 changed files with 216 additions and 170 deletions

View File

@@ -45,7 +45,7 @@ ccl_device ccl_addr_space void *closure_alloc_extra(ShaderData *sd, int size)
int num_extra = ((size + sizeof(ShaderClosure) - 1) / sizeof(ShaderClosure));
if(num_extra > sd->num_closure_left) {
/* Remove previous closure. */
/* Remove previous closure if it was allocated. */
sd->num_closure--;
sd->num_closure_left++;
return NULL;