[Bf-blender-cvs] [781696e3247] cycles-x: Cycles X: tweak inlining flags in preparation of shader raytracing

Brecht Van Lommel noreply at git.blender.org
Fri Jun 4 15:10:37 CEST 2021


Commit: 781696e3247c8644839199c31bf3e868873914a8
Author: Brecht Van Lommel
Date:   Thu Jun 3 13:38:36 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB781696e3247c8644839199c31bf3e868873914a8

Cycles X: tweak inlining flags in preparation of shader raytracing

No difference by itself, but will be needed to keep inlining behavior the same
after the addition of the new kernel.

===================================================================

M	intern/cycles/kernel/geom/geom_primitive.h
M	intern/cycles/kernel/integrator/integrator_shade_surface.h
M	intern/cycles/kernel/svm/svm_displace.h
M	intern/cycles/kernel/svm/svm_image.h

===================================================================

diff --git a/intern/cycles/kernel/geom/geom_primitive.h b/intern/cycles/kernel/geom/geom_primitive.h
index c862b157a80..bd358b5a8c3 100644
--- a/intern/cycles/kernel/geom/geom_primitive.h
+++ b/intern/cycles/kernel/geom/geom_primitive.h
@@ -109,11 +109,11 @@ ccl_device_inline float3 primitive_surface_attribute_float3(const KernelGlobals
   }
 }
 
