Cycles: Workaround for compilation error caused by passing KernelGlobals
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 8 Mar 2017 11:49:04 +0000 (12:49 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 16 Mar 2017 10:27:17 +0000 (11:27 +0100)
Pass globals as a bare pointer, same as it sued to be prior to split kernel rework.

AMD CPU platform and Intel OpenCL were complaining about this.

Perhaps we shouldn't pass globals as pointer at all, this isn't something what is
really portable and can cause issues on 32 bit perhaps.

17 files changed:
intern/cycles/kernel/kernels/opencl/kernel_buffer_update.cl
intern/cycles/kernel/kernels/opencl/kernel_data_init.cl
intern/cycles/kernel/kernels/opencl/kernel_direct_lighting.cl
intern/cycles/kernel/kernels/opencl/kernel_do_volume.cl
intern/cycles/kernel/kernels/opencl/kernel_holdout_emission_blurring_pathtermination_ao.cl
intern/cycles/kernel/kernels/opencl/kernel_indirect_background.cl
intern/cycles/kernel/kernels/opencl/kernel_indirect_subsurface.cl
intern/cycles/kernel/kernels/opencl/kernel_lamp_emission.cl
intern/cycles/kernel/kernels/opencl/kernel_next_iteration_setup.cl
intern/cycles/kernel/kernels/opencl/kernel_path_init.cl
intern/cycles/kernel/kernels/opencl/kernel_queue_enqueue.cl
intern/cycles/kernel/kernels/opencl/kernel_scene_intersect.cl
intern/cycles/kernel/kernels/opencl/kernel_shader_eval.cl
intern/cycles/kernel/kernels/opencl/kernel_shadow_blocked_ao.cl
intern/cycles/kernel/kernels/opencl/kernel_shadow_blocked_dl.cl
intern/cycles/kernel/kernels/opencl/kernel_state_buffer_size.cl
intern/cycles/kernel/kernels/opencl/kernel_subsurface_scatter.cl

index d3058501f27f6c7e0abb34cb1b0d17c659af6ab9..3c25d1d85a236cca64f2adb7e136e379c5c230e3 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_buffer_update.h"
 
 __kernel void kernel_ocl_path_trace_buffer_update(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_buffer_update(kg);
+       kernel_buffer_update((KernelGlobals*)kg);
 }
index 1e3c4fa28c7eeaf988481ed9d4c01b5cd47027f1..54d4a577e101f0cae61c2d54f566b7c2eb330bdc 100644 (file)
@@ -19,7 +19,7 @@
 #include "split/kernel_data_init.h"
 
 __kernel void kernel_ocl_path_trace_data_init(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data,
         ccl_global void *split_data_buffer,
         int num_elements,
@@ -40,7 +40,7 @@ __kernel void kernel_ocl_path_trace_data_init(
         unsigned int num_samples,                    /* Total number of samples per pixel */
         ccl_global float *buffer)
 {
-       kernel_data_init(kg,
+       kernel_data_init((KernelGlobals*)kg,
                         data,
                         split_data_buffer,
                         num_elements,
index 5d2f46b319d4ac55851231099c37dc4730399fef..942a80f94f55eac237232e8d638f9e5a630dab56 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_direct_lighting.h"
 
 __kernel void kernel_ocl_path_trace_direct_lighting(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_direct_lighting(kg);
+       kernel_direct_lighting((KernelGlobals*)kg);
 }
index 6380e9cb7469e7582829298d34bf6bfb2f15ad4d..08187b0e03e085126cbd955bbf8b955446a88e86 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_do_volume.h"
 
 __kernel void kernel_ocl_path_trace_do_volume(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_do_volume(kg);
+       kernel_do_volume((KernelGlobals*)kg);
 }
index 7724b8a0bdfd0adcd544182bd32c7b4ea24445ef..209080fecd63ae7756084e9b47d3975874b94eab 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_holdout_emission_blurring_pathtermination_ao.h"
 
 __kernel void kernel_ocl_path_trace_holdout_emission_blurring_pathtermination_ao(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_holdout_emission_blurring_pathtermination_ao(kg);
+       kernel_holdout_emission_blurring_pathtermination_ao((KernelGlobals*)kg);
 }
index 671501bf2375cd2992fc26a90cabd24fe2ef6dc6..b18fba4c01f06319767d3ada571f18ed3987af6b 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_indirect_background.h"
 
 __kernel void kernel_ocl_path_trace_indirect_background(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_indirect_background(kg);
+       kernel_indirect_background((KernelGlobals*)kg);
 }
index b5e52e81ebf07bdb2e9a63c28080d4f5d94901c2..ce2e96ad7895d007ed9b8d09bcfadca09d93e9fb 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_indirect_subsurface.h"
 
 __kernel void kernel_ocl_path_trace_indirect_subsurface(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_indirect_subsurface(kg);
+       kernel_indirect_subsurface((KernelGlobals*)kg);
 }
index 2b84d0ea43eb2d87e1dea84b9c062da64a27a2c3..830e4e373acacafd1652c1f5d7a45a233d727efc 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_lamp_emission.h"
 
 __kernel void kernel_ocl_path_trace_lamp_emission(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_lamp_emission(kg);
+       kernel_lamp_emission((KernelGlobals*)kg);
 }
index e87e367fb9c1505ba88ee8f0aba7a01d9636cbad..2a007e39c33314cd9df44be47a564db23a2945cf 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_next_iteration_setup.h"
 
 __kernel void kernel_ocl_path_trace_next_iteration_setup(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_next_iteration_setup(kg);
+       kernel_next_iteration_setup((KernelGlobals*)kg);
 }
index 7e9e4a0252901f7b30f113b550c8aa5d75cb7dda..8194f5d22caba01ade228ce5a13b90fb2335b106 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_path_init.h"
 
 __kernel void kernel_ocl_path_trace_path_init(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_path_init(kg);
+       kernel_path_init((KernelGlobals*)kg);
 }
index 9ceb6a5c3d8a082ee2b1c9054113a410a48f40b2..19074db1b811f6f179896163c7d10cdad472b747 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_queue_enqueue.h"
 
 __kernel void kernel_ocl_path_trace_queue_enqueue(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_queue_enqueue(kg);
+       kernel_queue_enqueue((KernelGlobals*)kg);
 }
index 4e083e87d1c0340656c405e533852640400407b2..c675640c5998ffeb9a1b6f302125bec6b1cb9185 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_scene_intersect.h"
 
 __kernel void kernel_ocl_path_trace_scene_intersect(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_scene_intersect(kg);
+       kernel_scene_intersect((KernelGlobals*)kg);
 }
index a2b48b15928c84f7cf8122c768f6153f095f14e8..534d37f695bcc72598e090c997ec3533e3fbf6aa 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_shader_eval.h"
 
 __kernel void kernel_ocl_path_trace_shader_eval(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_shader_eval(kg);
+       kernel_shader_eval((KernelGlobals*)kg);
 }
index 1c96d67fec2f8cb478089a93a9ca9fa5bb36dcbd..378240970315732d6339c5f42a227dae5853fb9e 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_shadow_blocked_ao.h"
 
 __kernel void kernel_ocl_path_trace_shadow_blocked_ao(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_shadow_blocked_ao(kg);
+       kernel_shadow_blocked_ao((KernelGlobals*)kg);
 }
index 2231f767c0cf9cf743f97f76f7841c317fda7110..4889f49d8dc66e9d90e3f8336f16a729b996205c 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_shadow_blocked_dl.h"
 
 __kernel void kernel_ocl_path_trace_shadow_blocked_dl(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_shadow_blocked_dl(kg);
+       kernel_shadow_blocked_dl((KernelGlobals*)kg);
 }
index 4c9bf63ef5121056b820a6213f107719bb400259..b23ff33786d163527f8cadd70c5b2bc404c01749 100644 (file)
 #include "split/kernel_split_common.h"
 
 __kernel void kernel_ocl_path_trace_state_buffer_size(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data,
         uint num_threads,
         ccl_global uint64_t *size)
 {
-       kg->data = data;
-       *size = split_data_buffer_size(kg, num_threads);
+       ((KernelGlobals*)kg)->data = data;
+       *size = split_data_buffer_size((KernelGlobals*)kg, num_threads);
 }
 
index 8dae79bacb09e180e3f484d83c9bfffeb7848ea4..34a01bbdfe360324624eef33adbb708f24b9c8fd 100644 (file)
@@ -19,8 +19,8 @@
 #include "split/kernel_subsurface_scatter.h"
 
 __kernel void kernel_ocl_path_trace_subsurface_scatter(
-        KernelGlobals *kg,
+        ccl_global char *kg,
         ccl_constant KernelData *data)
 {
-       kernel_subsurface_scatter(kg);
+       kernel_subsurface_scatter((KernelGlobals*)kg);
 }