diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-10-20 17:11:45 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-10-20 17:11:45 +0400 |
commit | d36dc6d8de44194df9053c6c9c3f7842a8394067 (patch) | |
tree | add53578a021411009cde01ba7a8509bcbce79fd /intern/cycles/kernel/svm/svm.h | |
parent | cf7dec94fe96b5905f4c543820c6ad4e27fc7451 (diff) |
Integer socket support in Cycles. Int values are already supported natively in OSL, but were not used as actual ints on the SVM stack. This patch implements all the necessary functionality to support reading input values from RNA properties and convert between SHADER_SOCKET_INT and other types.
Diffstat (limited to 'intern/cycles/kernel/svm/svm.h')
-rw-r--r-- | intern/cycles/kernel/svm/svm.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h index 421eb146f88..698ef5016f0 100644 --- a/intern/cycles/kernel/svm/svm.h +++ b/intern/cycles/kernel/svm/svm.h @@ -82,6 +82,25 @@ __device_inline void stack_store_float(float *stack, uint a, float f) stack[a] = f; } +__device_inline int stack_load_int(float *stack, uint a) +{ + kernel_assert(a < SVM_STACK_SIZE); + + return __float_as_int(stack[a]); +} + +__device_inline float stack_load_int_default(float *stack, uint a, uint value) +{ + return (a == (uint)SVM_STACK_INVALID)? (int)value: stack_load_int(stack, a); +} + +__device_inline void stack_store_int(float *stack, uint a, int i) +{ + kernel_assert(a < SVM_STACK_SIZE); + + stack[a] = __int_as_float(i); +} + __device_inline bool stack_valid(uint a) { return a != (uint)SVM_STACK_INVALID; |