开发者

Compiling specific code NULLs my textures

A very strange error: if I add some specific code to my project, any textures I use contain nothing but 0. Even when I'm not running any of the code that was added.

The specific code here is the kernels of an nVidia CUDA sample [1], the Bicubic Texture Filtering sample, in specific the CatMulRom kernel. I've traced it down to one of the subfunctions. If I reset a variable there, everything returns to normal. It's really, really strange and I have no idea anymore what it could be. Adding and using the bicubic kernel causes no problems.

Here's the change that "fixes" the problem:

__host__ __device__
float catrom_w1(float a)
{
    a = 1;  // Fix
    return 1.0f + a*a*(-2.5f + 1.5f*a);
}

If I 开发者_运维技巧reset the variable, it works if I'm not using CatMulRom. If I do try to use it the textures are zero again. The textures in question are defined as follows:

texture<uchar1, 2, cudaReadModeNormalizedFloat> tex;

I've edited away the template, hoping it would solve the problem, but it persists.

[1] http://developer.download.nvidia.com/compute/cuda/sdk/website/samples.html


You've busted your stack.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