# Texture cache & memory writes

**URL:** <https://forums.developer.nvidia.com/t/texture-cache-memory-writes/25048>\
**Category:** CUDA Programming and Performance\
**Created:** [November 28, 2011, 2:35am UTC](https://forums.developer.nvidia.com/t/texture-cache-memory-writes/25048 "2011-11-28T02:35:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![execute42](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@execute42](https://forums.developer.nvidia.com/u/execute42)\
**Post date:** [November 28, 2011, 2:35am UTC](https://forums.developer.nvidia.com/t/texture-cache-memory-writes/25048/1 "2011-11-28T02:35:51Z")

</div>

This is a conceptual question.  
Suppose I have a texture reference bound to some linear pitch memory.  
Furthermore, suppose I pass a pointer to this memory to a kernel.  
In this kernel, I can read the memory through the texture reference and write to the memory through the raw pointer.  
My question is can this work in a predictable (defined) way or is this just a bad thing to do? Does the texture cache become invalidated if a write occurs or could tex2D() return results inconsistent with the true data?

---

<div class="post-metadata">

**Author:** ![execute42](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@execute42](https://forums.developer.nvidia.com/u/execute42)\
**Post date:** [November 28, 2011, 3:15am UTC](https://forums.developer.nvidia.com/t/texture-cache-memory-writes/25048/2 "2011-11-28T03:15:39Z")

</div>

Nevermind, I answered this question by myself. The CUDA programming guide covers this in section 3.2.10.4.
