diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2017-02-16 14:24:13 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2017-03-08 08:52:41 +0300 |
commit | 352ee7c3ef2b84568dd419edd208eb6619498f45 (patch) | |
tree | e1ab6a381c02b34245031111507db59eac25705b /intern/cycles/kernel/split | |
parent | a87766416ff2fe1ab942b26031782c550b5bb7a1 (diff) |
Cycles: Remove ccl_fetch and SOA
Diffstat (limited to 'intern/cycles/kernel/split')
8 files changed, 25 insertions, 25 deletions
diff --git a/intern/cycles/kernel/split/kernel_background_buffer_update.h b/intern/cycles/kernel/split/kernel_background_buffer_update.h index 6d48856eb44..07e5522c830 100644 --- a/intern/cycles/kernel/split/kernel_background_buffer_update.h +++ b/intern/cycles/kernel/split/kernel_background_buffer_update.h @@ -156,7 +156,7 @@ ccl_device void kernel_background_buffer_update(KernelGlobals *kg) if(IS_STATE(ray_state, ray_index, RAY_HIT_BACKGROUND)) { #ifdef __BACKGROUND__ /* sample background shader */ - float3 L_background = indirect_background(kg, kernel_split_state.sd_DL_shadow, state, ray); + float3 L_background = indirect_background(kg, &kernel_split_state.sd_DL_shadow[ray_index], state, ray); path_radiance_accum_background(L, (*throughput), L_background, state->bounce); #endif ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER); @@ -210,7 +210,7 @@ ccl_device void kernel_background_buffer_update(KernelGlobals *kg) *throughput = make_float3(1.0f, 1.0f, 1.0f); *L_transparent = 0.0f; path_radiance_init(L, kernel_data.film.use_light_pass); - path_state_init(kg, kernel_split_state.sd_DL_shadow, state, rng, sample, ray); + path_state_init(kg, &kernel_split_state.sd_DL_shadow[ray_index], state, rng, sample, ray); #ifdef __KERNEL_DEBUG__ debug_data_init(debug_data); #endif diff --git a/intern/cycles/kernel/split/kernel_data_init.h b/intern/cycles/kernel/split/kernel_data_init.h index eeeb5294fdc..3251c091468 100644 --- a/intern/cycles/kernel/split/kernel_data_init.h +++ b/intern/cycles/kernel/split/kernel_data_init.h @@ -190,7 +190,7 @@ ccl_device void kernel_data_init( kernel_split_state.L_transparent[ray_index] = 0.0f; path_radiance_init(&kernel_split_state.path_radiance[ray_index], kernel_data.film.use_light_pass); path_state_init(kg, - kernel_split_state.sd_DL_shadow, + &kernel_split_state.sd_DL_shadow[ray_index], &kernel_split_state.path_state[ray_index], &kernel_split_state.rng[ray_index], my_sample, diff --git a/intern/cycles/kernel/split/kernel_direct_lighting.h b/intern/cycles/kernel/split/kernel_direct_lighting.h index 43b943710a1..5163b8edc04 100644 --- a/intern/cycles/kernel/split/kernel_direct_lighting.h +++ b/intern/cycles/kernel/split/kernel_direct_lighting.h @@ -82,12 +82,12 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg) if(IS_STATE(kernel_split_state.ray_state, ray_index, RAY_ACTIVE)) { ccl_global PathState *state = &kernel_split_state.path_state[ray_index]; - ShaderData *sd = kernel_split_state.sd; + ShaderData *sd = &kernel_split_state.sd[ray_index]; /* direct lighting */ #ifdef __EMISSION__ if((kernel_data.integrator.use_direct_light && - (ccl_fetch(sd, flag) & SD_BSDF_HAS_EVAL))) + (sd->flag & SD_BSDF_HAS_EVAL))) { /* Sample illumination from lights to find path contribution. */ ccl_global RNG* rng = &kernel_split_state.rng[ray_index]; @@ -99,19 +99,19 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg) LightSample ls; if(light_sample(kg, light_t, light_u, light_v, - ccl_fetch(sd, time), - ccl_fetch(sd, P), + sd->time, + sd->P, state->bounce, &ls)) { Ray light_ray; #ifdef __OBJECT_MOTION__ - light_ray.time = ccl_fetch(sd, time); + light_ray.time = sd->time; #endif BsdfEval L_light; bool is_lamp; - if(direct_emission(kg, sd, kernel_split_state.sd_DL_shadow, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) { + if(direct_emission(kg, sd, &kernel_split_state.sd_DL_shadow[ray_index], &ls, state, &light_ray, &L_light, &is_lamp, terminate)) { /* Write intermediate data to global memory to access from * the next kernel. */ diff --git a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h index 3a7f1629e66..ee9c4280b22 100644 --- a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h +++ b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h @@ -122,7 +122,7 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(KernelGlobal float3 throughput; ccl_global char *ray_state = kernel_split_state.ray_state; - ShaderData *sd = kernel_split_state.sd; + ShaderData *sd = &kernel_split_state.sd[ray_index]; ccl_global float *per_sample_output_buffers = kernel_split_state.per_sample_output_buffers; if(IS_STATE(ray_state, ray_index, RAY_ACTIVE)) { @@ -145,13 +145,13 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(KernelGlobal /* holdout */ #ifdef __HOLDOUT__ - if(((ccl_fetch(sd, flag) & SD_HOLDOUT) || - (ccl_fetch(sd, object_flag) & SD_OBJECT_HOLDOUT_MASK)) && + if(((sd->flag & SD_HOLDOUT) || + (sd->object_flag & SD_OBJECT_HOLDOUT_MASK)) && (state->flag & PATH_RAY_CAMERA)) { if(kernel_data.background.transparent) { float3 holdout_weight; - if(ccl_fetch(sd, object_flag) & SD_OBJECT_HOLDOUT_MASK) { + if(sd->object_flag & SD_OBJECT_HOLDOUT_MASK) { holdout_weight = make_float3(1.0f, 1.0f, 1.0f); } else { @@ -160,7 +160,7 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(KernelGlobal /* any throughput is ok, should all be identical here */ kernel_split_state.L_transparent[ray_index] += average(holdout_weight*throughput); } - if(ccl_fetch(sd, object_flag) & SD_OBJECT_HOLDOUT_MASK) { + if(sd->object_flag & SD_OBJECT_HOLDOUT_MASK) { ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER); enqueue_flag = 1; } @@ -191,7 +191,7 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(KernelGlobal #ifdef __EMISSION__ /* emission */ - if(ccl_fetch(sd, flag) & SD_EMISSION) { + if(sd->flag & SD_EMISSION) { /* TODO(sergey): is isect.t wrong here for transparent surfaces? */ float3 emission = indirect_primitive_emission( kg, @@ -232,7 +232,7 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(KernelGlobal if(IS_STATE(ray_state, ray_index, RAY_ACTIVE)) { /* ambient occlusion */ if(kernel_data.integrator.use_ambient_occlusion || - (ccl_fetch(sd, flag) & SD_AO)) + (sd->flag & SD_AO)) { /* todo: solve correlation */ float bsdf_u, bsdf_v; @@ -247,15 +247,15 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(KernelGlobal float ao_pdf; sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf); - if(dot(ccl_fetch(sd, Ng), ao_D) > 0.0f && ao_pdf != 0.0f) { + if(dot(sd->Ng, ao_D) > 0.0f && ao_pdf != 0.0f) { Ray _ray; - _ray.P = ray_offset(ccl_fetch(sd, P), ccl_fetch(sd, Ng)); + _ray.P = ray_offset(sd->P, sd->Ng); _ray.D = ao_D; _ray.t = kernel_data.background.ao_distance; #ifdef __OBJECT_MOTION__ - _ray.time = ccl_fetch(sd, time); + _ray.time = sd->time; #endif - _ray.dP = ccl_fetch(sd, dP); + _ray.dP = sd->dP; _ray.dD = differential3_zero(); kernel_split_state.ao_light_ray[ray_index] = _ray; diff --git a/intern/cycles/kernel/split/kernel_lamp_emission.h b/intern/cycles/kernel/split/kernel_lamp_emission.h index a9820af3001..261625da31d 100644 --- a/intern/cycles/kernel/split/kernel_lamp_emission.h +++ b/intern/cycles/kernel/split/kernel_lamp_emission.h @@ -85,7 +85,7 @@ ccl_device void kernel_lamp_emission(KernelGlobals *kg) /* intersect with lamp */ float3 emission; - if(indirect_lamp_emission(kg, kernel_split_state.sd_DL_shadow, state, &light_ray, &emission)) { + if(indirect_lamp_emission(kg, &kernel_split_state.sd_DL_shadow[ray_index], state, &light_ray, &emission)) { path_radiance_accum_emission(L, throughput, emission, state->bounce); } } diff --git a/intern/cycles/kernel/split/kernel_next_iteration_setup.h b/intern/cycles/kernel/split/kernel_next_iteration_setup.h index 0ff8286e59b..a6f26278116 100644 --- a/intern/cycles/kernel/split/kernel_next_iteration_setup.h +++ b/intern/cycles/kernel/split/kernel_next_iteration_setup.h @@ -161,7 +161,7 @@ ccl_device void kernel_next_iteration_setup(KernelGlobals *kg) L = &kernel_split_state.path_radiance[ray_index]; /* Compute direct lighting and next bounce. */ - if(!kernel_path_surface_bounce(kg, rng, kernel_split_state.sd, throughput, state, L, ray)) { + if(!kernel_path_surface_bounce(kg, rng, &kernel_split_state.sd[ray_index], throughput, state, L, ray)) { ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER); enqueue_flag = 1; } diff --git a/intern/cycles/kernel/split/kernel_shader_eval.h b/intern/cycles/kernel/split/kernel_shader_eval.h index 8328f60af39..35ee19ddf1b 100644 --- a/intern/cycles/kernel/split/kernel_shader_eval.h +++ b/intern/cycles/kernel/split/kernel_shader_eval.h @@ -82,11 +82,11 @@ ccl_device void kernel_shader_eval(KernelGlobals *kg) Ray ray = kernel_split_state.ray[ray_index]; shader_setup_from_ray(kg, - kernel_split_state.sd, + &kernel_split_state.sd[ray_index], isect, &ray); float rbsdf = path_state_rng_1D_for_decision(kg, rng, state, PRNG_BSDF); - shader_eval_surface(kg, kernel_split_state.sd, rng, state, rbsdf, state->flag, SHADER_CONTEXT_MAIN); + shader_eval_surface(kg, &kernel_split_state.sd[ray_index], rng, state, rbsdf, state->flag, SHADER_CONTEXT_MAIN); } } diff --git a/intern/cycles/kernel/split/kernel_shadow_blocked.h b/intern/cycles/kernel/split/kernel_shadow_blocked.h index f862c37ea64..d532c7cf55b 100644 --- a/intern/cycles/kernel/split/kernel_shadow_blocked.h +++ b/intern/cycles/kernel/split/kernel_shadow_blocked.h @@ -94,7 +94,7 @@ ccl_device void kernel_shadow_blocked(KernelGlobals *kg) float3 shadow; update_path_radiance = !(shadow_blocked(kg, - kernel_split_state.sd_DL_shadow, + &kernel_split_state.sd_DL_shadow[thread_index], state, light_ray_global, &shadow)); |