Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2019-08-21 13:04:40 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-08-26 11:10:35 +0300
commitb05e7ea7197ca4b66f74359a8e43e6a0b419de2d (patch)
tree0ac9437bd4a2f8d27ccf29a8eedcbb2080825399 /intern
parent7a15b938bde587aa12290413d6be61619b51fe2e (diff)
Cycles: fixes for building kernel without certain features
Ref D5363
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/bvh/bvh_nodes.h4
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h2
-rw-r--r--intern/cycles/kernel/kernel_camera.h6
-rw-r--r--intern/cycles/kernel/kernel_passes.h9
-rw-r--r--intern/cycles/kernel/kernel_path.h4
-rw-r--r--intern/cycles/kernel/kernel_path_branched.h2
-rw-r--r--intern/cycles/kernel/kernel_types.h1
-rw-r--r--intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h2
-rw-r--r--intern/cycles/kernel/svm/svm_ao.h4
-rw-r--r--intern/cycles/kernel/svm/svm_bevel.h12
-rw-r--r--intern/cycles/kernel/svm/svm_image.h4
11 files changed, 37 insertions, 13 deletions
diff --git a/intern/cycles/kernel/bvh/bvh_nodes.h b/intern/cycles/kernel/bvh/bvh_nodes.h
index a33bc73e25b..db598d1c7fa 100644
--- a/intern/cycles/kernel/bvh/bvh_nodes.h
+++ b/intern/cycles/kernel/bvh/bvh_nodes.h
@@ -39,7 +39,9 @@ ccl_device_forceinline int bvh_aligned_node_intersect(KernelGlobals *kg,
{
/* fetch node data */
+# ifdef __VISIBILITY_FLAG__
float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr + 0);
+# endif
float4 node0 = kernel_tex_fetch(__bvh_nodes, node_addr + 1);
float4 node1 = kernel_tex_fetch(__bvh_nodes, node_addr + 2);
float4 node2 = kernel_tex_fetch(__bvh_nodes, node_addr + 3);
@@ -111,7 +113,9 @@ ccl_device_forceinline int bvh_unaligned_node_intersect(KernelGlobals *kg,
float dist[2])
{
int mask = 0;
+# ifdef __VISIBILITY_FLAG__
float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr + 0);
+# endif
if (bvh_unaligned_node_intersect_child(kg, P, dir, t, node_addr, 0, &dist[0])) {
# ifdef __VISIBILITY_FLAG__
if ((__float_as_uint(cnodes.x) & visibility))
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index b9d723222a1..46a51f5a560 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -319,10 +319,12 @@ ccl_device_inline void path_radiance_accum_ao(PathRadiance *L,
float3 bsdf,
float3 ao)
{
+#ifdef __PASSES__
/* Store AO pass. */
if (L->use_light_pass && state->bounce == 0) {
L->ao += alpha * throughput * ao;
}
+#endif
#ifdef __SHADOW_TRICKS__
/* For shadow catcher, accumulate ratio. */
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 97cd3a3320c..62ce04ba48f 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -237,7 +237,9 @@ ccl_device void camera_sample_orthographic(KernelGlobals *kg,
/* Panorama Camera */
ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam,
+#ifdef __CAMERA_MOTION__
const ccl_global DecomposedTransform *cam_motion,
+#endif
float raster_x,
float raster_y,
float lens_u,
@@ -413,8 +415,12 @@ ccl_device_inline void camera_sample(KernelGlobals *kg,
camera_sample_orthographic(kg, raster_x, raster_y, lens_u, lens_v, ray);
}
else {
+#ifdef __CAMERA_MOTION__
const ccl_global DecomposedTransform *cam_motion = kernel_tex_array(__camera_motion);
camera_sample_panorama(&kernel_data.cam, cam_motion, raster_x, raster_y, lens_u, lens_v, ray);
+#else
+ camera_sample_panorama(&kernel_data.cam, raster_x, raster_y, lens_u, lens_v, ray);
+#endif
}
}
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index e84937e2fd9..4a424866efe 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -114,14 +114,12 @@ ccl_device_inline void kernel_write_denoising_shadow(KernelGlobals *kg,
float value = path_total_shaded / max(path_total, 1e-7f);
kernel_write_pass_float(buffer + 2, value * value);
}
-#endif /* __DENOISING_FEATURES__ */
ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg,
ShaderData *sd,
ccl_addr_space PathState *state,
PathRadiance *L)
{
-#ifdef __DENOISING_FEATURES__
if (state->denoising_feature_weight == 0.0f) {
return;
}
@@ -162,13 +160,8 @@ ccl_device_inline void kernel_update_denoising_features(KernelGlobals *kg,
state->denoising_feature_weight = 0.0f;
}
-#else
- (void)kg;
- (void)sd;
- (void)state;
- (void)L;
-#endif /* __DENOISING_FEATURES__ */
}
+#endif /* __DENOISING_FEATURES__ */
#ifdef __KERNEL_DEBUG__
ccl_device_inline void kernel_write_debug_passes(KernelGlobals *kg,
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index f3e2a8a234a..dff194822c9 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -590,7 +590,9 @@ ccl_device_forceinline void kernel_path_integrate(KernelGlobals *kg,
throughput /= probability;
}
+# ifdef __DENOISING_FEATURES__
kernel_update_denoising_features(kg, &sd, state, L);
+# endif
# ifdef __AO__
/* ambient occlusion */
@@ -610,8 +612,10 @@ ccl_device_forceinline void kernel_path_integrate(KernelGlobals *kg,
}
# endif /* __SUBSURFACE__ */
+# ifdef __EMISSION__
/* direct lighting */
kernel_path_surface_connect_light(kg, &sd, emission_sd, throughput, state, L);
+# endif /* __EMISSION__ */
# ifdef __VOLUME__
}
diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h
index f3a1ea3f4fd..737a7c4aa84 100644
--- a/intern/cycles/kernel/kernel_path_branched.h
+++ b/intern/cycles/kernel/kernel_path_branched.h
@@ -445,7 +445,9 @@ ccl_device void kernel_branched_path_integrate(KernelGlobals *kg,
}
}
+# ifdef __DENOISING_FEATURES__
kernel_update_denoising_features(kg, &sd, &state, L);
+# endif
# ifdef __AO__
/* ambient occlusion */
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 8aaa83045ea..8fedde4fb7f 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -115,7 +115,6 @@ CCL_NAMESPACE_BEGIN
# define __LAMP_MIS__
# define __CAMERA_MOTION__
# define __OBJECT_MOTION__
-# define __HAIR__
# define __BAKING__
# define __PRINCIPLED__
# define __SUBSURFACE__
diff --git a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
index 5cd4131e2ae..56cdb22bba3 100644
--- a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
+++ b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
@@ -132,10 +132,12 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
}
}
+#ifdef __DENOISING_FEATURES__
if (IS_STATE(ray_state, ray_index, RAY_ACTIVE)) {
PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
kernel_update_denoising_features(kg, sd, state, L);
}
+#endif
}
#ifdef __AO__
diff --git a/intern/cycles/kernel/svm/svm_ao.h b/intern/cycles/kernel/svm/svm_ao.h
index 62413979201..59260de1199 100644
--- a/intern/cycles/kernel/svm/svm_ao.h
+++ b/intern/cycles/kernel/svm/svm_ao.h
@@ -16,6 +16,8 @@
CCL_NAMESPACE_BEGIN
+#ifdef __SHADER_RAYTRACE__
+
ccl_device_noinline float svm_ao(KernelGlobals *kg,
ShaderData *sd,
float3 N,
@@ -102,4 +104,6 @@ ccl_device void svm_node_ao(
}
}
+#endif /* __SHADER_RAYTRACE__ */
+
CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/svm/svm_bevel.h b/intern/cycles/kernel/svm/svm_bevel.h
index fcf28e96e98..58b5d2a8131 100644
--- a/intern/cycles/kernel/svm/svm_bevel.h
+++ b/intern/cycles/kernel/svm/svm_bevel.h
@@ -16,6 +16,8 @@
CCL_NAMESPACE_BEGIN
+#ifdef __SHADER_RAYTRACE__
+
/* Bevel shader averaging normals from nearby surfaces.
*
* Sampling strategy from: BSSRDF Importance Sampling, SIGGRAPH 2013
@@ -120,14 +122,14 @@ ccl_device_noinline float3 svm_bevel(KernelGlobals *kg,
if (sd->type & PRIMITIVE_TRIANGLE) {
hit_P = triangle_refine_local(kg, sd, &isect.hits[hit], ray);
}
-#ifdef __OBJECT_MOTION__
+# ifdef __OBJECT_MOTION__
else if (sd->type & PRIMITIVE_MOTION_TRIANGLE) {
float3 verts[3];
motion_triangle_vertices(
kg, sd->object, kernel_tex_fetch(__prim_index, isect.hits[hit].prim), sd->time, verts);
hit_P = motion_triangle_refine_local(kg, sd, &isect.hits[hit], ray, verts);
}
-#endif /* __OBJECT_MOTION__ */
+# endif /* __OBJECT_MOTION__ */
/* Get geometric normal. */
float3 hit_Ng = isect.Ng[hit];
@@ -151,11 +153,11 @@ ccl_device_noinline float3 svm_bevel(KernelGlobals *kg,
if (sd->type & PRIMITIVE_TRIANGLE) {
N = triangle_smooth_normal(kg, N, prim, u, v);
}
-#ifdef __OBJECT_MOTION__
+# ifdef __OBJECT_MOTION__
else if (sd->type & PRIMITIVE_MOTION_TRIANGLE) {
N = motion_triangle_smooth_normal(kg, N, sd->object, prim, u, v, sd->time);
}
-#endif /* __OBJECT_MOTION__ */
+# endif /* __OBJECT_MOTION__ */
}
/* Transform normals to world space. */
@@ -214,4 +216,6 @@ ccl_device void svm_node_bevel(
stack_store_float3(stack, out_offset, bevel_N);
}
+#endif /* __SHADER_RAYTRACE__ */
+
CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h
index 2ef64662d0e..2f1f82b9a2e 100644
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@ -16,6 +16,8 @@
CCL_NAMESPACE_BEGIN
+#ifdef __TEXTURES__
+
ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint flags)
{
float4 r = kernel_tex_image_interp(kg, id, x, y);
@@ -199,4 +201,6 @@ ccl_device void svm_node_tex_environment(KernelGlobals *kg,
stack_store_float(stack, alpha_offset, f.w);
}
+#endif /* __TEXTURES__ */
+
CCL_NAMESPACE_END