The boundary of texture

hello,

when iy ==0,

I wanna get the result of tex2D(tex,x,y-1), but beyond the boundary,

I know that cudaAddressModeClamp and cudaAddressModeWrap work,
But how to do if I want to make the tex2D(tex,x,y-1) to be zero.

pad your texture with zeros on all sides and use cudaAdressModeClamp?

cudaAdressModeClamp can’t get what I want;

and how to pad with zeros?

Just add a zero doundary to your texture, or simply, just set the boundary zero.

Thank you,but could you give away more details,

Some code example would be best, :)

old texture (3x6):

1 2 3 4
5 6 7 8
9 8 7 6

new texture (5x6)

0 0 0 0 0 0
0 1 2 3 4 0
0 5 6 7 8 0
0 9 8 7 6 0
0 0 0 0 0 0

And then use adressmodeclamp. (and add 1 to all your indices accessing the texture)