Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-10-20 17:11:45 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-10-20 17:11:45 +0400
commitd36dc6d8de44194df9053c6c9c3f7842a8394067 (patch)
treeadd53578a021411009cde01ba7a8509bcbce79fd /intern/cycles/kernel/svm/svm_convert.h
parentcf7dec94fe96b5905f4c543820c6ad4e27fc7451 (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_convert.h')
-rw-r--r--intern/cycles/kernel/svm/svm_convert.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/intern/cycles/kernel/svm/svm_convert.h b/intern/cycles/kernel/svm/svm_convert.h
index 188b0489d9e..f74915a4bc9 100644
--- a/intern/cycles/kernel/svm/svm_convert.h
+++ b/intern/cycles/kernel/svm/svm_convert.h
@@ -23,6 +23,11 @@ CCL_NAMESPACE_BEGIN
__device void svm_node_convert(ShaderData *sd, float *stack, uint type, uint from, uint to)
{
switch(type) {
+ case NODE_CONVERT_FI: {
+ float f = stack_load_float(stack, from);
+ stack_store_int(stack, to, (int)f);
+ break;
+ }
case NODE_CONVERT_FV: {
float f = stack_load_float(stack, from);
stack_store_float3(stack, to, make_float3(f, f, f));
@@ -34,13 +39,34 @@ __device void svm_node_convert(ShaderData *sd, float *stack, uint type, uint fro
stack_store_float(stack, to, g);
break;
}
+ case NODE_CONVERT_CI: {
+ float3 f = stack_load_float3(stack, from);
+ int i = (int)linear_rgb_to_gray(f);
+ stack_store_int(stack, to, i);
+ break;
+ }
case NODE_CONVERT_VF: {
float3 f = stack_load_float3(stack, from);
float g = (f.x + f.y + f.z)*(1.0f/3.0f);
stack_store_float(stack, to, g);
break;
}
-
+ case NODE_CONVERT_VI: {
+ float3 f = stack_load_float3(stack, from);
+ int i = (f.x + f.y + f.z)*(1.0f/3.0f);
+ stack_store_int(stack, to, i);
+ break;
+ }
+ case NODE_CONVERT_IF: {
+ float f = (float)stack_load_int(stack, from);
+ stack_store_float(stack, to, f);
+ break;
+ }
+ case NODE_CONVERT_IV: {
+ float f = (float)stack_load_int(stack, from);
+ stack_store_float3(stack, to, make_float3(f, f, f));
+ break;
+ }
}
}