Some tests on Nvidia GPUs.
This code uses two types of 3D textures.
Both of them contain unsigned short (16 bits) values.
- The first one will output normalized float. Output values are interpolated by the hardware.
- The second one will output unsigned short values. We don't use the hardware interpolation : we "manually" compute the interpolation by reading the 8 needed texels.
Then we compare both results. The software interpolation is more precise so we can evaluate the loss of precision when using hardware interpolation.
- C
- CUDA
Here are the output you should expect on an Nvidia GTX580.
$ make all
$ make run
./compareHardwareSoftwareTexInterp
L2 norm of difference : 0.015639.
$ make clean
You can also profile both kernels to compare performance between the two approachs.