Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:49:43

0001 #include "scuda.h"
0002 #include "squad.h"
0003 #include "stdio.h"
0004 
0005 
0006 template <typename T>
0007 __global__ void _QTexLookup_lookup(cudaTextureObject_t tex, quad4* d_meta, T* lookup, unsigned num_lookup, unsigned width, unsigned height )
0008 {
0009     unsigned ix = blockIdx.x*blockDim.x + threadIdx.x;
0010     unsigned iy = blockIdx.y*blockDim.y + threadIdx.y;
0011     if (ix >= width || iy >= height) return;
0012     
0013     unsigned index = iy * width + ix ;
0014 
0015     unsigned nx = d_meta ? d_meta->q0.u.x : 0 ;
0016     unsigned ny = d_meta ? d_meta->q0.u.y : 0 ; 
0017 
0018     float x = (float(ix)+0.5f)/float(nx) ;
0019     float y = (float(iy)+0.5f)/float(ny) ;
0020 
0021     T v = tex2D<T>( tex, x, y );
0022 
0023     if( ix % 100 == 0 ) printf( "//_QTexLookup_lookup  ix %d iy %d width %d height %d index %d nx %d ny %d x %10.4f y %10.4f \n", ix, iy, width, height, index, nx, ny, x, y );
0024 
0025     lookup[index] = v ;
0026 }   
0027 
0028 
0029 template <typename T>
0030 extern void QTexLookup_lookup(dim3 numBlocks, dim3 threadsPerBlock, cudaTextureObject_t tex, quad4* meta, T* lookup, unsigned num_lookup, unsigned width, unsigned height  )
0031 {
0032     printf("//QTexLookup_lookup num_lookup %d height %d width %d \n", num_lookup, height, width );  
0033     _QTexLookup_lookup<T><<<numBlocks,threadsPerBlock>>>(tex, meta, lookup, num_lookup, width, height );
0034 } 
0035 
0036 template void QTexLookup_lookup(dim3, dim3, cudaTextureObject_t, quad4*, float4* , unsigned, unsigned, unsigned ); 
0037 template void QTexLookup_lookup(dim3, dim3, cudaTextureObject_t, quad4*, float*  , unsigned, unsigned, unsigned ); 
0038