diff options
author | Brecht Van Lommel <brecht> | 2021-10-17 17:10:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-18 20:02:10 +0300 |
commit | 1df3b51988852fa8ee6b530a64aa23346db9acd4 (patch) | |
tree | dd79dba4c8ff8bb8474cc399e9d1b308d845e0cb /intern/cycles/kernel/kernel_light_background.h | |
parent | 44c3bb729be42d6d67eaf8918d7cbcb2ff0b315d (diff) |
Cycles: replace integrator state argument macros
* Rename struct KernelGlobals to struct KernelGlobalsCPU
* Add KernelGlobals, IntegratorState and ConstIntegratorState typedefs
that every device can define in its own way.
* Remove INTEGRATOR_STATE_ARGS and INTEGRATOR_STATE_PASS macros and
replace with these new typedefs.
* Add explicit state argument to INTEGRATOR_STATE and similar macros
In preparation for decoupling main and shadow paths.
Differential Revision: https://developer.blender.org/D12888
Diffstat (limited to 'intern/cycles/kernel/kernel_light_background.h')
-rw-r--r-- | intern/cycles/kernel/kernel_light_background.h | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/intern/cycles/kernel/kernel_light_background.h b/intern/cycles/kernel/kernel_light_background.h index 3669ff50455..2e828b8b765 100644 --- a/intern/cycles/kernel/kernel_light_background.h +++ b/intern/cycles/kernel/kernel_light_background.h @@ -24,7 +24,7 @@ CCL_NAMESPACE_BEGIN #ifdef __BACKGROUND_MIS__ -ccl_device float3 background_map_sample(ccl_global const KernelGlobals *kg, +ccl_device float3 background_map_sample(KernelGlobals kg, float randu, float randv, ccl_private float *pdf) @@ -109,7 +109,7 @@ ccl_device float3 background_map_sample(ccl_global 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(ccl_global const KernelGlobals *kg, float3 direction) +ccl_device float background_map_pdf(KernelGlobals kg, float3 direction) { float2 uv = direction_to_equirectangular(direction); int res_x = kernel_data.background.map_res_x; @@ -143,11 +143,7 @@ ccl_device float background_map_pdf(ccl_global const KernelGlobals *kg, float3 d } ccl_device_inline bool background_portal_data_fetch_and_check_side( - ccl_global const KernelGlobals *kg, - float3 P, - int index, - ccl_private float3 *lightpos, - ccl_private float3 *dir) + 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); @@ -162,11 +158,8 @@ ccl_device_inline bool background_portal_data_fetch_and_check_side( return false; } -ccl_device_inline float background_portal_pdf(ccl_global const KernelGlobals *kg, - float3 P, - float3 direction, - int ignore_portal, - ccl_private bool *is_possible) +ccl_device_inline float background_portal_pdf( + KernelGlobals kg, float3 P, float3 direction, int ignore_portal, ccl_private bool *is_possible) { float portal_pdf = 0.0f; @@ -226,7 +219,7 @@ ccl_device_inline float background_portal_pdf(ccl_global const KernelGlobals *kg return (num_possible > 0) ? portal_pdf / num_possible : 0.0f; } -ccl_device int background_num_possible_portals(ccl_global const KernelGlobals *kg, float3 P) +ccl_device int background_num_possible_portals(KernelGlobals kg, float3 P) { int num_possible_portals = 0; for (int p = 0; p < kernel_data.background.num_portals; p++) { @@ -237,7 +230,7 @@ ccl_device int background_num_possible_portals(ccl_global const KernelGlobals *k return num_possible_portals; } -ccl_device float3 background_portal_sample(ccl_global const KernelGlobals *kg, +ccl_device float3 background_portal_sample(KernelGlobals kg, float3 P, float randu, float randv, @@ -292,7 +285,7 @@ ccl_device float3 background_portal_sample(ccl_global const KernelGlobals *kg, return zero_float3(); } -ccl_device_inline float3 background_sun_sample(ccl_global const KernelGlobals *kg, +ccl_device_inline float3 background_sun_sample(KernelGlobals kg, float randu, float randv, ccl_private float *pdf) @@ -304,7 +297,7 @@ ccl_device_inline float3 background_sun_sample(ccl_global const KernelGlobals *k return D; } -ccl_device_inline float background_sun_pdf(ccl_global const KernelGlobals *kg, float3 D) +ccl_device_inline float background_sun_pdf(KernelGlobals kg, float3 D) { const float3 N = float4_to_float3(kernel_data.background.sun); const float angle = kernel_data.background.sun.w; @@ -312,7 +305,7 @@ ccl_device_inline float background_sun_pdf(ccl_global const KernelGlobals *kg, f } ccl_device_inline float3 background_light_sample( - ccl_global const KernelGlobals *kg, float3 P, float randu, float randv, ccl_private float *pdf) + 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; @@ -412,9 +405,7 @@ ccl_device_inline float3 background_light_sample( return D; } -ccl_device float background_light_pdf(ccl_global const KernelGlobals *kg, - float3 P, - float3 direction) +ccl_device float background_light_pdf(KernelGlobals kg, float3 P, float3 direction) { float portal_method_pdf = kernel_data.background.portal_weight; float sun_method_pdf = kernel_data.background.sun_weight; |