diff options
Diffstat (limited to 'intern/cycles/kernel/svm')
28 files changed, 101 insertions, 91 deletions
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h index 8f8451b364d..ab8570618ab 100644 --- a/intern/cycles/kernel/svm/svm.h +++ b/intern/cycles/kernel/svm/svm.h @@ -132,16 +132,25 @@ ccl_device_inline float4 fetch_node_float(KernelGlobals *kg, int offset) __uint_as_float(node.w)); } -ccl_device_inline void decode_node_uchar4(uint i, uint *x, uint *y, uint *z, uint *w) +ccl_device_forceinline void svm_unpack_node_uchar2(uint i, uint *x, uint *y) { - if (x) - *x = (i & 0xFF); - if (y) - *y = ((i >> 8) & 0xFF); - if (z) - *z = ((i >> 16) & 0xFF); - if (w) - *w = ((i >> 24) & 0xFF); + *x = (i & 0xFF); + *y = ((i >> 8) & 0xFF); +} + +ccl_device_forceinline void svm_unpack_node_uchar3(uint i, uint *x, uint *y, uint *z) +{ + *x = (i & 0xFF); + *y = ((i >> 8) & 0xFF); + *z = ((i >> 16) & 0xFF); +} + +ccl_device_forceinline void svm_unpack_node_uchar4(uint i, uint *x, uint *y, uint *z, uint *w) +{ + *x = (i & 0xFF); + *y = ((i >> 8) & 0xFF); + *z = ((i >> 16) & 0xFF); + *w = ((i >> 24) & 0xFF); } CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/svm/svm_ao.h b/intern/cycles/kernel/svm/svm_ao.h index 3a8f32ac9d2..4cb986b897a 100644 --- a/intern/cycles/kernel/svm/svm_ao.h +++ b/intern/cycles/kernel/svm/svm_ao.h @@ -85,10 +85,10 @@ ccl_device void svm_node_ao( KernelGlobals *kg, ShaderData *sd, ccl_addr_space PathState *state, float *stack, uint4 node) { uint flags, dist_offset, normal_offset, out_ao_offset; - decode_node_uchar4(node.y, &flags, &dist_offset, &normal_offset, &out_ao_offset); + svm_unpack_node_uchar4(node.y, &flags, &dist_offset, &normal_offset, &out_ao_offset); uint color_offset, out_color_offset, samples; - decode_node_uchar4(node.z, &color_offset, &out_color_offset, &samples, NULL); + svm_unpack_node_uchar3(node.z, &color_offset, &out_color_offset, &samples); float dist = stack_load_float_default(stack, dist_offset, node.w); float3 normal = stack_valid(normal_offset) ? stack_load_float3(stack, normal_offset) : sd->N; diff --git a/intern/cycles/kernel/svm/svm_bevel.h b/intern/cycles/kernel/svm/svm_bevel.h index 6045268918b..434502f31f9 100644 --- a/intern/cycles/kernel/svm/svm_bevel.h +++ b/intern/cycles/kernel/svm/svm_bevel.h @@ -202,7 +202,7 @@ ccl_device void svm_node_bevel( KernelGlobals *kg, ShaderData *sd, ccl_addr_space PathState *state, float *stack, uint4 node) { uint num_samples, radius_offset, normal_offset, out_offset; - decode_node_uchar4(node.y, &num_samples, &radius_offset, &normal_offset, &out_offset); + svm_unpack_node_uchar4(node.y, &num_samples, &radius_offset, &normal_offset, &out_offset); float radius = stack_load_float(stack, radius_offset); float3 bevel_N = svm_bevel(kg, sd, state, radius, num_samples); diff --git a/intern/cycles/kernel/svm/svm_brick.h b/intern/cycles/kernel/svm/svm_brick.h index 77f697a78cb..f1d74b7df96 100644 --- a/intern/cycles/kernel/svm/svm_brick.h +++ b/intern/cycles/kernel/svm/svm_brick.h @@ -87,13 +87,13 @@ ccl_device void svm_node_tex_brick( /* RNA properties */ uint offset_frequency, squash_frequency; - decode_node_uchar4(node.y, &co_offset, &color1_offset, &color2_offset, &mortar_offset); - decode_node_uchar4( + svm_unpack_node_uchar4(node.y, &co_offset, &color1_offset, &color2_offset, &mortar_offset); + svm_unpack_node_uchar4( node.z, &scale_offset, &mortar_size_offset, &bias_offset, &brick_width_offset); - decode_node_uchar4( + svm_unpack_node_uchar4( node.w, &row_height_offset, &color_offset, &fac_offset, &mortar_smooth_offset); - decode_node_uchar4(node2.x, &offset_frequency, &squash_frequency, NULL, NULL); + svm_unpack_node_uchar2(node2.x, &offset_frequency, &squash_frequency); float3 co = stack_load_float3(stack, co_offset); diff --git a/intern/cycles/kernel/svm/svm_brightness.h b/intern/cycles/kernel/svm/svm_brightness.h index dcd75a2fe8f..9554b5946fb 100644 --- a/intern/cycles/kernel/svm/svm_brightness.h +++ b/intern/cycles/kernel/svm/svm_brightness.h @@ -22,7 +22,7 @@ ccl_device void svm_node_brightness( uint bright_offset, contrast_offset; float3 color = stack_load_float3(stack, in_color); - decode_node_uchar4(node, &bright_offset, &contrast_offset, NULL, NULL); + svm_unpack_node_uchar2(node, &bright_offset, &contrast_offset); float brightness = stack_load_float(stack, bright_offset); float contrast = stack_load_float(stack, contrast_offset); diff --git a/intern/cycles/kernel/svm/svm_checker.h b/intern/cycles/kernel/svm/svm_checker.h index 04a7b690e50..d54cb73df91 100644 --- a/intern/cycles/kernel/svm/svm_checker.h +++ b/intern/cycles/kernel/svm/svm_checker.h @@ -37,8 +37,8 @@ ccl_device void svm_node_tex_checker(KernelGlobals *kg, ShaderData *sd, float *s uint co_offset, color1_offset, color2_offset, scale_offset; uint color_offset, fac_offset; - decode_node_uchar4(node.y, &co_offset, &color1_offset, &color2_offset, &scale_offset); - decode_node_uchar4(node.z, &color_offset, &fac_offset, NULL, NULL); + svm_unpack_node_uchar4(node.y, &co_offset, &color1_offset, &color2_offset, &scale_offset); + svm_unpack_node_uchar2(node.z, &color_offset, &fac_offset); float3 co = stack_load_float3(stack, co_offset); float3 color1 = stack_load_float3(stack, color1_offset); diff --git a/intern/cycles/kernel/svm/svm_clamp.h b/intern/cycles/kernel/svm/svm_clamp.h index 5ff4a599028..a45e70a3f15 100644 --- a/intern/cycles/kernel/svm/svm_clamp.h +++ b/intern/cycles/kernel/svm/svm_clamp.h @@ -27,7 +27,7 @@ ccl_device void svm_node_clamp(KernelGlobals *kg, int *offset) { uint min_stack_offset, max_stack_offset; - decode_node_uchar4(parameters_stack_offsets, &min_stack_offset, &max_stack_offset, NULL, NULL); + svm_unpack_node_uchar2(parameters_stack_offsets, &min_stack_offset, &max_stack_offset); uint4 defaults = read_node(kg, offset); diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index 270fe4c8615..1511fc65835 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -85,7 +85,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, uint type, param1_offset, param2_offset; uint mix_weight_offset; - decode_node_uchar4(node.y, &type, ¶m1_offset, ¶m2_offset, &mix_weight_offset); + svm_unpack_node_uchar4(node.y, &type, ¶m1_offset, ¶m2_offset, &mix_weight_offset); float mix_weight = (stack_valid(mix_weight_offset) ? stack_load_float(stack, mix_weight_offset) : 1.0f); @@ -122,21 +122,21 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, uint4 data_node2 = read_node(kg, offset); float3 T = stack_load_float3(stack, data_node.y); - decode_node_uchar4(data_node.z, - &specular_offset, - &roughness_offset, - &specular_tint_offset, - &anisotropic_offset); - decode_node_uchar4(data_node.w, - &sheen_offset, - &sheen_tint_offset, - &clearcoat_offset, - &clearcoat_roughness_offset); - decode_node_uchar4(data_node2.x, - &eta_offset, - &transmission_offset, - &anisotropic_rotation_offset, - &transmission_roughness_offset); + svm_unpack_node_uchar4(data_node.z, + &specular_offset, + &roughness_offset, + &specular_tint_offset, + &anisotropic_offset); + svm_unpack_node_uchar4(data_node.w, + &sheen_offset, + &sheen_tint_offset, + &clearcoat_offset, + &clearcoat_roughness_offset); + svm_unpack_node_uchar4(data_node2.x, + &eta_offset, + &transmission_offset, + &anisotropic_rotation_offset, + &transmission_roughness_offset); // get Disney principled parameters float metallic = param1; @@ -793,19 +793,19 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, float3 weight = sd->svm_closure_weight * mix_weight; uint offset_ofs, ior_ofs, color_ofs, parametrization; - decode_node_uchar4(data_node.y, &offset_ofs, &ior_ofs, &color_ofs, ¶metrization); + svm_unpack_node_uchar4(data_node.y, &offset_ofs, &ior_ofs, &color_ofs, ¶metrization); float alpha = stack_load_float_default(stack, offset_ofs, data_node.z); float ior = stack_load_float_default(stack, ior_ofs, data_node.w); uint coat_ofs, melanin_ofs, melanin_redness_ofs, absorption_coefficient_ofs; - decode_node_uchar4(data_node2.x, - &coat_ofs, - &melanin_ofs, - &melanin_redness_ofs, - &absorption_coefficient_ofs); + svm_unpack_node_uchar4(data_node2.x, + &coat_ofs, + &melanin_ofs, + &melanin_redness_ofs, + &absorption_coefficient_ofs); uint tint_ofs, random_ofs, random_color_ofs, random_roughness_ofs; - decode_node_uchar4( + svm_unpack_node_uchar4( data_node3.x, &tint_ofs, &random_ofs, &random_color_ofs, &random_roughness_ofs); const AttributeDescriptor attr_descr_random = find_attribute(kg, sd, data_node4.y); @@ -982,7 +982,7 @@ ccl_device void svm_node_closure_volume( uint type, density_offset, anisotropy_offset; uint mix_weight_offset; - decode_node_uchar4(node.y, &type, &density_offset, &anisotropy_offset, &mix_weight_offset); + svm_unpack_node_uchar4(node.y, &type, &density_offset, &anisotropy_offset, &mix_weight_offset); float mix_weight = (stack_valid(mix_weight_offset) ? stack_load_float(stack, mix_weight_offset) : 1.0f); @@ -1040,7 +1040,7 @@ ccl_device void svm_node_principled_volume(KernelGlobals *kg, } uint density_offset, anisotropy_offset, absorption_color_offset, mix_weight_offset; - decode_node_uchar4( + svm_unpack_node_uchar4( node.y, &density_offset, &anisotropy_offset, &absorption_color_offset, &mix_weight_offset); float mix_weight = (stack_valid(mix_weight_offset) ? stack_load_float(stack, mix_weight_offset) : 1.0f); @@ -1099,7 +1099,7 @@ ccl_device void svm_node_principled_volume(KernelGlobals *kg, } uint emission_offset, emission_color_offset, blackbody_offset, temperature_offset; - decode_node_uchar4( + svm_unpack_node_uchar4( node.z, &emission_offset, &emission_color_offset, &blackbody_offset, &temperature_offset); float emission = (stack_valid(emission_offset)) ? stack_load_float(stack, emission_offset) : __uint_as_float(value_node.z); @@ -1229,7 +1229,8 @@ ccl_device void svm_node_mix_closure(ShaderData *sd, float *stack, uint4 node) /* fetch weight from blend input, previous mix closures, * and write to stack to be used by closure nodes later */ uint weight_offset, in_weight_offset, weight1_offset, weight2_offset; - decode_node_uchar4(node.y, &weight_offset, &in_weight_offset, &weight1_offset, &weight2_offset); + svm_unpack_node_uchar4( + node.y, &weight_offset, &in_weight_offset, &weight1_offset, &weight2_offset); float weight = stack_load_float(stack, weight_offset); weight = saturate(weight); diff --git a/intern/cycles/kernel/svm/svm_displace.h b/intern/cycles/kernel/svm/svm_displace.h index f16664a684c..250fac6bcb8 100644 --- a/intern/cycles/kernel/svm/svm_displace.h +++ b/intern/cycles/kernel/svm/svm_displace.h @@ -23,7 +23,7 @@ ccl_device void svm_node_set_bump(KernelGlobals *kg, ShaderData *sd, float *stac #ifdef __RAY_DIFFERENTIALS__ /* get normal input */ uint normal_offset, scale_offset, invert, use_object_space; - decode_node_uchar4(node.y, &normal_offset, &scale_offset, &invert, &use_object_space); + svm_unpack_node_uchar4(node.y, &normal_offset, &scale_offset, &invert, &use_object_space); float3 normal_in = stack_valid(normal_offset) ? stack_load_float3(stack, normal_offset) : sd->N; @@ -42,7 +42,7 @@ ccl_device void svm_node_set_bump(KernelGlobals *kg, ShaderData *sd, float *stac /* get bump values */ uint c_offset, x_offset, y_offset, strength_offset; - decode_node_uchar4(node.z, &c_offset, &x_offset, &y_offset, &strength_offset); + svm_unpack_node_uchar4(node.z, &c_offset, &x_offset, &y_offset, &strength_offset); float h_c = stack_load_float(stack, c_offset); float h_x = stack_load_float(stack, x_offset); @@ -95,7 +95,7 @@ ccl_device void svm_node_set_displacement(KernelGlobals *kg, ccl_device void svm_node_displacement(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) { uint height_offset, midlevel_offset, scale_offset, normal_offset; - decode_node_uchar4(node.y, &height_offset, &midlevel_offset, &scale_offset, &normal_offset); + svm_unpack_node_uchar4(node.y, &height_offset, &midlevel_offset, &scale_offset, &normal_offset); float height = stack_load_float(stack, height_offset); float midlevel = stack_load_float(stack, midlevel_offset); @@ -126,7 +126,7 @@ ccl_device void svm_node_vector_displacement( uint space = data_node.x; uint vector_offset, midlevel_offset, scale_offset, displacement_offset; - decode_node_uchar4( + svm_unpack_node_uchar4( node.y, &vector_offset, &midlevel_offset, &scale_offset, &displacement_offset); float3 vector = stack_load_float3(stack, vector_offset); diff --git a/intern/cycles/kernel/svm/svm_fresnel.h b/intern/cycles/kernel/svm/svm_fresnel.h index 03119991597..96d602e35bf 100644 --- a/intern/cycles/kernel/svm/svm_fresnel.h +++ b/intern/cycles/kernel/svm/svm_fresnel.h @@ -22,7 +22,7 @@ ccl_device void svm_node_fresnel( ShaderData *sd, float *stack, uint ior_offset, uint ior_value, uint node) { uint normal_offset, out_offset; - decode_node_uchar4(node, &normal_offset, &out_offset, NULL, NULL); + svm_unpack_node_uchar2(node, &normal_offset, &out_offset); float eta = (stack_valid(ior_offset)) ? stack_load_float(stack, ior_offset) : __uint_as_float(ior_value); float3 normal_in = stack_valid(normal_offset) ? stack_load_float3(stack, normal_offset) : sd->N; @@ -43,7 +43,7 @@ ccl_device void svm_node_layer_weight(ShaderData *sd, float *stack, uint4 node) uint blend_value = node.z; uint type, normal_offset, out_offset; - decode_node_uchar4(node.w, &type, &normal_offset, &out_offset, NULL); + svm_unpack_node_uchar3(node.w, &type, &normal_offset, &out_offset); float blend = (stack_valid(blend_offset)) ? stack_load_float(stack, blend_offset) : __uint_as_float(blend_value); diff --git a/intern/cycles/kernel/svm/svm_gradient.h b/intern/cycles/kernel/svm/svm_gradient.h index c315564fbc2..08304bc47e8 100644 --- a/intern/cycles/kernel/svm/svm_gradient.h +++ b/intern/cycles/kernel/svm/svm_gradient.h @@ -64,7 +64,7 @@ ccl_device void svm_node_tex_gradient(ShaderData *sd, float *stack, uint4 node) { uint type, co_offset, color_offset, fac_offset; - decode_node_uchar4(node.y, &type, &co_offset, &fac_offset, &color_offset); + svm_unpack_node_uchar4(node.y, &type, &co_offset, &fac_offset, &color_offset); float3 co = stack_load_float3(stack, co_offset); diff --git a/intern/cycles/kernel/svm/svm_hsv.h b/intern/cycles/kernel/svm/svm_hsv.h index 72379fba870..1f7bd421869 100644 --- a/intern/cycles/kernel/svm/svm_hsv.h +++ b/intern/cycles/kernel/svm/svm_hsv.h @@ -24,8 +24,8 @@ ccl_device void svm_node_hsv( { uint in_color_offset, fac_offset, out_color_offset; uint hue_offset, sat_offset, val_offset; - decode_node_uchar4(node.y, &in_color_offset, &fac_offset, &out_color_offset, NULL); - decode_node_uchar4(node.z, &hue_offset, &sat_offset, &val_offset, NULL); + svm_unpack_node_uchar3(node.y, &in_color_offset, &fac_offset, &out_color_offset); + svm_unpack_node_uchar3(node.z, &hue_offset, &sat_offset, &val_offset); float fac = stack_load_float(stack, fac_offset); float3 in_color = stack_load_float3(stack, in_color_offset); diff --git a/intern/cycles/kernel/svm/svm_ies.h b/intern/cycles/kernel/svm/svm_ies.h index e57e54ef123..56c804b44d0 100644 --- a/intern/cycles/kernel/svm/svm_ies.h +++ b/intern/cycles/kernel/svm/svm_ies.h @@ -101,8 +101,8 @@ ccl_device_inline float kernel_ies_interp(KernelGlobals *kg, ccl_device void svm_node_ies( KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset) { - uint vector_offset, strength_offset, fac_offset, dummy, slot = node.z; - decode_node_uchar4(node.y, &strength_offset, &vector_offset, &fac_offset, &dummy); + uint vector_offset, strength_offset, fac_offset, slot = node.z; + svm_unpack_node_uchar3(node.y, &strength_offset, &vector_offset, &fac_offset); float3 vector = stack_load_float3(stack, vector_offset); float strength = stack_load_float_default(stack, strength_offset, node.w); diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index 2f1f82b9a2e..64abdd2d8b3 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -50,7 +50,7 @@ ccl_device void svm_node_tex_image(KernelGlobals *kg, ShaderData *sd, float *sta uint id = node.y; uint co_offset, out_offset, alpha_offset, flags; - decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &flags); + svm_unpack_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &flags); float3 co = stack_load_float3(stack, co_offset); float2 tex_co; @@ -145,7 +145,7 @@ ccl_device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float /* now fetch textures */ uint co_offset, out_offset, alpha_offset, flags; - decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &flags); + svm_unpack_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &flags); float3 co = stack_load_float3(stack, co_offset); uint id = node.y; @@ -181,7 +181,7 @@ ccl_device void svm_node_tex_environment(KernelGlobals *kg, uint co_offset, out_offset, alpha_offset, flags; uint projection = node.w; - decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &flags); + svm_unpack_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &flags); float3 co = stack_load_float3(stack, co_offset); float2 uv; diff --git a/intern/cycles/kernel/svm/svm_light_path.h b/intern/cycles/kernel/svm/svm_light_path.h index 65a9a284a17..768c65918cd 100644 --- a/intern/cycles/kernel/svm/svm_light_path.h +++ b/intern/cycles/kernel/svm/svm_light_path.h @@ -84,7 +84,7 @@ ccl_device void svm_node_light_falloff(ShaderData *sd, float *stack, uint4 node) { uint strength_offset, out_offset, smooth_offset; - decode_node_uchar4(node.z, &strength_offset, &smooth_offset, &out_offset, NULL); + svm_unpack_node_uchar3(node.z, &strength_offset, &smooth_offset, &out_offset); float strength = stack_load_float(stack, strength_offset); uint type = node.y; diff --git a/intern/cycles/kernel/svm/svm_magic.h b/intern/cycles/kernel/svm/svm_magic.h index 115d2e2fe4b..6ba1a5817ad 100644 --- a/intern/cycles/kernel/svm/svm_magic.h +++ b/intern/cycles/kernel/svm/svm_magic.h @@ -93,8 +93,8 @@ ccl_device void svm_node_tex_magic( uint depth; uint scale_offset, distortion_offset, co_offset, fac_offset, color_offset; - decode_node_uchar4(node.y, &depth, &color_offset, &fac_offset, NULL); - decode_node_uchar4(node.z, &co_offset, &scale_offset, &distortion_offset, NULL); + svm_unpack_node_uchar3(node.y, &depth, &color_offset, &fac_offset); + svm_unpack_node_uchar3(node.z, &co_offset, &scale_offset, &distortion_offset); uint4 node2 = read_node(kg, offset); float3 co = stack_load_float3(stack, co_offset); diff --git a/intern/cycles/kernel/svm/svm_map_range.h b/intern/cycles/kernel/svm/svm_map_range.h index 5d542e959d1..f2a68adbe61 100644 --- a/intern/cycles/kernel/svm/svm_map_range.h +++ b/intern/cycles/kernel/svm/svm_map_range.h @@ -27,11 +27,11 @@ ccl_device void svm_node_map_range(KernelGlobals *kg, int *offset) { uint from_min_stack_offset, from_max_stack_offset, to_min_stack_offset, to_max_stack_offset; - decode_node_uchar4(parameters_stack_offsets, - &from_min_stack_offset, - &from_max_stack_offset, - &to_min_stack_offset, - &to_max_stack_offset); + svm_unpack_node_uchar4(parameters_stack_offsets, + &from_min_stack_offset, + &from_max_stack_offset, + &to_min_stack_offset, + &to_max_stack_offset); uint4 defaults = read_node(kg, offset); diff --git a/intern/cycles/kernel/svm/svm_math.h b/intern/cycles/kernel/svm/svm_math.h index c577a7f13c7..d156dec497c 100644 --- a/intern/cycles/kernel/svm/svm_math.h +++ b/intern/cycles/kernel/svm/svm_math.h @@ -25,7 +25,7 @@ ccl_device void svm_node_math(KernelGlobals *kg, int *offset) { uint a_stack_offset, b_stack_offset; - decode_node_uchar4(inputs_stack_offsets, &a_stack_offset, &b_stack_offset, NULL, NULL); + svm_unpack_node_uchar2(inputs_stack_offsets, &a_stack_offset, &b_stack_offset); float a = stack_load_float(stack, a_stack_offset); float b = stack_load_float(stack, b_stack_offset); @@ -44,9 +44,9 @@ ccl_device void svm_node_vector_math(KernelGlobals *kg, { uint value_stack_offset, vector_stack_offset; uint a_stack_offset, b_stack_offset, scale_stack_offset; - decode_node_uchar4( - inputs_stack_offsets, &a_stack_offset, &b_stack_offset, &scale_stack_offset, NULL); - decode_node_uchar4(outputs_stack_offsets, &value_stack_offset, &vector_stack_offset, NULL, NULL); + svm_unpack_node_uchar3( + inputs_stack_offsets, &a_stack_offset, &b_stack_offset, &scale_stack_offset); + svm_unpack_node_uchar2(outputs_stack_offsets, &value_stack_offset, &vector_stack_offset); float3 a = stack_load_float3(stack, a_stack_offset); float3 b = stack_load_float3(stack, b_stack_offset); diff --git a/intern/cycles/kernel/svm/svm_musgrave.h b/intern/cycles/kernel/svm/svm_musgrave.h index 67fb5ca6241..298155b795f 100644 --- a/intern/cycles/kernel/svm/svm_musgrave.h +++ b/intern/cycles/kernel/svm/svm_musgrave.h @@ -222,10 +222,10 @@ ccl_device void svm_node_tex_musgrave( uint dimension_offset, lacunarity_offset, detail_offset, offset_offset; uint gain_offset, scale_offset; - decode_node_uchar4(node.y, &type, &co_offset, &color_offset, &fac_offset); - decode_node_uchar4( + svm_unpack_node_uchar4(node.y, &type, &co_offset, &color_offset, &fac_offset); + svm_unpack_node_uchar4( node.z, &dimension_offset, &lacunarity_offset, &detail_offset, &offset_offset); - decode_node_uchar4(node.w, &gain_offset, &scale_offset, NULL, NULL); + svm_unpack_node_uchar2(node.w, &gain_offset, &scale_offset); float3 co = stack_load_float3(stack, co_offset); float dimension = stack_load_float_default(stack, dimension_offset, node2.x); diff --git a/intern/cycles/kernel/svm/svm_noisetex.h b/intern/cycles/kernel/svm/svm_noisetex.h index 3324e86fcd8..91dc11691e6 100644 --- a/intern/cycles/kernel/svm/svm_noisetex.h +++ b/intern/cycles/kernel/svm/svm_noisetex.h @@ -23,8 +23,8 @@ ccl_device void svm_node_tex_noise( { uint co_offset, scale_offset, detail_offset, distortion_offset, fac_offset, color_offset; - decode_node_uchar4(node.y, &co_offset, &scale_offset, &detail_offset, &distortion_offset); - decode_node_uchar4(node.z, &color_offset, &fac_offset, NULL, NULL); + svm_unpack_node_uchar4(node.y, &co_offset, &scale_offset, &detail_offset, &distortion_offset); + svm_unpack_node_uchar2(node.z, &color_offset, &fac_offset); uint4 node2 = read_node(kg, offset); diff --git a/intern/cycles/kernel/svm/svm_ramp.h b/intern/cycles/kernel/svm/svm_ramp.h index 6084ee35a1f..85ccf39144b 100644 --- a/intern/cycles/kernel/svm/svm_ramp.h +++ b/intern/cycles/kernel/svm/svm_ramp.h @@ -59,7 +59,7 @@ ccl_device void svm_node_rgb_ramp( uint fac_offset, color_offset, alpha_offset; uint interpolate = node.z; - decode_node_uchar4(node.y, &fac_offset, &color_offset, &alpha_offset, NULL); + svm_unpack_node_uchar3(node.y, &fac_offset, &color_offset, &alpha_offset); uint table_size = read_node(kg, offset).x; @@ -78,7 +78,7 @@ ccl_device void svm_node_curves( KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset) { uint fac_offset, color_offset, out_offset; - decode_node_uchar4(node.y, &fac_offset, &color_offset, &out_offset, NULL); + svm_unpack_node_uchar3(node.y, &fac_offset, &color_offset, &out_offset); uint table_size = read_node(kg, offset).x; diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h index 1fb3e20f9e0..a876d6bc916 100644 --- a/intern/cycles/kernel/svm/svm_tex_coord.h +++ b/intern/cycles/kernel/svm/svm_tex_coord.h @@ -257,7 +257,7 @@ ccl_device void svm_node_tex_coord_bump_dy( ccl_device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) { uint color_offset, strength_offset, normal_offset, space; - decode_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); color = 2.0f * make_float3(color.x - 0.5f, color.y - 0.5f, color.z - 0.5f); @@ -349,7 +349,7 @@ ccl_device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *st ccl_device void svm_node_tangent(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) { uint tangent_offset, direction_type, axis; - decode_node_uchar4(node.y, &tangent_offset, &direction_type, &axis, NULL); + svm_unpack_node_uchar3(node.y, &tangent_offset, &direction_type, &axis); float3 tangent; float3 attribute_value; diff --git a/intern/cycles/kernel/svm/svm_vector_transform.h b/intern/cycles/kernel/svm/svm_vector_transform.h index 7ec0f07f2e4..1e95492cf1b 100644 --- a/intern/cycles/kernel/svm/svm_vector_transform.h +++ b/intern/cycles/kernel/svm/svm_vector_transform.h @@ -26,8 +26,8 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, uint itype, ifrom, ito; uint vector_in, vector_out; - decode_node_uchar4(node.y, &itype, &ifrom, &ito, NULL); - decode_node_uchar4(node.z, &vector_in, &vector_out, NULL, NULL); + svm_unpack_node_uchar3(node.y, &itype, &ifrom, &ito); + svm_unpack_node_uchar2(node.z, &vector_in, &vector_out); float3 in = stack_load_float3(stack, vector_in); diff --git a/intern/cycles/kernel/svm/svm_voronoi.h b/intern/cycles/kernel/svm/svm_voronoi.h index 3e28a316169..3d7fa523968 100644 --- a/intern/cycles/kernel/svm/svm_voronoi.h +++ b/intern/cycles/kernel/svm/svm_voronoi.h @@ -116,8 +116,8 @@ ccl_device void svm_node_tex_voronoi( uint co_offset, coloring, distance, feature; uint scale_offset, e_offset, fac_offset, color_offset; - decode_node_uchar4(node.y, &co_offset, &coloring, &distance, &feature); - decode_node_uchar4(node.z, &scale_offset, &e_offset, &fac_offset, &color_offset); + svm_unpack_node_uchar4(node.y, &co_offset, &coloring, &distance, &feature); + svm_unpack_node_uchar4(node.z, &scale_offset, &e_offset, &fac_offset, &color_offset); float3 co = stack_load_float3(stack, co_offset); float scale = stack_load_float_default(stack, scale_offset, node2.x); diff --git a/intern/cycles/kernel/svm/svm_voxel.h b/intern/cycles/kernel/svm/svm_voxel.h index 26d8cc71d3b..b79be8e5bde 100644 --- a/intern/cycles/kernel/svm/svm_voxel.h +++ b/intern/cycles/kernel/svm/svm_voxel.h @@ -23,7 +23,7 @@ ccl_device void svm_node_tex_voxel( KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset) { uint co_offset, density_out_offset, color_out_offset, space; - decode_node_uchar4(node.z, &co_offset, &density_out_offset, &color_out_offset, &space); + svm_unpack_node_uchar4(node.z, &co_offset, &density_out_offset, &color_out_offset, &space); #ifdef __VOLUME__ int id = node.y; float3 co = stack_load_float3(stack, co_offset); diff --git a/intern/cycles/kernel/svm/svm_wave.h b/intern/cycles/kernel/svm/svm_wave.h index 003ad7dc63a..03b7f330970 100644 --- a/intern/cycles/kernel/svm/svm_wave.h +++ b/intern/cycles/kernel/svm/svm_wave.h @@ -54,8 +54,8 @@ ccl_device void svm_node_tex_wave( uint co_offset, scale_offset, detail_offset, dscale_offset, distortion_offset, color_offset, fac_offset; - decode_node_uchar4(node.y, &type, &color_offset, &fac_offset, &dscale_offset); - decode_node_uchar4(node.z, &co_offset, &scale_offset, &detail_offset, &distortion_offset); + svm_unpack_node_uchar4(node.y, &type, &color_offset, &fac_offset, &dscale_offset); + svm_unpack_node_uchar4(node.z, &co_offset, &scale_offset, &detail_offset, &distortion_offset); float3 co = stack_load_float3(stack, co_offset); float scale = stack_load_float_default(stack, scale_offset, node2.x); diff --git a/intern/cycles/kernel/svm/svm_white_noise.h b/intern/cycles/kernel/svm/svm_white_noise.h index ada1fcb39ce..71d4591d25d 100644 --- a/intern/cycles/kernel/svm/svm_white_noise.h +++ b/intern/cycles/kernel/svm/svm_white_noise.h @@ -25,7 +25,7 @@ ccl_device void svm_node_tex_white_noise(KernelGlobals *kg, int *offset) { uint vector_stack_offset, w_stack_offset; - decode_node_uchar4(inputs_stack_offsets, &vector_stack_offset, &w_stack_offset, NULL, NULL); + svm_unpack_node_uchar2(inputs_stack_offsets, &vector_stack_offset, &w_stack_offset); float3 vector = stack_load_float3(stack, vector_stack_offset); float w = stack_load_float(stack, w_stack_offset); diff --git a/intern/cycles/kernel/svm/svm_wireframe.h b/intern/cycles/kernel/svm/svm_wireframe.h index 55e61d0e8c7..49158bd86d5 100644 --- a/intern/cycles/kernel/svm/svm_wireframe.h +++ b/intern/cycles/kernel/svm/svm_wireframe.h @@ -93,7 +93,7 @@ ccl_device void svm_node_wireframe(KernelGlobals *kg, ShaderData *sd, float *sta uint in_size = node.y; uint out_fac = node.z; uint use_pixel_size, bump_offset; - decode_node_uchar4(node.w, &use_pixel_size, &bump_offset, NULL, NULL); + svm_unpack_node_uchar2(node.w, &use_pixel_size, &bump_offset); /* Input Data */ float size = stack_load_float(stack, in_size); |