diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-21 18:00:37 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-21 22:25:34 +0300 |
commit | be558d2d9775b3d9d1f84d316d2675a205932d92 (patch) | |
tree | 0e3430fea912756561ed6a9fed32515c5dc75219 /intern/cycles | |
parent | aea2287af33c17c5f310ddb20f57d23d2cbe09ac (diff) |
Fix T92363: OptiX fails with ambient occlusion node, after recent changes
This triggered a compiler bug where it does not handle the sub.s16 PTX
instruction. Instead refactor the code so we don't need to do uint16_t
subtraction at all.
Also update OptiX device to remove the AO pass direct callable.
Thanks Patrick Mours for figuring this out.
Diffstat (limited to 'intern/cycles')
6 files changed, 8 insertions, 17 deletions
diff --git a/intern/cycles/device/optix/device_impl.cpp b/intern/cycles/device/optix/device_impl.cpp index 89f4b696b4c..29e46be7745 100644 --- a/intern/cycles/device/optix/device_impl.cpp +++ b/intern/cycles/device/optix/device_impl.cpp @@ -377,9 +377,6 @@ bool OptiXDevice::load_kernels(const uint kernel_features) group_descs[PG_CALL_SVM_BEVEL].callables.moduleDC = optix_module; group_descs[PG_CALL_SVM_BEVEL].callables.entryFunctionNameDC = "__direct_callable__svm_node_bevel"; - group_descs[PG_CALL_AO_PASS].kind = OPTIX_PROGRAM_GROUP_KIND_CALLABLES; - group_descs[PG_CALL_AO_PASS].callables.moduleDC = optix_module; - group_descs[PG_CALL_AO_PASS].callables.entryFunctionNameDC = "__direct_callable__ao_pass"; } optix_assert(optixProgramGroupCreate( diff --git a/intern/cycles/device/optix/device_impl.h b/intern/cycles/device/optix/device_impl.h index 3695ac6afc2..b20d42f8c61 100644 --- a/intern/cycles/device/optix/device_impl.h +++ b/intern/cycles/device/optix/device_impl.h @@ -45,7 +45,6 @@ enum { PG_HITS_MOTION, PG_CALL_SVM_AO, PG_CALL_SVM_BEVEL, - PG_CALL_AO_PASS, NUM_PROGRAM_GROUPS }; diff --git a/intern/cycles/kernel/integrator/integrator_shade_shadow.h b/intern/cycles/kernel/integrator/integrator_shade_shadow.h index 2d056a0b76f..a82254e1dea 100644 --- a/intern/cycles/kernel/integrator/integrator_shade_shadow.h +++ b/intern/cycles/kernel/integrator/integrator_shade_shadow.h @@ -136,6 +136,7 @@ ccl_device_inline bool integrate_transparent_shadow(KernelGlobals kg, INTEGRATOR_STATE_WRITE(state, shadow_path, throughput) = throughput; INTEGRATOR_STATE_WRITE(state, shadow_path, transparent_bounce) += 1; + INTEGRATOR_STATE_WRITE(state, shadow_path, rng_offset) += PRNG_BOUNCE_NUM; } /* Note we do not need to check max_transparent_bounce here, the number diff --git a/intern/cycles/kernel/integrator/integrator_shade_surface.h b/intern/cycles/kernel/integrator/integrator_shade_surface.h index 2fb0dcc2097..3724b05c6b0 100644 --- a/intern/cycles/kernel/integrator/integrator_shade_surface.h +++ b/intern/cycles/kernel/integrator/integrator_shade_surface.h @@ -200,9 +200,8 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg, INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, render_pixel_index) = INTEGRATOR_STATE( state, path, render_pixel_index); - INTEGRATOR_STATE_WRITE( - shadow_state, shadow_path, rng_offset) = INTEGRATOR_STATE(state, path, rng_offset) - - PRNG_BOUNCE_NUM * transparent_bounce; + INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, rng_offset) = INTEGRATOR_STATE( + state, path, rng_offset); INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, rng_hash) = INTEGRATOR_STATE( state, path, rng_hash); INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, sample) = INTEGRATOR_STATE( @@ -370,9 +369,8 @@ ccl_device_forceinline void integrate_surface_ao_pass( INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, render_pixel_index) = INTEGRATOR_STATE( state, path, render_pixel_index); - INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, rng_offset) = - INTEGRATOR_STATE(state, path, rng_offset) - - PRNG_BOUNCE_NUM * INTEGRATOR_STATE(state, path, transparent_bounce); + INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, rng_offset) = INTEGRATOR_STATE( + state, path, rng_offset); INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, rng_hash) = INTEGRATOR_STATE( state, path, rng_hash); INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, sample) = INTEGRATOR_STATE( diff --git a/intern/cycles/kernel/integrator/integrator_shade_volume.h b/intern/cycles/kernel/integrator/integrator_shade_volume.h index 1dd701237a8..d0aabb550c0 100644 --- a/intern/cycles/kernel/integrator/integrator_shade_volume.h +++ b/intern/cycles/kernel/integrator/integrator_shade_volume.h @@ -799,9 +799,8 @@ ccl_device_forceinline void integrate_volume_direct_light( INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, render_pixel_index) = INTEGRATOR_STATE( state, path, render_pixel_index); - INTEGRATOR_STATE_WRITE( - shadow_state, shadow_path, rng_offset) = INTEGRATOR_STATE(state, path, rng_offset) - - PRNG_BOUNCE_NUM * transparent_bounce; + INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, rng_offset) = INTEGRATOR_STATE( + state, path, rng_offset); INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, rng_hash) = INTEGRATOR_STATE( state, path, rng_hash); INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, sample) = INTEGRATOR_STATE( diff --git a/intern/cycles/kernel/kernel_path_state.h b/intern/cycles/kernel/kernel_path_state.h index 428eb3498f7..a0584f0b219 100644 --- a/intern/cycles/kernel/kernel_path_state.h +++ b/intern/cycles/kernel/kernel_path_state.h @@ -299,11 +299,8 @@ ccl_device_inline void path_state_rng_load(ConstIntegratorState state, ccl_device_inline void shadow_path_state_rng_load(ConstIntegratorShadowState state, ccl_private RNGState *rng_state) { - const uint shadow_bounces = INTEGRATOR_STATE(state, shadow_path, transparent_bounce); - rng_state->rng_hash = INTEGRATOR_STATE(state, shadow_path, rng_hash); - rng_state->rng_offset = INTEGRATOR_STATE(state, shadow_path, rng_offset) + - PRNG_BOUNCE_NUM * shadow_bounces; + rng_state->rng_offset = INTEGRATOR_STATE(state, shadow_path, rng_offset); rng_state->sample = INTEGRATOR_STATE(state, shadow_path, sample); } |