diff options
author | Hristo Gueorguiev <> | 2016-10-23 00:38:42 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-10-23 00:49:29 +0300 |
commit | 8905c5c87495ad8fd876de83a968d79ac54f0e17 (patch) | |
tree | 81d626a6e472c138578fd3994b89c3ccd62ae47e /intern/cycles/kernel/geom/geom_volume.h | |
parent | 371d3570e0a5fd04c2181a286034841919eabd34 (diff) |
Cycles: OpenCL 3d textures support.
Note that volume rendering is not supported yet, this is a step towards that.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D2299
Diffstat (limited to 'intern/cycles/kernel/geom/geom_volume.h')
-rw-r--r-- | intern/cycles/kernel/geom/geom_volume.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/intern/cycles/kernel/geom/geom_volume.h b/intern/cycles/kernel/geom/geom_volume.h index fd97a63efb5..03724c955be 100644 --- a/intern/cycles/kernel/geom/geom_volume.h +++ b/intern/cycles/kernel/geom/geom_volume.h @@ -29,7 +29,7 @@ CCL_NAMESPACE_BEGIN /* Return position normalized to 0..1 in mesh bounds */ -#if defined(__KERNEL_GPU__) && __CUDA_ARCH__ < 300 +#if defined(__KERNEL_CUDA__) && __CUDA_ARCH__ < 300 ccl_device float4 volume_image_texture_3d(int id, float x, float y, float z) { float4 r; @@ -42,7 +42,7 @@ ccl_device float4 volume_image_texture_3d(int id, float x, float y, float z) } return r; } -#endif /* __KERNEL_GPU__ */ +#endif /* __KERNEL_CUDA__ */ ccl_device_inline float3 volume_normalized_position(KernelGlobals *kg, const ShaderData *sd, @@ -64,8 +64,8 @@ ccl_device_inline float3 volume_normalized_position(KernelGlobals *kg, ccl_device float volume_attribute_float(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc, float *dx, float *dy) { - float3 P = volume_normalized_position(kg, sd, sd->P); -#ifdef __KERNEL_GPU__ + float3 P = volume_normalized_position(kg, sd, ccl_fetch(sd, P)); +#ifdef __KERNEL_CUDA__ # if __CUDA_ARCH__ >= 300 CUtexObject tex = kernel_tex_fetch(__bindless_mapping, desc.offset); float f = kernel_tex_image_interp_3d_float(tex, P.x, P.y, P.z); @@ -73,6 +73,8 @@ ccl_device float volume_attribute_float(KernelGlobals *kg, const ShaderData *sd, # else float4 r = volume_image_texture_3d(desc.offset, P.x, P.y, P.z); # endif +#elif defined(__KERNEL_OPENCL__) + float4 r = kernel_tex_image_interp_3d(kg, desc.offset, P.x, P.y, P.z); #else float4 r; if(sd->flag & SD_VOLUME_CUBIC) @@ -89,14 +91,16 @@ ccl_device float volume_attribute_float(KernelGlobals *kg, const ShaderData *sd, ccl_device float3 volume_attribute_float3(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc, float3 *dx, float3 *dy) { - float3 P = volume_normalized_position(kg, sd, sd->P); -#ifdef __KERNEL_GPU__ + float3 P = volume_normalized_position(kg, sd, ccl_fetch(sd, P)); +#ifdef __KERNEL_CUDA__ # if __CUDA_ARCH__ >= 300 CUtexObject tex = kernel_tex_fetch(__bindless_mapping, desc.offset); float4 r = kernel_tex_image_interp_3d_float4(tex, P.x, P.y, P.z); # else float4 r = volume_image_texture_3d(desc.offset, P.x, P.y, P.z); # endif +#elif defined(__KERNEL_OPENCL__) + float4 r = kernel_tex_image_interp_3d(kg, desc.offset, P.x, P.y, P.z); #else float4 r; if(sd->flag & SD_VOLUME_CUBIC) |