Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-05-26 17:12:49 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-05-26 20:54:02 +0300
commit84ad20acef4c0db91c9a850e81c7dc0a57aef42a (patch)
treec789ed8b455b6870ea12b87a2dc7ed3c28d77102 /intern/cycles/kernel/split/kernel_data_init.h
parent4ffcc6ff56b60d1cc69e12a80c9c2cacd604688f (diff)
Fix T44833: Can't use ccl_local space in non-kernel functions
This commit re-shuffles code in split kernel once again and makes it so common parts which is in the headers is only responsible to making all the work needed for specified ray index. Getting ray index, checking for it's validity and enqueuing tasks are now happening in the device specified part of the kernel. This actually makes sense because enqueuing is indeed device-specified and i.e. with CUDA we'll want to enqueue kernels from kernel and avoid CPU roundtrip. TODO: - Kernel comments are still placed in the common header files, but since queue related stuff is not passed to those functions those comments might need to be split as well. Just currently read them considering that they're also covering the way how all devices are invoking the common code path. - Arguments might need to be wrapped into KernelGlobals, so we don't ened to pass all them around as function arguments.
Diffstat (limited to 'intern/cycles/kernel/split/kernel_data_init.h')
-rw-r--r--intern/cycles/kernel/split/kernel_data_init.h180
1 files changed, 89 insertions, 91 deletions
diff --git a/intern/cycles/kernel/split/kernel_data_init.h b/intern/cycles/kernel/split/kernel_data_init.h
index 006f2c8e4df..5e054bdab32 100644
--- a/intern/cycles/kernel/split/kernel_data_init.h
+++ b/intern/cycles/kernel/split/kernel_data_init.h
@@ -16,8 +16,7 @@
#include "kernel_split_common.h"
-/*
- * Note on kernel_data_initialization kernel
+/* Note on kernel_data_initialization kernel
* This kernel Initializes structures needed in path-iteration kernels.
* This is the first kernel in ray-tracing logic.
*
@@ -51,131 +50,130 @@
* All slots in queues are initialized to queue empty slot;
* The number of elements in the queues is initialized to 0;
*/
-__kernel void kernel_data_init(
- ccl_global char *globals,
- ccl_global char *shader_data_sd, /* Arguments related to ShaderData */
- ccl_global char *shader_data_sd_DL_shadow, /* Arguments related to ShaderData */
+ccl_device void kernel_data_init(
+ ccl_global char *globals,
+ ccl_global char *shader_data_sd, /* Arguments related to ShaderData */
+ ccl_global char *shader_data_sd_DL_shadow, /* Arguments related to ShaderData */
- ccl_global float3 *P_sd,
- ccl_global float3 *P_sd_DL_shadow,
+ ccl_global float3 *P_sd,
+ ccl_global float3 *P_sd_DL_shadow,
- ccl_global float3 *N_sd,
- ccl_global float3 *N_sd_DL_shadow,
+ ccl_global float3 *N_sd,
+ ccl_global float3 *N_sd_DL_shadow,
- ccl_global float3 *Ng_sd,
- ccl_global float3 *Ng_sd_DL_shadow,
+ ccl_global float3 *Ng_sd,
+ ccl_global float3 *Ng_sd_DL_shadow,
- ccl_global float3 *I_sd,
- ccl_global float3 *I_sd_DL_shadow,
+ ccl_global float3 *I_sd,
+ ccl_global float3 *I_sd_DL_shadow,
- ccl_global int *shader_sd,
- ccl_global int *shader_sd_DL_shadow,
+ ccl_global int *shader_sd,
+ ccl_global int *shader_sd_DL_shadow,
- ccl_global int *flag_sd,
- ccl_global int *flag_sd_DL_shadow,
+ ccl_global int *flag_sd,
+ ccl_global int *flag_sd_DL_shadow,
- ccl_global int *prim_sd,
- ccl_global int *prim_sd_DL_shadow,
+ ccl_global int *prim_sd,
+ ccl_global int *prim_sd_DL_shadow,
- ccl_global int *type_sd,
- ccl_global int *type_sd_DL_shadow,
+ ccl_global int *type_sd,
+ ccl_global int *type_sd_DL_shadow,
- ccl_global float *u_sd,
- ccl_global float *u_sd_DL_shadow,
+ ccl_global float *u_sd,
+ ccl_global float *u_sd_DL_shadow,
- ccl_global float *v_sd,
- ccl_global float *v_sd_DL_shadow,
+ ccl_global float *v_sd,
+ ccl_global float *v_sd_DL_shadow,
- ccl_global int *object_sd,
- ccl_global int *object_sd_DL_shadow,
+ ccl_global int *object_sd,
+ ccl_global int *object_sd_DL_shadow,
- ccl_global float *time_sd,
- ccl_global float *time_sd_DL_shadow,
+ ccl_global float *time_sd,
+ ccl_global float *time_sd_DL_shadow,
- ccl_global float *ray_length_sd,
- ccl_global float *ray_length_sd_DL_shadow,
+ ccl_global float *ray_length_sd,
+ ccl_global float *ray_length_sd_DL_shadow,
- ccl_global int *ray_depth_sd,
- ccl_global int *ray_depth_sd_DL_shadow,
+ ccl_global int *ray_depth_sd,
+ ccl_global int *ray_depth_sd_DL_shadow,
- ccl_global int *transparent_depth_sd,
- ccl_global int *transparent_depth_sd_DL_shadow,
+ ccl_global int *transparent_depth_sd,
+ ccl_global int *transparent_depth_sd_DL_shadow,
- /* Ray differentials. */
- ccl_global differential3 *dP_sd,
- ccl_global differential3 *dP_sd_DL_shadow,
+ /* Ray differentials. */
+ ccl_global differential3 *dP_sd,
+ ccl_global differential3 *dP_sd_DL_shadow,
- ccl_global differential3 *dI_sd,
- ccl_global differential3 *dI_sd_DL_shadow,
+ ccl_global differential3 *dI_sd,
+ ccl_global differential3 *dI_sd_DL_shadow,
- ccl_global differential *du_sd,
- ccl_global differential *du_sd_DL_shadow,
+ ccl_global differential *du_sd,
+ ccl_global differential *du_sd_DL_shadow,
- ccl_global differential *dv_sd,
- ccl_global differential *dv_sd_DL_shadow,
+ ccl_global differential *dv_sd,
+ ccl_global differential *dv_sd_DL_shadow,
- /* Dp/Du */
- ccl_global float3 *dPdu_sd,
- ccl_global float3 *dPdu_sd_DL_shadow,
+ /* Dp/Du */
+ ccl_global float3 *dPdu_sd,
+ ccl_global float3 *dPdu_sd_DL_shadow,
- ccl_global float3 *dPdv_sd,
- ccl_global float3 *dPdv_sd_DL_shadow,
+ ccl_global float3 *dPdv_sd,
+ ccl_global float3 *dPdv_sd_DL_shadow,
- /* Object motion. */
- ccl_global Transform *ob_tfm_sd,
- ccl_global Transform *ob_tfm_sd_DL_shadow,
+ /* Object motion. */
+ ccl_global Transform *ob_tfm_sd,
+ ccl_global Transform *ob_tfm_sd_DL_shadow,
- ccl_global Transform *ob_itfm_sd,
- ccl_global Transform *ob_itfm_sd_DL_shadow,
+ ccl_global Transform *ob_itfm_sd,
+ ccl_global Transform *ob_itfm_sd_DL_shadow,
- ShaderClosure *closure_sd,
- ShaderClosure *closure_sd_DL_shadow,
+ ShaderClosure *closure_sd,
+ ShaderClosure *closure_sd_DL_shadow,
- ccl_global int *num_closure_sd,
- ccl_global int *num_closure_sd_DL_shadow,
+ ccl_global int *num_closure_sd,
+ ccl_global int *num_closure_sd_DL_shadow,
- ccl_global float *randb_closure_sd,
- ccl_global float *randb_closure_sd_DL_shadow,
+ ccl_global float *randb_closure_sd,
+ ccl_global float *randb_closure_sd_DL_shadow,
- ccl_global float3 *ray_P_sd,
- ccl_global float3 *ray_P_sd_DL_shadow,
+ ccl_global float3 *ray_P_sd,
+ ccl_global float3 *ray_P_sd_DL_shadow,
- ccl_global differential3 *ray_dP_sd,
- ccl_global differential3 *ray_dP_sd_DL_shadow,
+ ccl_global differential3 *ray_dP_sd,
+ ccl_global differential3 *ray_dP_sd_DL_shadow,
- ccl_constant KernelData *data,
- ccl_global float *per_sample_output_buffers,
- ccl_global uint *rng_state,
- ccl_global uint *rng_coop, /* rng array to store rng values for all rays */
- ccl_global float3 *throughput_coop, /* throughput array to store throughput values for all rays */
- ccl_global float *L_transparent_coop, /* L_transparent array to store L_transparent values for all rays */
- PathRadiance *PathRadiance_coop, /* PathRadiance array to store PathRadiance values for all rays */
- ccl_global Ray *Ray_coop, /* Ray array to store Ray information for all rays */
- ccl_global PathState *PathState_coop, /* PathState array to store PathState information for all rays */
- ccl_global char *ray_state, /* Stores information on current state of a ray */
+ ccl_constant KernelData *data,
+ ccl_global float *per_sample_output_buffers,
+ ccl_global uint *rng_state,
+ ccl_global uint *rng_coop, /* rng array to store rng values for all rays */
+ ccl_global float3 *throughput_coop, /* throughput array to store throughput values for all rays */
+ ccl_global float *L_transparent_coop, /* L_transparent array to store L_transparent values for all rays */
+ PathRadiance *PathRadiance_coop, /* PathRadiance array to store PathRadiance values for all rays */
+ ccl_global Ray *Ray_coop, /* Ray array to store Ray information for all rays */
+ ccl_global PathState *PathState_coop, /* PathState array to store PathState information for all rays */
+ ccl_global char *ray_state, /* Stores information on current state of a ray */
-#define KERNEL_TEX(type, ttype, name) \
- ccl_global type *name,
+#define KERNEL_TEX(type, ttype, name) \
+ ccl_global type *name,
#include "../kernel_textures.h"
- int start_sample, int sx, int sy, int sw, int sh, int offset, int stride,
- int rng_state_offset_x,
- int rng_state_offset_y,
- int rng_state_stride,
- ccl_global int *Queue_data, /* Memory for queues */
- ccl_global int *Queue_index, /* Tracks the number of elements in queues */
- int queuesize, /* size (capacity) of the queue */
- ccl_global char *use_queues_flag, /* flag to decide if scene-intersect kernel should use queues to fetch ray index */
- ccl_global unsigned int *work_array, /* work array to store which work each ray belongs to */
+ int start_sample, int sx, int sy, int sw, int sh, int offset, int stride,
+ int rng_state_offset_x,
+ int rng_state_offset_y,
+ int rng_state_stride,
+ ccl_global int *Queue_data, /* Memory for queues */
+ ccl_global int *Queue_index, /* Tracks the number of elements in queues */
+ int queuesize, /* size (capacity) of the queue */
+ ccl_global char *use_queues_flag, /* flag to decide if scene-intersect kernel should use queues to fetch ray index */
+ ccl_global unsigned int *work_array, /* work array to store which work each ray belongs to */
#ifdef __WORK_STEALING__
- ccl_global unsigned int *work_pool_wgs, /* Work pool for each work group */
- unsigned int num_samples, /* Total number of samples per pixel */
+ ccl_global unsigned int *work_pool_wgs, /* Work pool for each work group */
+ unsigned int num_samples, /* Total number of samples per pixel */
#endif
#ifdef __KERNEL_DEBUG__
- DebugData *debugdata_coop,
+ DebugData *debugdata_coop,
#endif
- int parallel_samples /* Number of samples to be processed in parallel */
- )
+ int parallel_samples) /* Number of samples to be processed in parallel */
{
/* Load kernel globals structure */