Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/svm/svm_tex_coord.h
| Show All 16 Lines | |||||
| #include "kernel/geom/geom.h" | #include "kernel/geom/geom.h" | ||||
| #include "kernel/kernel_camera.h" | #include "kernel/kernel_camera.h" | ||||
| #include "kernel/kernel_montecarlo.h" | #include "kernel/kernel_montecarlo.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| /* Texture Coordinate Node */ | /* Texture Coordinate Node */ | ||||
| ccl_device_noinline int svm_node_tex_coord( | ccl_device_noinline int svm_node_tex_coord(ccl_global const KernelGlobals *kg, | ||||
| const KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint4 node, int offset) | ccl_private ShaderData *sd, | ||||
| int path_flag, | |||||
| ccl_private float *stack, | |||||
| uint4 node, | |||||
| int offset) | |||||
| { | { | ||||
| float3 data; | float3 data; | ||||
| uint type = node.y; | uint type = node.y; | ||||
| uint out_offset = node.z; | uint out_offset = node.z; | ||||
| switch (type) { | switch (type) { | ||||
| case NODE_TEXCO_OBJECT: { | case NODE_TEXCO_OBJECT: { | ||||
| data = sd->P; | data = sd->P; | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | #endif | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| stack_store_float3(stack, out_offset, data); | stack_store_float3(stack, out_offset, data); | ||||
| return offset; | return offset; | ||||
| } | } | ||||
| ccl_device_noinline int svm_node_tex_coord_bump_dx( | ccl_device_noinline int svm_node_tex_coord_bump_dx(ccl_global const KernelGlobals *kg, | ||||
| const KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint4 node, int offset) | ccl_private ShaderData *sd, | ||||
| int path_flag, | |||||
| ccl_private float *stack, | |||||
| uint4 node, | |||||
| int offset) | |||||
| { | { | ||||
| #ifdef __RAY_DIFFERENTIALS__ | #ifdef __RAY_DIFFERENTIALS__ | ||||
| float3 data; | float3 data; | ||||
| uint type = node.y; | uint type = node.y; | ||||
| uint out_offset = node.z; | uint out_offset = node.z; | ||||
| switch (type) { | switch (type) { | ||||
| case NODE_TEXCO_OBJECT: { | case NODE_TEXCO_OBJECT: { | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | # endif | ||||
| stack_store_float3(stack, out_offset, data); | stack_store_float3(stack, out_offset, data); | ||||
| return offset; | return offset; | ||||
| #else | #else | ||||
| return svm_node_tex_coord(kg, sd, path_flag, stack, node, offset); | return svm_node_tex_coord(kg, sd, path_flag, stack, node, offset); | ||||
| #endif | #endif | ||||
| } | } | ||||
| ccl_device_noinline int svm_node_tex_coord_bump_dy( | ccl_device_noinline int svm_node_tex_coord_bump_dy(ccl_global const KernelGlobals *kg, | ||||
| const KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint4 node, int offset) | ccl_private ShaderData *sd, | ||||
| int path_flag, | |||||
| ccl_private float *stack, | |||||
| uint4 node, | |||||
| int offset) | |||||
| { | { | ||||
| #ifdef __RAY_DIFFERENTIALS__ | #ifdef __RAY_DIFFERENTIALS__ | ||||
| float3 data; | float3 data; | ||||
| uint type = node.y; | uint type = node.y; | ||||
| uint out_offset = node.z; | uint out_offset = node.z; | ||||
| switch (type) { | switch (type) { | ||||
| case NODE_TEXCO_OBJECT: { | case NODE_TEXCO_OBJECT: { | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | # endif | ||||
| stack_store_float3(stack, out_offset, data); | stack_store_float3(stack, out_offset, data); | ||||
| return offset; | return offset; | ||||
| #else | #else | ||||
| return svm_node_tex_coord(kg, sd, path_flag, stack, node, offset); | return svm_node_tex_coord(kg, sd, path_flag, stack, node, offset); | ||||
| #endif | #endif | ||||
| } | } | ||||
| ccl_device_noinline void svm_node_normal_map(const KernelGlobals *kg, | ccl_device_noinline void svm_node_normal_map(ccl_global const KernelGlobals *kg, | ||||
| ShaderData *sd, | ccl_private ShaderData *sd, | ||||
| float *stack, | ccl_private float *stack, | ||||
| uint4 node) | uint4 node) | ||||
| { | { | ||||
| uint color_offset, strength_offset, normal_offset, space; | uint color_offset, strength_offset, normal_offset, space; | ||||
| svm_unpack_node_uchar4(node.y, &color_offset, &strength_offset, &normal_offset, &space); | svm_unpack_node_uchar4(node.y, &color_offset, &strength_offset, &normal_offset, &space); | ||||
| float3 color = stack_load_float3(stack, color_offset); | float3 color = stack_load_float3(stack, color_offset); | ||||
| color = 2.0f * make_float3(color.x - 0.5f, color.y - 0.5f, color.z - 0.5f); | color = 2.0f * make_float3(color.x - 0.5f, color.y - 0.5f, color.z - 0.5f); | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | ccl_device_noinline void svm_node_normal_map(ccl_global const KernelGlobals *kg, | ||||
| if (is_zero(N)) { | if (is_zero(N)) { | ||||
| N = sd->N; | N = sd->N; | ||||
| } | } | ||||
| stack_store_float3(stack, normal_offset, N); | stack_store_float3(stack, normal_offset, N); | ||||
| } | } | ||||
| ccl_device_noinline void svm_node_tangent(const KernelGlobals *kg, | ccl_device_noinline void svm_node_tangent(ccl_global const KernelGlobals *kg, | ||||
| ShaderData *sd, | ccl_private ShaderData *sd, | ||||
| float *stack, | ccl_private float *stack, | ||||
| uint4 node) | uint4 node) | ||||
| { | { | ||||
| uint tangent_offset, direction_type, axis; | uint tangent_offset, direction_type, axis; | ||||
| svm_unpack_node_uchar3(node.y, &tangent_offset, &direction_type, &axis); | svm_unpack_node_uchar3(node.y, &tangent_offset, &direction_type, &axis); | ||||
| float3 tangent; | float3 tangent; | ||||
| float3 attribute_value; | float3 attribute_value; | ||||
| const AttributeDescriptor desc = find_attribute(kg, sd, node.z); | const AttributeDescriptor desc = find_attribute(kg, sd, node.z); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||