kernel_split_function.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright 2011-2017 Blender Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #define KERNEL_NAME_JOIN(a, b) a##_##b
  17. #define KERNEL_NAME_EVAL(a, b) KERNEL_NAME_JOIN(a, b)
  18. __kernel void KERNEL_NAME_EVAL(kernel_ocl_path_trace,
  19. KERNEL_NAME)(ccl_global char *kg_global,
  20. ccl_constant KernelData *data,
  21. ccl_global void *split_data_buffer,
  22. ccl_global char *ray_state,
  23. KERNEL_BUFFER_PARAMS,
  24. ccl_global int *queue_index,
  25. ccl_global char *use_queues_flag,
  26. ccl_global unsigned int *work_pools,
  27. ccl_global float *buffer)
  28. {
  29. #ifdef LOCALS_TYPE
  30. ccl_local LOCALS_TYPE locals;
  31. #endif
  32. KernelGlobals *kg = (KernelGlobals *)kg_global;
  33. if (ccl_local_id(0) + ccl_local_id(1) == 0) {
  34. kg->data = data;
  35. kernel_split_params.queue_index = queue_index;
  36. kernel_split_params.use_queues_flag = use_queues_flag;
  37. kernel_split_params.work_pools = work_pools;
  38. kernel_split_params.tile.buffer = buffer;
  39. split_data_init(kg,
  40. &kernel_split_state,
  41. ccl_global_size(0) * ccl_global_size(1),
  42. split_data_buffer,
  43. ray_state);
  44. }
  45. kernel_set_buffer_pointers(kg, KERNEL_BUFFER_ARGS);
  46. KERNEL_NAME_EVAL(kernel, KERNEL_NAME)
  47. (kg
  48. #ifdef LOCALS_TYPE
  49. ,
  50. &locals
  51. #endif
  52. );
  53. }
  54. #undef KERNEL_NAME_JOIN
  55. #undef KERNEL_NAME_EVAL