Cycles: Fix compilation error on OpenCL

This commit is contained in:
Sergey Sharybin 2017-01-30 12:33:58 +01:00
parent 31a025f51e
commit 04cf1538b5
2 changed files with 15 additions and 13 deletions

@ -357,7 +357,7 @@ ccl_device_inline float3 ray_offset(float3 P, float3 Ng)
#endif #endif
} }
#if defined(__SHADOW_RECORD_ALL__) || defined(__VOLUME_RECORD_ALL__) #if defined(__VOLUME_RECORD_ALL__) || (defined(__SHADOW_RECORD_ALL__) && defined(__KERNEL_CPU__))
/* ToDo: Move to another file? */ /* ToDo: Move to another file? */
ccl_device int intersections_compare(const void *a, const void *b) ccl_device int intersections_compare(const void *a, const void *b)
{ {
@ -371,7 +371,9 @@ ccl_device int intersections_compare(const void *a, const void *b)
else else
return 0; return 0;
} }
#endif
#if defined(__SHADOW_RECORD_ALL__)
ccl_device_inline void sort_intersections(Intersection *hits, uint num_hits) ccl_device_inline void sort_intersections(Intersection *hits, uint num_hits)
{ {
#ifdef __KERNEL_GPU__ #ifdef __KERNEL_GPU__
@ -380,7 +382,7 @@ ccl_device_inline void sort_intersections(Intersection *hits, uint num_hits)
for(i = 0; i < num_hits; ++i) { for(i = 0; i < num_hits; ++i) {
for(j = 0; j < num_hits - 1; ++j) { for(j = 0; j < num_hits - 1; ++j) {
if(hits[j].t < hits[j + 1].t) { if(hits[j].t < hits[j + 1].t) {
Intersection tmp = hits[j]; struct Intersection tmp = hits[j];
hits[j] = hits[j + 1]; hits[j] = hits[j + 1];
hits[j + 1] = tmp; hits[j + 1] = tmp;
} }

@ -22,7 +22,7 @@ CCL_NAMESPACE_BEGIN
ccl_device_forceinline bool shadow_handle_transparent_isect( ccl_device_forceinline bool shadow_handle_transparent_isect(
KernelGlobals *kg, KernelGlobals *kg,
ShaderData *shadow_sd, ShaderData *shadow_sd,
PathState *state, ccl_addr_space PathState *state,
Intersection *isect, Intersection *isect,
Ray *ray, Ray *ray,
float3 *throughput) float3 *throughput)
@ -38,7 +38,7 @@ ccl_device_forceinline bool shadow_handle_transparent_isect(
/* Setup shader data at surface. */ /* Setup shader data at surface. */
shader_setup_from_ray(kg, shadow_sd, isect, ray); shader_setup_from_ray(kg, shadow_sd, isect, ray);
/* Attenuation from transparent surface. */ /* Attenuation from transparent surface. */
if(!(shadow_sd->flag & SD_HAS_ONLY_VOLUME)) { if(!(ccl_fetch(shadow_sd, flag) & SD_HAS_ONLY_VOLUME)) {
path_state_modify_bounce(state, true); path_state_modify_bounce(state, true);
shader_eval_surface(kg, shader_eval_surface(kg,
shadow_sd, shadow_sd,
@ -64,7 +64,7 @@ ccl_device_forceinline bool shadow_handle_transparent_isect(
/* Special version which only handles opaque shadows. */ /* Special version which only handles opaque shadows. */
ccl_device bool shadow_blocked_opaque(KernelGlobals *kg, ccl_device bool shadow_blocked_opaque(KernelGlobals *kg,
ShaderData *shadow_sd, ShaderData *shadow_sd,
PathState *state, ccl_addr_space PathState *state,
Ray *ray, Ray *ray,
Intersection *isect, Intersection *isect,
float3 *shadow) float3 *shadow)
@ -120,7 +120,7 @@ ccl_device bool shadow_blocked_opaque(KernelGlobals *kg,
*/ */
ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg, ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
ShaderData *shadow_sd, ShaderData *shadow_sd,
PathState *state, ccl_addr_space PathState *state,
Ray *ray, Ray *ray,
Intersection *hits, Intersection *hits,
uint max_hits, uint max_hits,
@ -162,7 +162,7 @@ ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
/* Attenuate the throughput. */ /* Attenuate the throughput. */
if(shadow_handle_transparent_isect(kg, if(shadow_handle_transparent_isect(kg,
shadow_sd, shadow_sd,
&ps, state,
isect, isect,
ray, ray,
&throughput)) &throughput))
@ -170,7 +170,7 @@ ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
return true; return true;
} }
/* Move ray forward. */ /* Move ray forward. */
ray->P = shadow_sd->P; ray->P = ccl_fetch(shadow_sd, P);
if(ray->t != FLT_MAX) { if(ray->t != FLT_MAX) {
ray->D = normalize_len(Pend - ray->P, &ray->t); ray->D = normalize_len(Pend - ray->P, &ray->t);
} }
@ -199,7 +199,7 @@ ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
*/ */
ccl_device bool shadow_blocked_transparent_all(KernelGlobals *kg, ccl_device bool shadow_blocked_transparent_all(KernelGlobals *kg,
ShaderData *shadow_sd, ShaderData *shadow_sd,
PathState *state, ccl_addr_space PathState *state,
Ray *ray, Ray *ray,
uint max_hits, uint max_hits,
float3 *shadow) float3 *shadow)
@ -250,7 +250,7 @@ ccl_device bool shadow_blocked_transparent_all(KernelGlobals *kg,
ccl_device bool shadow_blocked_transparent_stepped( ccl_device bool shadow_blocked_transparent_stepped(
KernelGlobals *kg, KernelGlobals *kg,
ShaderData *shadow_sd, ShaderData *shadow_sd,
PathState *state, ccl_addr_space PathState *state,
Ray *ray, Ray *ray,
Intersection *isect, Intersection *isect,
float3 *shadow) float3 *shadow)
@ -288,7 +288,7 @@ ccl_device bool shadow_blocked_transparent_stepped(
/* Attenuate the throughput. */ /* Attenuate the throughput. */
if(shadow_handle_transparent_isect(kg, if(shadow_handle_transparent_isect(kg,
shadow_sd, shadow_sd,
&ps, state,
isect, isect,
ray, ray,
&throughput)) &throughput))
@ -324,8 +324,8 @@ ccl_device bool shadow_blocked_transparent_stepped(
ccl_device_inline bool shadow_blocked(KernelGlobals *kg, ccl_device_inline bool shadow_blocked(KernelGlobals *kg,
ShaderData *shadow_sd, ShaderData *shadow_sd,
PathState *state, ccl_addr_space PathState *state,
Ray *ray_input, ccl_addr_space Ray *ray_input,
float3 *shadow) float3 *shadow)
{ {
/* Special trickery for split kernel: some data is coming from the /* Special trickery for split kernel: some data is coming from the