Code refactor: make texture code more consistent between devices.

* Use common TextureInfo struct for all devices, except CUDA fermi.
* Move image sampling code to kernels/*/kernel_*_image.h files.
* Use arrays for data textures on Fermi too, so device_vector<Struct> works.
This commit is contained in:
Brecht Van Lommel
2017-10-06 21:47:41 +02:00
parent d013b56dde
commit 23098cda99
25 changed files with 928 additions and 1105 deletions

View File

@@ -42,29 +42,8 @@ ccl_device void svm_node_tex_voxel(KernelGlobals *kg,
tfm.w = read_node_float(kg, offset);
co = transform_point(&tfm, co);
}
float4 r;
# if defined(__KERNEL_CUDA__)
# if __CUDA_ARCH__ >= 300
CUtexObject tex = kernel_tex_fetch(__bindless_mapping, id);
const int texture_type = kernel_tex_type(id);
if(texture_type == IMAGE_DATA_TYPE_FLOAT4 ||
texture_type == IMAGE_DATA_TYPE_BYTE4 ||
texture_type == IMAGE_DATA_TYPE_HALF4)
{
r = kernel_tex_image_interp_3d_float4(tex, co.x, co.y, co.z);
}
else {
float f = kernel_tex_image_interp_3d_float(tex, co.x, co.y, co.z);
r = make_float4(f, f, f, 1.0f);
}
# else /* __CUDA_ARCH__ >= 300 */
r = volume_image_texture_3d(id, co.x, co.y, co.z);
# endif
# elif defined(__KERNEL_OPENCL__)
r = kernel_tex_image_interp_3d(kg, id, co.x, co.y, co.z);
# else
r = kernel_tex_image_interp_3d(id, co.x, co.y, co.z);
# endif /* __KERNEL_CUDA__ */
float4 r = kernel_tex_image_interp_3d(kg, id, co.x, co.y, co.z);
#else
float4 r = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
#endif