I try to implement a generic convolution using texture and constant memories but I encounter a problem with texture and constant memory scope. Is there a way to encapsulate texture and constant variables ? I try to do something like that :
[codebox]
template <typename T, unsigned D1, unsigned D2>
struct convolve2D
{
static void set_kernel(const T kernel[D1][D2]);
static void link_tex(const gpu_image src);
static global void apply(gpu_image dst);
static texture <T, 2, cudaReadModeElementType> tex;
static constant T kernel[D1][D2];
};[/codebox]