Quick texture memory questions

Does CUDA support 10 bit pixel formats (the equivalent of Direct3D’s D3DFMT_A2B10G10R10 and D3DFMT_A2R10G10B10 formats) in its texture memory? It does not look like it based off section B.3.1 in the CUDA Programming Guide.

Also, it is clear from the manual that CUDA supports reading from texture memory, but it was a little unclear to me whether or not CUDA supports writing to texutre memory.

Thanks in advance.

CUDA doesn’t define anything like a pixel format. Texture reads can be 32-bit, 64-bit, or 128-bit. You can intrepret the read as an int, float, unsigned int, or their vector versions like int4. If your data is actually stored in 10-bit chunks, then you’ll have to do some bit shifting and masking to extract it.

If a texture is bound to global memory, the global memory region can be written to directly. Just keep in mind that you cannot be sure if you will read a “new” written value or an old one within the same kernel launch. Once the kernel completes, subsequent launches will of course read the new values.

If a texture is bound to a cudaArray, the only way to write to it is via cudaMemcpyToArray.