-ccl_device_inline float4 primitive_surface_attribute_float4(const KernelGlobals *kg,
-                                                            const ShaderData *sd,
-                                                            const AttributeDescriptor desc,
-                                                            float4 *dx,
-                                                            float4 *dy)
+ccl_device_forceinline float4 primitive_surface_attribute_float4(const KernelGlobals *kg,
+                                                                 const ShaderData *sd,
+                                                                 const AttributeDescriptor desc,
+                                                                 float4 *dx,
+                                                                 float4 *dy)
 {
   if (sd->type & PRIMITIVE_ALL_TRIANGLE) {
     if (subd_triangle_patch(kg, sd) == ~0)
diff --git a/intern/cycles/kernel/integrator/integrator_shade_surface.h b/intern/cycles/kernel/integrator/integrator_shade_surface.h
index f0ec4474241..6d4b6e362b7 100644
--- a/intern/cycles/kernel/integrator/integrator_shade_surface.h
+++ b/intern/cycles/kernel/integrator/integrator_shade_surface.h
@@ -27,7 +27,8 @@
 
 CCL_NAMESPACE_BEGIN
 
-ccl_device_inline void integrate_surface_shader_setup(INTEGRATOR_STATE_CONST_ARGS, ShaderData *sd)
+ccl_device_forceinline void integrate_surface_shader_setup(INTEGRATOR_STATE_CONST_ARGS,
+                                                           ShaderData *sd)
 {
   Intersection isect ccl_optional_struct_init;
   integrator_state_read_isect(INTEGRATOR_STATE_PASS, &isect);
@@ -39,9 +40,9 @@ ccl_device_inline void integrate_surface_shader_setup(INTEGRATOR_STATE_CONST_ARG
 }
 
 #ifdef __HOLDOUT__
-ccl_device_inline bool integrate_surface_holdout(INTEGRATOR_STATE_CONST_ARGS,
-                                                 ShaderData *sd,
-                                                 ccl_global float *ccl_restrict render_buffer)
+ccl_device_forceinline bool integrate_surface_holdout(INTEGRATOR_STATE_CONST_ARGS,
+                                                      ShaderData *sd,
+                                                      ccl_global float *ccl_restrict render_buffer)
 {
   /* Write holdout transparency to render buffer and stop if fully holdout. */
   const uint32_t path_flag = INTEGRATOR_STATE(path, flag);
@@ -64,9 +65,10 @@ ccl_device_inline bool integrate_surface_holdout(INTEGRATOR_STATE_CONST_ARGS,
 #endif /* __HOLDOUT__ */
 
 #ifdef __EMISSION__
-ccl_device_inline void integrate_surface_emission(INTEGRATOR_STATE_CONST_ARGS,
-                                                  const ShaderData *sd,
-                                                  ccl_global float *ccl_restrict render_buffer)
+ccl_device_forceinline void integrate_surface_emission(INTEGRATOR_STATE_CONST_ARGS,
+                                                       const ShaderData *sd,
+                                                       ccl_global float *ccl_restrict
+                                                           render_buffer)
 {
   const uint32_t path_flag = INTEGRATOR_STATE(path, flag);
 
@@ -98,9 +100,9 @@ ccl_device_inline void integrate_surface_emission(INTEGRATOR_STATE_CONST_ARGS,
 #ifdef __EMISSION__
 /* Path tracing: sample point on light and evaluate light shader, then
  * queue shadow ray to be traced. */
-ccl_device_inline void integrate_surface_direct_light(INTEGRATOR_STATE_ARGS,
-                                                      ShaderData *sd,
-                                                      const RNGState *rng_state)
+ccl_device_forceinline void integrate_surface_direct_light(INTEGRATOR_STATE_ARGS,
+                                                           ShaderData *sd,
+                                                           const RNGState *rng_state)
 {
   /* Test if there is a light or BSDF that needs direct light. */
   if (!(kernel_data.integrator.use_direct_light && (sd->flag & SD_BSDF_HAS_EVAL))) {
@@ -181,9 +183,9 @@ ccl_device_inline void integrate_surface_direct_light(INTEGRATOR_STATE_ARGS,
 #endif
 
 /* Path tracing: bounce off or through surface with new direction. */
-ccl_device bool integrate_surface_bounce(INTEGRATOR_STATE_ARGS,
-                                         ShaderData *sd,
-                                         const RNGState *rng_state)
+ccl_device_forceinline bool integrate_surface_bounce(INTEGRATOR_STATE_ARGS,
+                                                     ShaderData *sd,
+                                                     const RNGState *rng_state)
 {
   /* Sample BSDF or BSSRDF. */
   if (sd->flag & (SD_BSDF | SD_BSSRDF)) {
@@ -285,8 +287,8 @@ ccl_device bool integrate_surface_bounce(INTEGRATOR_STATE_ARGS,
 }
 
 template<uint node_feature_mask>
-ccl_device_inline bool integrate_surface(INTEGRATOR_STATE_ARGS,
-                                         ccl_global float *ccl_restrict render_buffer)
+ccl_device bool integrate_surface(INTEGRATOR_STATE_ARGS,
+                                  ccl_global float *ccl_restrict render_buffer)
 
 {
   /* Setup shader data. */
diff --git a/intern/cycles/kernel/svm/svm_displace.h b/intern/cycles/kernel/svm/svm_displace.h
index dc0bfb5f5aa..e118a31e0cc 100644
--- a/intern/cycles/kernel/svm/svm_displace.h
+++ b/intern/cycles/kernel/svm/svm_displace.h
@@ -127,7 +127,7 @@ ccl_device void svm_node_displacement(const KernelGlobals *kg,
   stack_store_float3(stack, node.z, dP);
 }
 
-ccl_device void svm_node_vector_displacement(
+ccl_device_forceinline void svm_node_vector_displacement(
     const KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
 {
   uint4 data_node = read_node(kg, offset);
diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h
index cf2ccf4094c..de401db4be6 100644
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@ -116,10 +116,10 @@ ccl_device void svm_node_tex_image(
     stack_store_float(stack, alpha_offset, f.w);
 }
 
-ccl_device void svm_node_tex_image_box(const KernelGlobals *kg,
-                                       ShaderData *sd,
-                                       float *stack,
-                                       uint4 node)
+ccl_device_forceinline void svm_node_tex_image_box(const KernelGlobals *kg,
+                                                   ShaderData *sd,
+                                                   float *stack,
+                                                   uint4 node)
 {
   /* get object space normal */
   float3 N = sd->N;



More information about the Bf-blender-cvs mailing list