virtual void load_kernels(const DeviceRequestedFeatures& requested_features, vector<OpenCLProgram*> &programs) { string build_options = "-D__SPLIT_KERNEL__ "; #ifdef __WORK_STEALING__ build_options += "-D__WORK_STEALING__ "; #endif build_options += requested_features.get_build_options(); /* Set compute device build option. */ cl_device_type device_type; ciErr = clGetDeviceInfo(cdDevice, CL_DEVICE_TYPE, sizeof(cl_device_type), &device_type, NULL); assert(ciErr == CL_SUCCESS); if(device_type == CL_DEVICE_TYPE_GPU) { build_options += " -D__COMPUTE_DEVICE_GPU__"; } #define GLUE(a, b) a ## b #define LOAD_KERNEL(name) \ do { \ GLUE(program_, name) = OpenCLProgram(this, "split_" #name, "kernel_" #name ".cl", build_options); \ GLUE(program_, name).add_kernel(ustring("path_trace_" #name)); \ programs.push_back(&GLUE(program_, name)); \ } while(false) LOAD_KERNEL(data_init); LOAD_KERNEL(scene_intersect); LOAD_KERNEL(lamp_emission); LOAD_KERNEL(queue_enqueue); LOAD_KERNEL(background_buffer_update); LOAD_KERNEL(shader_eval); LOAD_KERNEL(holdout_emission_blurring_pathtermination_ao); LOAD_KERNEL(direct_lighting); LOAD_KERNEL(shadow_blocked); LOAD_KERNEL(next_iteration_setup); LOAD_KERNEL(sum_all_radiance); #undef FIND_KERNEL #undef GLUE current_max_closure = requested_features.max_closure; }
bool DeviceSplitKernel::load_kernels(const DeviceRequestedFeatures& requested_features) { #define LOAD_KERNEL(name) \ kernel_##name = get_split_kernel_function(#name, requested_features); \ if(!kernel_##name) { \ device->set_error(string("Split kernel error: failed to load kernel_") + #name); \ return false; \ } LOAD_KERNEL(path_init); LOAD_KERNEL(scene_intersect); LOAD_KERNEL(lamp_emission); LOAD_KERNEL(do_volume); LOAD_KERNEL(queue_enqueue); LOAD_KERNEL(indirect_background); LOAD_KERNEL(shader_setup); LOAD_KERNEL(shader_sort); LOAD_KERNEL(shader_eval); LOAD_KERNEL(holdout_emission_blurring_pathtermination_ao); LOAD_KERNEL(subsurface_scatter); LOAD_KERNEL(direct_lighting); LOAD_KERNEL(shadow_blocked_ao); LOAD_KERNEL(shadow_blocked_dl); LOAD_KERNEL(enqueue_inactive); LOAD_KERNEL(next_iteration_setup); LOAD_KERNEL(indirect_subsurface); LOAD_KERNEL(buffer_update); #undef LOAD_KERNEL return true; }