Cycles: Remove ccl_fetch and SOA
This commit is contained in:
@@ -25,7 +25,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(KernelGlobal
|
||||
{
|
||||
#ifdef __EMISSION__
|
||||
/* sample illumination from lights to find path contribution */
|
||||
if(!(ccl_fetch(sd, flag) & SD_BSDF_HAS_EVAL))
|
||||
if(!(sd->flag & SD_BSDF_HAS_EVAL))
|
||||
return;
|
||||
|
||||
Ray light_ray;
|
||||
@@ -33,7 +33,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(KernelGlobal
|
||||
bool is_lamp;
|
||||
|
||||
# ifdef __OBJECT_MOTION__
|
||||
light_ray.time = ccl_fetch(sd, time);
|
||||
light_ray.time = sd->time;
|
||||
# endif
|
||||
|
||||
if(sample_all_lights) {
|
||||
@@ -52,7 +52,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(KernelGlobal
|
||||
float terminate = path_branched_rng_light_termination(kg, &lamp_rng, state, j, num_samples);
|
||||
|
||||
LightSample ls;
|
||||
if(lamp_light_sample(kg, i, light_u, light_v, ccl_fetch(sd, P), &ls)) {
|
||||
if(lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls)) {
|
||||
/* The sampling probability returned by lamp_light_sample assumes that all lights were sampled.
|
||||
* However, this code only samples lamps, so if the scene also had mesh lights, the real probability is twice as high. */
|
||||
if(kernel_data.integrator.pdf_triangles != 0.0f)
|
||||
@@ -87,7 +87,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(KernelGlobal
|
||||
light_t = 0.5f*light_t;
|
||||
|
||||
LightSample ls;
|
||||
if(light_sample(kg, light_t, light_u, light_v, ccl_fetch(sd, time), ccl_fetch(sd, P), state->bounce, &ls)) {
|
||||
if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) {
|
||||
/* Same as above, probability needs to be corrected since the sampling was forced to select a mesh light. */
|
||||
if(kernel_data.integrator.num_all_lights)
|
||||
ls.pdf *= 2.0f;
|
||||
@@ -113,7 +113,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(KernelGlobal
|
||||
float terminate = path_state_rng_light_termination(kg, rng, state);
|
||||
|
||||
LightSample ls;
|
||||
if(light_sample(kg, light_t, light_u, light_v, ccl_fetch(sd, time), ccl_fetch(sd, P), state->bounce, &ls)) {
|
||||
if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) {
|
||||
/* sample random light */
|
||||
if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) {
|
||||
/* trace shadow ray */
|
||||
@@ -156,15 +156,15 @@ ccl_device bool kernel_branched_path_surface_bounce(KernelGlobals *kg, RNG *rng,
|
||||
path_state_next(kg, state, label);
|
||||
|
||||
/* setup ray */
|
||||
ray->P = ray_offset(ccl_fetch(sd, P), (label & LABEL_TRANSMIT)? -ccl_fetch(sd, Ng): ccl_fetch(sd, Ng));
|
||||
ray->P = ray_offset(sd->P, (label & LABEL_TRANSMIT)? -sd->Ng: sd->Ng);
|
||||
ray->D = normalize(bsdf_omega_in);
|
||||
ray->t = FLT_MAX;
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
ray->dP = ccl_fetch(sd, dP);
|
||||
ray->dP = sd->dP;
|
||||
ray->dD = bsdf_domega_in;
|
||||
#endif
|
||||
#ifdef __OBJECT_MOTION__
|
||||
ray->time = ccl_fetch(sd, time);
|
||||
ray->time = sd->time;
|
||||
#endif
|
||||
|
||||
#ifdef __VOLUME__
|
||||
@@ -195,7 +195,7 @@ ccl_device_inline void kernel_path_surface_connect_light(KernelGlobals *kg, ccl_
|
||||
PathRadiance *L)
|
||||
{
|
||||
#ifdef __EMISSION__
|
||||
if(!(kernel_data.integrator.use_direct_light && (ccl_fetch(sd, flag) & SD_BSDF_HAS_EVAL)))
|
||||
if(!(kernel_data.integrator.use_direct_light && (sd->flag & SD_BSDF_HAS_EVAL)))
|
||||
return;
|
||||
|
||||
/* sample illumination from lights to find path contribution */
|
||||
@@ -208,11 +208,11 @@ ccl_device_inline void kernel_path_surface_connect_light(KernelGlobals *kg, ccl_
|
||||
bool is_lamp;
|
||||
|
||||
#ifdef __OBJECT_MOTION__
|
||||
light_ray.time = ccl_fetch(sd, time);
|
||||
light_ray.time = sd->time;
|
||||
#endif
|
||||
|
||||
LightSample ls;
|
||||
if(light_sample(kg, light_t, light_u, light_v, ccl_fetch(sd, time), ccl_fetch(sd, P), state->bounce, &ls)) {
|
||||
if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) {
|
||||
float terminate = path_state_rng_light_termination(kg, rng, state);
|
||||
if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) {
|
||||
/* trace shadow ray */
|
||||
@@ -238,7 +238,7 @@ ccl_device bool kernel_path_surface_bounce(KernelGlobals *kg,
|
||||
ccl_addr_space Ray *ray)
|
||||
{
|
||||
/* no BSDF? we can stop here */
|
||||
if(ccl_fetch(sd, flag) & SD_BSDF) {
|
||||
if(sd->flag & SD_BSDF) {
|
||||
/* sample BSDF */
|
||||
float bsdf_pdf;
|
||||
BsdfEval bsdf_eval;
|
||||
@@ -270,16 +270,16 @@ ccl_device bool kernel_path_surface_bounce(KernelGlobals *kg,
|
||||
path_state_next(kg, state, label);
|
||||
|
||||
/* setup ray */
|
||||
ray->P = ray_offset(ccl_fetch(sd, P), (label & LABEL_TRANSMIT)? -ccl_fetch(sd, Ng): ccl_fetch(sd, Ng));
|
||||
ray->P = ray_offset(sd->P, (label & LABEL_TRANSMIT)? -sd->Ng: sd->Ng);
|
||||
ray->D = normalize(bsdf_omega_in);
|
||||
|
||||
if(state->bounce == 0)
|
||||
ray->t -= ccl_fetch(sd, ray_length); /* clipping works through transparent */
|
||||
ray->t -= sd->ray_length; /* clipping works through transparent */
|
||||
else
|
||||
ray->t = FLT_MAX;
|
||||
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
ray->dP = ccl_fetch(sd, dP);
|
||||
ray->dP = sd->dP;
|
||||
ray->dD = bsdf_domega_in;
|
||||
#endif
|
||||
|
||||
@@ -291,21 +291,21 @@ ccl_device bool kernel_path_surface_bounce(KernelGlobals *kg,
|
||||
return true;
|
||||
}
|
||||
#ifdef __VOLUME__
|
||||
else if(ccl_fetch(sd, flag) & SD_HAS_ONLY_VOLUME) {
|
||||
else if(sd->flag & SD_HAS_ONLY_VOLUME) {
|
||||
/* no surface shader but have a volume shader? act transparent */
|
||||
|
||||
/* update path state, count as transparent */
|
||||
path_state_next(kg, state, LABEL_TRANSPARENT);
|
||||
|
||||
if(state->bounce == 0)
|
||||
ray->t -= ccl_fetch(sd, ray_length); /* clipping works through transparent */
|
||||
ray->t -= sd->ray_length; /* clipping works through transparent */
|
||||
else
|
||||
ray->t = FLT_MAX;
|
||||
|
||||
/* setup ray position, direction stays unchanged */
|
||||
ray->P = ray_offset(ccl_fetch(sd, P), -ccl_fetch(sd, Ng));
|
||||
ray->P = ray_offset(sd->P, -sd->Ng);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
ray->dP = ccl_fetch(sd, dP);
|
||||
ray->dP = sd->dP;
|
||||
#endif
|
||||
|
||||
/* enter/exit volume */
|
||||
|
Reference in New Issue
Block a user