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
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/kernel/kernel_light_background.h')
-rw-r--r--intern/cycles/kernel/kernel_light_background.h41
1 files changed, 25 insertions, 16 deletions
diff --git a/intern/cycles/kernel/kernel_light_background.h b/intern/cycles/kernel/kernel_light_background.h
index 493ed560bc6..3669ff50455 100644
--- a/intern/cycles/kernel/kernel_light_background.h
+++ b/intern/cycles/kernel/kernel_light_background.h
@@ -24,10 +24,10 @@ CCL_NAMESPACE_BEGIN
#ifdef __BACKGROUND_MIS__
-ccl_device float3 background_map_sample(const KernelGlobals *kg,
+ccl_device float3 background_map_sample(ccl_global const KernelGlobals *kg,
float randu,
float randv,
- float *pdf)
+ ccl_private float *pdf)
{
/* for the following, the CDF values are actually a pair of floats, with the
* function value as X and the actual CDF as Y. The last entry's function
@@ -109,7 +109,7 @@ ccl_device float3 background_map_sample(const KernelGlobals *kg,
/* TODO(sergey): Same as above, after the release we should consider using
* 'noinline' for all devices.
*/
-ccl_device float background_map_pdf(const KernelGlobals *kg, float3 direction)
+ccl_device float background_map_pdf(ccl_global const KernelGlobals *kg, float3 direction)
{
float2 uv = direction_to_equirectangular(direction);
int res_x = kernel_data.background.map_res_x;
@@ -143,7 +143,11 @@ ccl_device float background_map_pdf(const KernelGlobals *kg, float3 direction)
}
ccl_device_inline bool background_portal_data_fetch_and_check_side(
- const KernelGlobals *kg, float3 P, int index, float3 *lightpos, float3 *dir)
+ ccl_global const KernelGlobals *kg,
+ float3 P,
+ int index,
+ ccl_private float3 *lightpos,
+ ccl_private float3 *dir)
{
int portal = kernel_data.background.portal_offset + index;
const ccl_global KernelLight *klight = &kernel_tex_fetch(__lights, portal);
@@ -158,8 +162,11 @@ ccl_device_inline bool background_portal_data_fetch_and_check_side(
return false;
}
-ccl_device_inline float background_portal_pdf(
- const KernelGlobals *kg, float3 P, float3 direction, int ignore_portal, bool *is_possible)
+ccl_device_inline float background_portal_pdf(ccl_global const KernelGlobals *kg,
+ float3 P,
+ float3 direction,
+ int ignore_portal,
+ ccl_private bool *is_possible)
{
float portal_pdf = 0.0f;
@@ -219,7 +226,7 @@ ccl_device_inline float background_portal_pdf(
return (num_possible > 0) ? portal_pdf / num_possible : 0.0f;
}
-ccl_device int background_num_possible_portals(const KernelGlobals *kg, float3 P)
+ccl_device int background_num_possible_portals(ccl_global const KernelGlobals *kg, float3 P)
{
int num_possible_portals = 0;
for (int p = 0; p < kernel_data.background.num_portals; p++) {
@@ -230,13 +237,13 @@ ccl_device int background_num_possible_portals(const KernelGlobals *kg, float3 P
return num_possible_portals;
}
-ccl_device float3 background_portal_sample(const KernelGlobals *kg,
+ccl_device float3 background_portal_sample(ccl_global const KernelGlobals *kg,
float3 P,
float randu,
float randv,
int num_possible,
- int *sampled_portal,
- float *pdf)
+ ccl_private int *sampled_portal,
+ ccl_private float *pdf)
{
/* Pick a portal, then re-normalize randv. */
randv *= num_possible;
@@ -285,10 +292,10 @@ ccl_device float3 background_portal_sample(const KernelGlobals *kg,
return zero_float3();
}
-ccl_device_inline float3 background_sun_sample(const KernelGlobals *kg,
+ccl_device_inline float3 background_sun_sample(ccl_global const KernelGlobals *kg,
float randu,
float randv,
- float *pdf)
+ ccl_private float *pdf)
{
float3 D;
const float3 N = float4_to_float3(kernel_data.background.sun);
@@ -297,15 +304,15 @@ ccl_device_inline float3 background_sun_sample(const KernelGlobals *kg,
return D;
}
-ccl_device_inline float background_sun_pdf(const KernelGlobals *kg, float3 D)
+ccl_device_inline float background_sun_pdf(ccl_global const KernelGlobals *kg, float3 D)
{
const float3 N = float4_to_float3(kernel_data.background.sun);
const float angle = kernel_data.background.sun.w;
return pdf_uniform_cone(N, D, angle);
}
-ccl_device_inline float3
-background_light_sample(const KernelGlobals *kg, float3 P, float randu, float randv, float *pdf)
+ccl_device_inline float3 background_light_sample(
+ ccl_global const KernelGlobals *kg, float3 P, float randu, float randv, ccl_private float *pdf)
{
float portal_method_pdf = kernel_data.background.portal_weight;
float sun_method_pdf = kernel_data.background.sun_weight;
@@ -405,7 +412,9 @@ background_light_sample(const KernelGlobals *kg, float3 P, float randu, float ra
return D;
}
-ccl_device float background_light_pdf(const KernelGlobals *kg, float3 P, float3 direction)
+ccl_device float background_light_pdf(ccl_global const KernelGlobals *kg,
+ float3 P,
+ float3 direction)
{
float portal_method_pdf = kernel_data.background.portal_weight;
float sun_method_pdf = kernel_data.background.sun_weight;