I’m guessing you haven’t informed it to only fetch byte (8bit) data, so it’s grabbing 32bits at a time instead. When you bind the texture, try something like:
[indent]cudaBindTexture(0, tex, charBuf, cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsigned), BUFSIZE);[/indent]
where charBuf is a pointer to the char buffer, and BUFSIZE is the count of bytes in the buffer. Use “cudaChannelFormatKindSigned” if you really want signed “char” types rather than unsigned.
I’m guessing you haven’t informed it to only fetch byte (8bit) data, so it’s grabbing 32bits at a time instead. When you bind the texture, try something like:
[indent]cudaBindTexture(0, tex, charBuf, cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsigned), BUFSIZE);[/indent]
where charBuf is a pointer to the char buffer, and BUFSIZE is the count of bytes in the buffer. Use “cudaChannelFormatKindSigned” if you really want signed “char” types rather than unsigned.