diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2021-11-22 14:14:55 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <wjp@usecode.org> | 2021-11-26 12:09:09 +0100 |
commit | d4645875801d29402b1e3f2a42a5d9902a37a718 (patch) | |
tree | b81497857784e28ca0743b6ecbebb3299b8ef557 /cuda/3d/cone_fp.cu | |
parent | 64d42baf1bd15df8e0ecd00d89bb5c7be787cac2 (diff) | |
download | astra-d4645875801d29402b1e3f2a42a5d9902a37a718.tar.gz astra-d4645875801d29402b1e3f2a42a5d9902a37a718.tar.bz2 astra-d4645875801d29402b1e3f2a42a5d9902a37a718.tar.xz astra-d4645875801d29402b1e3f2a42a5d9902a37a718.zip |
De-duplicate 3D texture object creation
Diffstat (limited to 'cuda/3d/cone_fp.cu')
-rw-r--r-- | cuda/3d/cone_fp.cu | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/cuda/3d/cone_fp.cu b/cuda/3d/cone_fp.cu index e49ea24..2ef58ee 100644 --- a/cuda/3d/cone_fp.cu +++ b/cuda/3d/cone_fp.cu @@ -59,29 +59,6 @@ __constant__ float gC_DetVY[g_MaxAngles]; __constant__ float gC_DetVZ[g_MaxAngles]; -bool bindVolumeDataTexture(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), "cone_fp texture"); -} - - // x=0, y=1, z=2 struct DIR_X { __device__ float nSlices(const SDimensions3D& dims) const { return dims.iVolX; } @@ -474,12 +451,15 @@ bool ConeFP(cudaPitchedPtr D_volumeData, const SDimensions3D& dims, const SConeProjection* angles, const SProjectorParams3D& params) { - cudaTextureObject_t D_texObj; - // transfer volume to array cudaArray* cuArray = allocateVolumeArray(dims); transferVolumeToArray(D_volumeData, cuArray, dims); - bindVolumeDataTexture(cuArray, D_texObj); + + cudaTextureObject_t D_texObj; + if (!createTextureObject3D(cuArray, D_texObj)) { + cudaFreeArray(cuArray); + return false; + } bool ret; |