diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-09 20:37:04 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-09 20:37:04 +0400 |
commit | 13b3b425f8ed2fdedd15b828c1c7b3559f2a2b66 (patch) | |
tree | f858d592e2137e55be4d18d0d615adcc7babc82b /intern/cycles/kernel | |
parent | 0123c7d2be0036435192318a2a3fa7949bc3d5f7 (diff) |
Fix #35665: cycles CUDA crash after recent changes. This works around a compiler
bug in CUDA 4.2 (solved in 5.5) with typedef'd function parameters.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 34 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_random.h | 18 |
2 files changed, 26 insertions, 26 deletions
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 866024ba303..f58f83e2f82 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -233,7 +233,7 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra return result; } -__device float4 kernel_path_progressive(KernelGlobals *kg, RNG rng, int sample, Ray ray, __global float *buffer) +__device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer) { /* initialize */ PathRadiance L; @@ -271,7 +271,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG rng, int sample, } extmax = kernel_data.curve_kernel_data.maximum_width; - lcg_state = lcg_init(rng + rng_offset + sample*0x51633e2d); + lcg_state = lcg_init(*rng + rng_offset + sample*0x51633e2d); } bool hit = scene_intersect(kg, &ray, visibility, &isect, &lcg_state, difl, extmax); @@ -399,7 +399,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG rng, int sample, /* do bssrdf scatter step if we picked a bssrdf closure */ if(sc) { - uint lcg_state = lcg_init(rng + rng_offset + sample*0x68bc21eb); + uint lcg_state = lcg_init(*rng + rng_offset + sample*0x68bc21eb); subsurface_scatter_step(kg, &sd, state.flag, sc, &lcg_state, false); } } @@ -538,7 +538,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG rng, int sample, #ifdef __NON_PROGRESSIVE__ -__device void kernel_path_indirect(KernelGlobals *kg, RNG rng, int sample, Ray ray, __global float *buffer, +__device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer, float3 throughput, int num_samples, int num_total_samples, float min_ray_pdf, float ray_pdf, PathState state, int rng_offset, PathRadiance *L) { @@ -644,7 +644,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG rng, int sample, Ray r /* do bssrdf scatter step if we picked a bssrdf closure */ if(sc) { - uint lcg_state = lcg_init(rng + rng_offset + sample*0x68bc21eb); + uint lcg_state = lcg_init(*rng + rng_offset + sample*0x68bc21eb); subsurface_scatter_step(kg, &sd, state.flag, sc, &lcg_state, false); } } @@ -767,7 +767,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG rng, int sample, Ray r } } -__device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, RNG rng, int sample, +__device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, RNG *rng, int sample, ShaderData *sd, float3 throughput, float num_samples_adjust, float min_ray_pdf, float ray_pdf, PathState state, int rng_offset, PathRadiance *L, __global float *buffer) @@ -830,13 +830,13 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R for(int i = 0; i < kernel_data.integrator.num_all_lights; i++) { int num_samples = ceil_to_int(num_samples_adjust*light_select_num_samples(kg, i)); float num_samples_inv = num_samples_adjust/(num_samples*kernel_data.integrator.num_all_lights); - RNG lamp_rng = cmj_hash(rng, i); + RNG lamp_rng = cmj_hash(*rng, i); if(kernel_data.integrator.pdf_triangles != 0.0f) num_samples_inv *= 0.5f; for(int j = 0; j < num_samples; j++) { - float2 light_uv = path_rng_2D(kg, lamp_rng, sample*num_samples + j, aa_samples*num_samples, rng_offset + PRNG_LIGHT_U); + float2 light_uv = path_rng_2D(kg, &lamp_rng, sample*num_samples + j, aa_samples*num_samples, rng_offset + PRNG_LIGHT_U); float light_u = light_uv.x; float light_v = light_uv.y; @@ -905,7 +905,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R num_samples = ceil_to_int(num_samples_adjust*num_samples); float num_samples_inv = num_samples_adjust/num_samples; - RNG bsdf_rng = cmj_hash(rng, i); + RNG bsdf_rng = cmj_hash(*rng, i); for(int j = 0; j < num_samples; j++) { /* sample BSDF */ @@ -913,7 +913,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R BsdfEval bsdf_eval; float3 bsdf_omega_in; differential3 bsdf_domega_in; - float2 bsdf_uv = path_rng_2D(kg, bsdf_rng, sample*num_samples + j, aa_samples*num_samples, rng_offset + PRNG_BSDF_U); + float2 bsdf_uv = path_rng_2D(kg, &bsdf_rng, sample*num_samples + j, aa_samples*num_samples, rng_offset + PRNG_BSDF_U); float bsdf_u = bsdf_uv.x; float bsdf_v = bsdf_uv.y; int label; @@ -964,7 +964,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R } } -__device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG rng, int sample, Ray ray, __global float *buffer) +__device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer) { /* initialize */ PathRadiance L; @@ -997,7 +997,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG rng, int samp } extmax = kernel_data.curve_kernel_data.maximum_width; - lcg_state = lcg_init(rng + rng_offset + sample*0x51633e2d); + lcg_state = lcg_init(*rng + rng_offset + sample*0x51633e2d); } if(!scene_intersect(kg, &ray, visibility, &isect, &lcg_state, difl, extmax)) { @@ -1090,7 +1090,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG rng, int samp continue; /* set up random number generator */ - uint lcg_state = lcg_init(rng + rng_offset + sample*0x68bc21eb); + uint lcg_state = lcg_init(*rng + rng_offset + sample*0x68bc21eb); int num_samples = kernel_data.integrator.subsurface_samples; float num_samples_inv = 1.0f/num_samples; @@ -1163,7 +1163,7 @@ __device void kernel_path_trace(KernelGlobals *kg, float lens_u = 0.0f, lens_v = 0.0f; if(kernel_data.cam.aperturesize > 0.0f) { - float2 lens_uv = path_rng_2D(kg, rng, sample, num_samples, PRNG_LENS_U); + float2 lens_uv = path_rng_2D(kg, &rng, sample, num_samples, PRNG_LENS_U); lens_u = lens_uv.x; lens_v = lens_uv.y; } @@ -1172,7 +1172,7 @@ __device void kernel_path_trace(KernelGlobals *kg, #ifdef __CAMERA_MOTION__ if(kernel_data.cam.shuttertime != -1.0f) - time = path_rng_1D(kg, rng, sample, num_samples, PRNG_TIME); + time = path_rng_1D(kg, &rng, sample, num_samples, PRNG_TIME); #endif camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, &ray); @@ -1184,10 +1184,10 @@ __device void kernel_path_trace(KernelGlobals *kg, #ifdef __NON_PROGRESSIVE__ if(kernel_data.integrator.progressive) #endif - L = kernel_path_progressive(kg, rng, sample, ray, buffer); + L = kernel_path_progressive(kg, &rng, sample, ray, buffer); #ifdef __NON_PROGRESSIVE__ else - L = kernel_path_non_progressive(kg, rng, sample, ray, buffer); + L = kernel_path_non_progressive(kg, &rng, sample, ray, buffer); #endif } else diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h index ecf80b817d4..b5f824d5cce 100644 --- a/intern/cycles/kernel/kernel_random.h +++ b/intern/cycles/kernel/kernel_random.h @@ -102,10 +102,10 @@ __device uint sobol_lookup(const uint m, const uint frame, const uint ex, const return index; } -__device_inline float path_rng(KernelGlobals *kg, RNG rng, int sample, int dimension) +__device_inline float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dimension) { #ifdef __SOBOL_FULL_SCREEN__ - uint result = sobol_dimension(kg, rng, dimension); + uint result = sobol_dimension(kg, *rng, dimension); float r = (float)result * (1.0f/(float)0xFFFFFFFF); return r; #else @@ -117,20 +117,20 @@ __device_inline float path_rng(KernelGlobals *kg, RNG rng, int sample, int dimen float shift; if(dimension & 1) - shift = (rng >> 16)*(1.0f/(float)0xFFFF); + shift = (*rng >> 16)*(1.0f/(float)0xFFFF); else - shift = (rng & 0xFFFF)*(1.0f/(float)0xFFFF); + shift = (*rng & 0xFFFF)*(1.0f/(float)0xFFFF); return r + shift - floorf(r + shift); #endif } -__device_inline float path_rng_1D(KernelGlobals *kg, RNG rng, int sample, int num_samples, int dimension) +__device_inline float path_rng_1D(KernelGlobals *kg, RNG *rng, int sample, int num_samples, int dimension) { #ifdef __CMJ__ if(kernel_data.integrator.sampling_pattern == SAMPLING_PATTERN_CMJ) { /* correlated multi-jittered */ - int p = rng + dimension; + int p = *rng + dimension; return cmj_sample_1D(sample, num_samples, p); } #endif @@ -139,12 +139,12 @@ __device_inline float path_rng_1D(KernelGlobals *kg, RNG rng, int sample, int nu return path_rng(kg, rng, sample, dimension); } -__device_inline float2 path_rng_2D(KernelGlobals *kg, RNG rng, int sample, int num_samples, int dimension) +__device_inline float2 path_rng_2D(KernelGlobals *kg, RNG *rng, int sample, int num_samples, int dimension) { #ifdef __CMJ__ if(kernel_data.integrator.sampling_pattern == SAMPLING_PATTERN_CMJ) { /* correlated multi-jittered */ - int p = rng + dimension; + int p = *rng + dimension; return cmj_sample_2D(sample, num_samples, p); } #endif @@ -184,7 +184,7 @@ __device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, *fy = 0.5f; } else { - float2 fxy = path_rng_2D(kg, *rng, sample, num_samples, PRNG_FILTER_U); + float2 fxy = path_rng_2D(kg, rng, sample, num_samples, PRNG_FILTER_U); *fx = fxy.x; *fy = fxy.y; |