Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/integrator/integrator_megakernel.h
| Show All 23 Lines | |||||
| #include "kernel/integrator/integrator_shade_background.h" | #include "kernel/integrator/integrator_shade_background.h" | ||||
| #include "kernel/integrator/integrator_shade_light.h" | #include "kernel/integrator/integrator_shade_light.h" | ||||
| #include "kernel/integrator/integrator_shade_shadow.h" | #include "kernel/integrator/integrator_shade_shadow.h" | ||||
| #include "kernel/integrator/integrator_shade_surface.h" | #include "kernel/integrator/integrator_shade_surface.h" | ||||
| #include "kernel/integrator/integrator_shade_volume.h" | #include "kernel/integrator/integrator_shade_volume.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| ccl_device void integrator_megakernel(INTEGRATOR_STATE_ARGS, | ccl_device void integrator_megakernel(KernelGlobals kg, | ||||
| IntegratorState state, | |||||
| ccl_global float *ccl_restrict render_buffer) | ccl_global float *ccl_restrict render_buffer) | ||||
| { | { | ||||
| /* Each kernel indicates the next kernel to execute, so here we simply | /* Each kernel indicates the next kernel to execute, so here we simply | ||||
| * have to check what that kernel is and execute it. | * have to check what that kernel is and execute it. | ||||
| * | * | ||||
| * TODO: investigate if we can use device side enqueue for GPUs to avoid | * TODO: investigate if we can use device side enqueue for GPUs to avoid | ||||
| * having to compile this big kernel. */ | * having to compile this big kernel. */ | ||||
| while (true) { | while (true) { | ||||
| if (INTEGRATOR_STATE(shadow_path, queued_kernel)) { | if (INTEGRATOR_STATE(state, shadow_path, queued_kernel)) { | ||||
| /* First handle any shadow paths before we potentially create more shadow paths. */ | /* First handle any shadow paths before we potentially create more shadow paths. */ | ||||
| switch (INTEGRATOR_STATE(shadow_path, queued_kernel)) { | switch (INTEGRATOR_STATE(state, shadow_path, queued_kernel)) { | ||||
| case DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW: | case DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW: | ||||
| integrator_intersect_shadow(INTEGRATOR_STATE_PASS); | integrator_intersect_shadow(kg, state); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW: | case DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW: | ||||
| integrator_shade_shadow(INTEGRATOR_STATE_PASS, render_buffer); | integrator_shade_shadow(kg, state, render_buffer); | ||||
| break; | break; | ||||
| default: | default: | ||||
| kernel_assert(0); | kernel_assert(0); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| else if (INTEGRATOR_STATE(path, queued_kernel)) { | else if (INTEGRATOR_STATE(state, path, queued_kernel)) { | ||||
| /* Then handle regular path kernels. */ | /* Then handle regular path kernels. */ | ||||
| switch (INTEGRATOR_STATE(path, queued_kernel)) { | switch (INTEGRATOR_STATE(state, path, queued_kernel)) { | ||||
| case DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST: | case DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST: | ||||
| integrator_intersect_closest(INTEGRATOR_STATE_PASS); | integrator_intersect_closest(kg, state); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND: | case DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND: | ||||
| integrator_shade_background(INTEGRATOR_STATE_PASS, render_buffer); | integrator_shade_background(kg, state, render_buffer); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE: | case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE: | ||||
| integrator_shade_surface(INTEGRATOR_STATE_PASS, render_buffer); | integrator_shade_surface(kg, state, render_buffer); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME: | case DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME: | ||||
| integrator_shade_volume(INTEGRATOR_STATE_PASS, render_buffer); | integrator_shade_volume(kg, state, render_buffer); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE: | case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE: | ||||
| integrator_shade_surface_raytrace(INTEGRATOR_STATE_PASS, render_buffer); | integrator_shade_surface_raytrace(kg, state, render_buffer); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_SHADE_LIGHT: | case DEVICE_KERNEL_INTEGRATOR_SHADE_LIGHT: | ||||
| integrator_shade_light(INTEGRATOR_STATE_PASS, render_buffer); | integrator_shade_light(kg, state, render_buffer); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE: | case DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE: | ||||
| integrator_intersect_subsurface(INTEGRATOR_STATE_PASS); | integrator_intersect_subsurface(kg, state); | ||||
| break; | break; | ||||
| case DEVICE_KERNEL_INTEGRATOR_INTERSECT_VOLUME_STACK: | case DEVICE_KERNEL_INTEGRATOR_INTERSECT_VOLUME_STACK: | ||||
| integrator_intersect_volume_stack(INTEGRATOR_STATE_PASS); | integrator_intersect_volume_stack(kg, state); | ||||
| break; | break; | ||||
| default: | default: | ||||
| kernel_assert(0); | kernel_assert(0); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||