Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/svm/svm_magic.h
| Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | if (distortion != 0.0f) { | ||||
| x /= distortion; | x /= distortion; | ||||
| y /= distortion; | y /= distortion; | ||||
| z /= distortion; | z /= distortion; | ||||
| } | } | ||||
| return make_float3(0.5f - x, 0.5f - y, 0.5f - z); | return make_float3(0.5f - x, 0.5f - y, 0.5f - z); | ||||
| } | } | ||||
| ccl_device void svm_node_tex_magic( | ccl_device_noinline int svm_node_tex_magic( | ||||
| KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset) | const KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int offset) | ||||
| { | { | ||||
| uint depth; | uint depth; | ||||
| uint scale_offset, distortion_offset, co_offset, fac_offset, color_offset; | uint scale_offset, distortion_offset, co_offset, fac_offset, color_offset; | ||||
| svm_unpack_node_uchar3(node.y, &depth, &color_offset, &fac_offset); | svm_unpack_node_uchar3(node.y, &depth, &color_offset, &fac_offset); | ||||
| svm_unpack_node_uchar3(node.z, &co_offset, &scale_offset, &distortion_offset); | svm_unpack_node_uchar3(node.z, &co_offset, &scale_offset, &distortion_offset); | ||||
| uint4 node2 = read_node(kg, offset); | uint4 node2 = read_node(kg, &offset); | ||||
| float3 co = stack_load_float3(stack, co_offset); | float3 co = stack_load_float3(stack, co_offset); | ||||
| float scale = stack_load_float_default(stack, scale_offset, node2.x); | float scale = stack_load_float_default(stack, scale_offset, node2.x); | ||||
| float distortion = stack_load_float_default(stack, distortion_offset, node2.y); | float distortion = stack_load_float_default(stack, distortion_offset, node2.y); | ||||
| float3 color = svm_magic(co * scale, depth, distortion); | float3 color = svm_magic(co * scale, depth, distortion); | ||||
| if (stack_valid(fac_offset)) | if (stack_valid(fac_offset)) | ||||
| stack_store_float(stack, fac_offset, average(color)); | stack_store_float(stack, fac_offset, average(color)); | ||||
| if (stack_valid(color_offset)) | if (stack_valid(color_offset)) | ||||
| stack_store_float3(stack, color_offset, color); | stack_store_float3(stack, color_offset, color); | ||||
| return offset; | |||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||