diff options
author | Patrick Mours <pmours@nvidia.com> | 2019-08-22 18:36:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-26 11:26:53 +0300 |
commit | f491c23f1e104998752380b930307e7abc4597b3 (patch) | |
tree | 7dcc876468baf526d4933fe0bfab6eed2f23cf4c /intern/cycles/kernel/svm | |
parent | 2b999c6a68f85523c46f39bb6a877baba2343d9b (diff) |
Cycles: inline more functions on the GPU
This makes little difference for CUDA and OpenCL, but will be helpful
for Optix.
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r-- | intern/cycles/kernel/svm/svm_attribute.h | 16 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_brick.h | 20 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_color_util.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_magic.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_musgrave.h | 19 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_noise.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_wave.h | 12 |
7 files changed, 32 insertions, 41 deletions
diff --git a/intern/cycles/kernel/svm/svm_attribute.h b/intern/cycles/kernel/svm/svm_attribute.h index 341eaad28ee..eaee0f9e4ee 100644 --- a/intern/cycles/kernel/svm/svm_attribute.h +++ b/intern/cycles/kernel/svm/svm_attribute.h @@ -80,13 +80,7 @@ ccl_device void svm_node_attr(KernelGlobals *kg, ShaderData *sd, float *stack, u } } -#ifndef __KERNEL_CUDA__ -ccl_device -#else -ccl_device_noinline -#endif - void - svm_node_attr_bump_dx(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) +ccl_device void svm_node_attr_bump_dx(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) { NodeAttributeType type = NODE_ATTR_FLOAT; uint out_offset = 0; @@ -125,13 +119,7 @@ ccl_device_noinline } } -#ifndef __KERNEL_CUDA__ -ccl_device -#else -ccl_device_noinline -#endif - void - svm_node_attr_bump_dy(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) +ccl_device void svm_node_attr_bump_dy(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) { NodeAttributeType type = NODE_ATTR_FLOAT; uint out_offset = 0; diff --git a/intern/cycles/kernel/svm/svm_brick.h b/intern/cycles/kernel/svm/svm_brick.h index f1d74b7df96..6984afa30a5 100644 --- a/intern/cycles/kernel/svm/svm_brick.h +++ b/intern/cycles/kernel/svm/svm_brick.h @@ -27,16 +27,16 @@ ccl_device_inline float brick_noise(uint n) /* fast integer noise */ return 0.5f * ((float)nn / 1073741824.0f); } -ccl_device_noinline float2 svm_brick(float3 p, - float mortar_size, - float mortar_smooth, - float bias, - float brick_width, - float row_height, - float offset_amount, - int offset_frequency, - float squash_amount, - int squash_frequency) +ccl_device_noinline_cpu float2 svm_brick(float3 p, + float mortar_size, + float mortar_smooth, + float bias, + float brick_width, + float row_height, + float offset_amount, + int offset_frequency, + float squash_amount, + int squash_frequency) { int bricknum, rownum; float offset = 0.0f; diff --git a/intern/cycles/kernel/svm/svm_color_util.h b/intern/cycles/kernel/svm/svm_color_util.h index 12b59d2616b..3a6a5ba782f 100644 --- a/intern/cycles/kernel/svm/svm_color_util.h +++ b/intern/cycles/kernel/svm/svm_color_util.h @@ -264,7 +264,7 @@ ccl_device float3 svm_mix_clamp(float3 col) return outcol; } -ccl_device_noinline float3 svm_mix(NodeMix type, float fac, float3 c1, float3 c2) +ccl_device_noinline_cpu float3 svm_mix(NodeMix type, float fac, float3 c1, float3 c2) { float t = saturate(fac); diff --git a/intern/cycles/kernel/svm/svm_magic.h b/intern/cycles/kernel/svm/svm_magic.h index 6ba1a5817ad..9c160e6d8cc 100644 --- a/intern/cycles/kernel/svm/svm_magic.h +++ b/intern/cycles/kernel/svm/svm_magic.h @@ -18,7 +18,7 @@ CCL_NAMESPACE_BEGIN /* Magic */ -ccl_device_noinline float3 svm_magic(float3 p, int n, float distortion) +ccl_device_noinline_cpu float3 svm_magic(float3 p, int n, float distortion) { float x = sinf((p.x + p.y + p.z) * 5.0f); float y = cosf((-p.x + p.y - p.z) * 5.0f); diff --git a/intern/cycles/kernel/svm/svm_musgrave.h b/intern/cycles/kernel/svm/svm_musgrave.h index 298155b795f..9291c7e7295 100644 --- a/intern/cycles/kernel/svm/svm_musgrave.h +++ b/intern/cycles/kernel/svm/svm_musgrave.h @@ -25,7 +25,10 @@ CCL_NAMESPACE_BEGIN * from "Texturing and Modelling: A procedural approach" */ -ccl_device_noinline float noise_musgrave_fBm(float3 p, float H, float lacunarity, float octaves) +ccl_device_noinline_cpu float noise_musgrave_fBm(float3 p, + float H, + float lacunarity, + float octaves) { float rmd; float value = 0.0f; @@ -53,10 +56,10 @@ ccl_device_noinline float noise_musgrave_fBm(float3 p, float H, float lacunarity * octaves: number of frequencies in the fBm */ -ccl_device_noinline float noise_musgrave_multi_fractal(float3 p, - float H, - float lacunarity, - float octaves) +ccl_device_noinline_cpu float noise_musgrave_multi_fractal(float3 p, + float H, + float lacunarity, + float octaves) { float rmd; float value = 1.0f; @@ -85,7 +88,7 @@ ccl_device_noinline float noise_musgrave_multi_fractal(float3 p, * offset: raises the terrain from `sea level' */ -ccl_device_noinline float noise_musgrave_hetero_terrain( +ccl_device_noinline_cpu float noise_musgrave_hetero_terrain( float3 p, float H, float lacunarity, float octaves, float offset) { float value, increment, rmd; @@ -121,7 +124,7 @@ ccl_device_noinline float noise_musgrave_hetero_terrain( * offset: raises the terrain from `sea level' */ -ccl_device_noinline float noise_musgrave_hybrid_multi_fractal( +ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal( float3 p, float H, float lacunarity, float octaves, float offset, float gain) { float result, signal, weight, rmd; @@ -159,7 +162,7 @@ ccl_device_noinline float noise_musgrave_hybrid_multi_fractal( * offset: raises the terrain from `sea level' */ -ccl_device_noinline float noise_musgrave_ridged_multi_fractal( +ccl_device_noinline_cpu float noise_musgrave_ridged_multi_fractal( float3 p, float H, float lacunarity, float octaves, float offset, float gain) { float result, signal, weight; diff --git a/intern/cycles/kernel/svm/svm_noise.h b/intern/cycles/kernel/svm/svm_noise.h index 0bf3dfda4df..dd375af27e5 100644 --- a/intern/cycles/kernel/svm/svm_noise.h +++ b/intern/cycles/kernel/svm/svm_noise.h @@ -182,7 +182,7 @@ ccl_device_inline ssef scale3_sse(const ssef &result) #endif #ifndef __KERNEL_SSE2__ -ccl_device_noinline float perlin(float x, float y, float z) +ccl_device_noinline_cpu float perlin(float x, float y, float z) { int X; float fx = floorfrac(x, &X); diff --git a/intern/cycles/kernel/svm/svm_wave.h b/intern/cycles/kernel/svm/svm_wave.h index 03b7f330970..baaa89ab0cb 100644 --- a/intern/cycles/kernel/svm/svm_wave.h +++ b/intern/cycles/kernel/svm/svm_wave.h @@ -18,12 +18,12 @@ CCL_NAMESPACE_BEGIN /* Wave */ -ccl_device_noinline float svm_wave(NodeWaveType type, - NodeWaveProfile profile, - float3 p, - float detail, - float distortion, - float dscale) +ccl_device_noinline_cpu float svm_wave(NodeWaveType type, + NodeWaveProfile profile, + float3 p, + float detail, + float distortion, + float dscale) { float n; |