You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have learned your code and write down some code to do some image processing. But my code could get right result and when debugging it I found that my code even can't show the colorful image.I tried a few days but still cannot get the right result image. May I post the code here to get some help for you?
(I delete the code of image processing and just I/O operation remained) global void Kernel2(float* output, int width, int height)
{
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
// int idx = (y * width + x) * 4;
int idx = y * width + x;
if(x < width && y < height)
{
// float u = x / (float)width;
// float v = y / (float)height;
output[idx] = float(tex2D(texRef, x + 0.5,y + 0.5)) ;
output[idx+1] = float(tex2D(texRef, x + 0.5 + 1,y + 0.5));
output[idx+2] = float(tex2D(texRef,x + 0.5 + 2,y + 0.5));
output[idx+3] = float(tex2D(texRef, x + 0.5 + 3, y + 0.5));
}
}
const int width = 512;
const int height = 512;
int main()
{
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 0, 0, 0, cudaChannelFormatKindFloat);
cudaArray* cuArray;
cudaMallocArray(&cuArray, &channelDesc, width*4, height);
I have learned your code and write down some code to do some image processing. But my code could get right result and when debugging it I found that my code even can't show the colorful image.I tried a few days but still cannot get the right result image. May I post the code here to get some help for you?
(I delete the code of image processing and just I/O operation remained)
global void Kernel2(float* output, int width, int height)
{
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
// int idx = (y * width + x) * 4;
int idx = y * width + x;
// float u = x / (float)width;
// float v = y / (float)height;
}
const int width = 512;
const int height = 512;
int main()
{
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 0, 0, 0, cudaChannelFormatKindFloat);
cudaArray* cuArray;
cudaMallocArray(&cuArray, &channelDesc, width*4, height);
}
The text was updated successfully, but these errors were encountered: