Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/svm/svm_fresnel.h
| Show All 12 Lines | |||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| /* Fresnel Node */ | /* Fresnel Node */ | ||||
| ccl_device void svm_node_fresnel( | ccl_device_noinline void svm_node_fresnel( | ||||
| ShaderData *sd, float *stack, uint ior_offset, uint ior_value, uint node) | ShaderData *sd, float *stack, uint ior_offset, uint ior_value, uint node) | ||||
| { | { | ||||
| uint normal_offset, out_offset; | uint normal_offset, out_offset; | ||||
| svm_unpack_node_uchar2(node, &normal_offset, &out_offset); | svm_unpack_node_uchar2(node, &normal_offset, &out_offset); | ||||
| float eta = (stack_valid(ior_offset)) ? stack_load_float(stack, ior_offset) : | float eta = (stack_valid(ior_offset)) ? stack_load_float(stack, ior_offset) : | ||||
| __uint_as_float(ior_value); | __uint_as_float(ior_value); | ||||
| float3 normal_in = stack_valid(normal_offset) ? stack_load_float3(stack, normal_offset) : sd->N; | float3 normal_in = stack_valid(normal_offset) ? stack_load_float3(stack, normal_offset) : sd->N; | ||||
| eta = fmaxf(eta, 1e-5f); | eta = fmaxf(eta, 1e-5f); | ||||
| eta = (sd->flag & SD_BACKFACING) ? 1.0f / eta : eta; | eta = (sd->flag & SD_BACKFACING) ? 1.0f / eta : eta; | ||||
| float f = fresnel_dielectric_cos(dot(sd->I, normal_in), eta); | float f = fresnel_dielectric_cos(dot(sd->I, normal_in), eta); | ||||
| stack_store_float(stack, out_offset, f); | stack_store_float(stack, out_offset, f); | ||||
| } | } | ||||
| /* Layer Weight Node */ | /* Layer Weight Node */ | ||||
| ccl_device void svm_node_layer_weight(ShaderData *sd, float *stack, uint4 node) | ccl_device_noinline void svm_node_layer_weight(ShaderData *sd, float *stack, uint4 node) | ||||
| { | { | ||||
| uint blend_offset = node.y; | uint blend_offset = node.y; | ||||
| uint blend_value = node.z; | uint blend_value = node.z; | ||||
| uint type, normal_offset, out_offset; | uint type, normal_offset, out_offset; | ||||
| svm_unpack_node_uchar3(node.w, &type, &normal_offset, &out_offset); | svm_unpack_node_uchar3(node.w, &type, &normal_offset, &out_offset); | ||||
| float blend = (stack_valid(blend_offset)) ? stack_load_float(stack, blend_offset) : | float blend = (stack_valid(blend_offset)) ? stack_load_float(stack, blend_offset) : | ||||
| Show All 29 Lines | |||||