
Использование текстур
Использование текстур
(пример часть 2)
// set texture parameters
tex.addressMode[0] = cudaAddressModeWrap;
tex.addressMode[1] = cudaAddressModeWrap;
p
tex.filterMode = cudaFilterModeLinear;
tex.normalized =
true
;
// access with normalized texture coordinates
// Bind the array to the texture
//
y
CUDA_SAFE_CALL( cudaBindTextureToArray( tex, cu_array, channelDesc));
dim3
dimBlock(8, 8, 1);
dim3
dimGrid(width / dimBlock.x, height / dimBlock.y, 1);
dim3
dimGrid(width / dimBlock.x, height / dimBlock.y, 1);
// warmup
transformKernel
<<<
dimGrid, dimBlock, 0
>>>
( d_data, width, height, angle);
CUDA_SAFE_CALL( cudaThreadSynchronize() );
// execute the kernel
transformKernel
<<<
dimGrid dimBlock 0
>>>
( d data width height angle);
transformKernel
<<<
dimGrid, dimBlock, 0
>>>
( d_data, width, height, angle);