# 1d texture and memory buffer

**URL:** <https://forums.developer.nvidia.com/t/1d-texture-and-memory-buffer/12356>\
**Category:** CUDA Programming and Performance\
**Created:** [September 23, 2009, 10:50pm UTC](https://forums.developer.nvidia.com/t/1d-texture-and-memory-buffer/12356 "2009-09-23T22:50:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmnox](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pmnox](https://forums.developer.nvidia.com/u/pmnox)\
**Post date:** [September 23, 2009, 10:50pm UTC](https://forums.developer.nvidia.com/t/1d-texture-and-memory-buffer/12356/1 "2009-09-23T22:50:14Z")

</div>

I would like to allocate 1 dimentional buffer and use it for writting in one kernel.  
And as a 1d texture in the second one?  
Is it possible to do that?  
Is it possible to use 1d buffer as both 1d buffer and texture at the same time?

I don’t require correctiveness. I know that memory may change and a cache won’t be updated.

I noticed that texture is binded to cudaArray. Is it possible to write to a cudaArray from a gpu kernel?

---

<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:** [September 25, 2009, 11:34am UTC](https://forums.developer.nvidia.com/t/1d-texture-and-memory-buffer/12356/2 "2009-09-25T11:34:05Z")

</div>

It is not possible to write directly to cudaArrays.

However, you can bind linear memory as a texture and read it using the tex1Dfetch() function. It is possible to write to this memory at the same time, although as you mention you have to careful about cache consistency.
