Cycles: fix issue with mix shaders, leading to use of uninitialized memory.

This commit is contained in:
Brecht Van Lommel
2011-09-16 13:00:09 +00:00
parent 376aede7a6
commit 0a5fcf3da3
2 changed files with 32 additions and 0 deletions

View File

@@ -78,6 +78,27 @@ public:
protected:
struct Stack {
Stack() { memset(users, 0, sizeof(users)); }
Stack(const Stack& other) { memcpy(users, other.users, sizeof(users)); }
Stack& operator=(const Stack& other) { memcpy(users, other.users, sizeof(users)); return *this; }
bool empty()
{
for(int i = 0; i < SVM_STACK_SIZE; i++)
if(users[i])
return false;
return true;
}
void print()
{
printf("stack <");
for(int i = 0; i < SVM_STACK_SIZE; i++)
printf((users[i])? "*": " ");
printf(">\n");
}
int users[SVM_STACK_SIZE];
};