# c++array, cudaarray, texture

**URL:** <https://forums.developer.nvidia.com/t/c-array-cudaarray-texture/5963>\
**Category:** CUDA Programming and Performance\
**Created:** [October 17, 2008, 6:55pm UTC](https://forums.developer.nvidia.com/t/c-array-cudaarray-texture/5963 "2008-10-17T18:55:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![enjoygpu](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@enjoygpu](https://forums.developer.nvidia.com/u/enjoygpu)\
**Post date:** [October 17, 2008, 6:55pm UTC](https://forums.developer.nvidia.com/t/c-array-cudaarray-texture/5963/1 "2008-10-17T18:55:57Z")

</div>

Hi,  
If I want to use 3D texture do I need use 3D cudaarray. If I use 3D cudaarray do I use 3D c++ array to transform the data from cpu to gpu?

---

<div class="post-metadata">

**Author:** ![Simon\_Green](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Simon\_Green](https://forums.developer.nvidia.com/u/Simon_Green)\
**Post date:** [October 18, 2008, 1:18pm UTC](https://forums.developer.nvidia.com/t/c-array-cudaarray-texture/5963/2 "2008-10-18T13:18:52Z")

</div>

Yes, you need to use a 3D array (allocated using cudaMalloc3DArray) if you want to read the texture with tex3D() - see the simpleTexture3D sample in the SDK.

You don’t need to use a 3D array on the host (it’s all linear anyway) - you can transfer the data in almost any layout using cudaMemcpy3D.
