Fix #35665: cycles CUDA crash after recent changes. This works around a compiler
[blender.git] / intern / cycles / kernel / kernel_random.h
index ecf80b817d476de92fd65d6b20b43eb8336586bd..b5f824d5cce1a750fd5f4c0a2f19691ba89f90f6 100644 (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;