diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-02 13:40:24 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-03 16:36:20 +0300 |
commit | fadb6f34662fb60e1a48c2c053c500f017206f27 (patch) | |
tree | 48c16c2215e7110e00b4255f6230aa3491d94ee0 /intern/cycles/util | |
parent | 08a44d29815f6b0b9b675a503829d2e2ce7f6426 (diff) |
Cleanup: refactor Cycles OSL texture handling
This adds our own OSL texture handle, that has info for OIIO textures or our
own custom texture types. A filename to handle hash map is used for lookups.
This is efficient because it happens at OSL compile time, because the optimizer
can figure out constant strings and replace them with texture handles.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_aligned_malloc.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/intern/cycles/util/util_aligned_malloc.h b/intern/cycles/util/util_aligned_malloc.h index 0f006e95f6a..a76884b20a5 100644 --- a/intern/cycles/util/util_aligned_malloc.h +++ b/intern/cycles/util/util_aligned_malloc.h @@ -30,6 +30,13 @@ void *util_aligned_malloc(size_t size, int alignment); /* Free memory allocated by util_aligned_malloc. */ void util_aligned_free(void *ptr); +/* Aligned new operator. */ +template<typename T> T *util_aligned_new() +{ + void *mem = util_aligned_malloc(sizeof(T), alignof(T)); + return new (mem) T(); +} + CCL_NAMESPACE_END #endif /* __UTIL_ALIGNED_MALLOC_H__ */ |