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.
This commit is contained in:
Brecht Van Lommel
2013-06-09 16:37:04 +00:00
parent 0123c7d2be
commit 13b3b425f8
2 changed files with 26 additions and 26 deletions

View File

@@ -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;