diff options
author | Willem Jan Palenstijn <wjp@usecode.org> | 2021-11-26 12:10:19 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <wjp@usecode.org> | 2021-11-26 12:10:19 +0100 |
commit | df2592c48f4785eb3c4b7882faa815a0b56e3739 (patch) | |
tree | 59ca80ff9e2d4356c28ee48f64eb68494e5f3372 /cuda/3d/util3d.cu | |
parent | 9d7018a5c6c5fd4574a4e7ef76878040566ec472 (diff) | |
parent | 7cad7b813838ed2ddb65a4c9ea1c08c625c50043 (diff) | |
download | astra-df2592c48f4785eb3c4b7882faa815a0b56e3739.tar.gz astra-df2592c48f4785eb3c4b7882faa815a0b56e3739.tar.bz2 astra-df2592c48f4785eb3c4b7882faa815a0b56e3739.tar.xz astra-df2592c48f4785eb3c4b7882faa815a0b56e3739.zip |
Merge branch 'texture'
This replaces the deprecated CUDA texture reference API by texture objects.
Diffstat (limited to 'cuda/3d/util3d.cu')
-rw-r--r-- | cuda/3d/util3d.cu | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cuda/3d/util3d.cu b/cuda/3d/util3d.cu index 71b5668..3dc915d 100644 --- a/cuda/3d/util3d.cu +++ b/cuda/3d/util3d.cu @@ -378,6 +378,28 @@ bool transferHostProjectionsToArray(const float *projData, cudaArray* array, con return checkCuda(cudaMemcpy3D(&p), "transferHostProjectionsToArray 3D"); } +bool createTextureObject3D(cudaArray* array, cudaTextureObject_t& texObj) +{ + cudaChannelFormatDesc channelDesc = + cudaCreateChannelDesc(32, 0, 0, 0, cudaChannelFormatKindFloat); + + cudaResourceDesc resDesc; + memset(&resDesc, 0, sizeof(resDesc)); + resDesc.resType = cudaResourceTypeArray; + resDesc.res.array.array = array; + + cudaTextureDesc texDesc; + memset(&texDesc, 0, sizeof(texDesc)); + texDesc.addressMode[0] = cudaAddressModeBorder; + texDesc.addressMode[1] = cudaAddressModeBorder; + texDesc.addressMode[2] = cudaAddressModeBorder; + texDesc.filterMode = cudaFilterModeLinear; + texDesc.readMode = cudaReadModeElementType; + texDesc.normalizedCoords = 0; + + return checkCuda(cudaCreateTextureObject(&texObj, &resDesc, &texDesc, NULL), "createTextureObject3D"); +} + float dotProduct3D(cudaPitchedPtr data, unsigned int x, unsigned int y, |