Hello,
It’s nice that cuda does support classes but somehow they don’t work as expected … Suppose:
template<T>
class BLA {
texture<T,2,cudaReadModeNormalizedFloat> m_texture;
cudaArray* m_array;
cudaChannelDesc<T> m_desc;
void init() {
[...]
CUDA_SAFE_CALL( cudaBindTexture( m_texture, m_array, m_desc));
[...]
}
};
CudaBindTexture always fails if m_texture is a class member. As soon as I define the variable outside the class it works.
This hack works as well but it’s not really nice:
texture<uchar4,2,cudaReadModeNormalizedFloat> texRef;
template<T>
class BLA {
texture<T,2,cudaReadModeNormalizedFloat> m_texture;
cudaArray* m_array;
cudaChannelDesc<T> m_desc;
void init() {
[...]
memcpy((void*)&texRef, (void*)&m_texture, sizeof( texture<T, 2, cudaReadModeNormalizedFloat>));
CUDA_SAFE_CALL( cudaBindTexture( texRef, m_array, m_desc));
[...]
}
};
Is my problem a compiler bug or am I doing anything wrong?
regards
Pototschnig