I would like to do smth like this and results are not correct (CUDA 2.2):
texture<float2, 1, cudaReadModeElementType> _texA = tex_a;
if(Sel == 1) _texA = tex_b;
else if(Sel == 2) _texA = tex_c;
for(int i = 0; i < 8; i++) {
const float2 val = tex1Dfetch(_texA, i);
....
Sometimes I receive this:
Error: External calls are not supported (found non-inlined call to _ZN7textureI6float2Li1EL19cudaTextureReadMode0EEC1Ei21cudaTe
xtureFilterMode22cudaTextureAddressMode)
However this is of course supported:
texture<float2, 1, cudaReadModeElementType> _texA = tex_a;
if(Sel == 1) _texA = tex_b;
else if(Sel == 2) _texA = tex_c;
for(int i = 0; i < 8; i++) {
const float2 val = Sel == 0 ? tex1Dfetch(_tex_a, i) : (Sel == 1 ? tex1Dfetch(_tex_b, i) : tex1Dfetch(_tex_c, i));
}
I hope that first code could be more efficient :)