Texture read -- specify a "fill_value"

Hello,

When an attempt is made to read a texture at an out-of-bounds location, the developer can have designed the texture to either return the value at a “wrapped/cyclically identical” location or the value at the “clamped/nearest boundry” location.

Instead of the above two, I would like the texture to return a “fill value”. One way to achieve this is to overwrite the values at the boundary of the texture by the fill_value and use cudaAddressModeClamp.

Question 1: Is there a way a more direct way (that avoids having to over-write the boundary values)?

Question 2: Any tips on the most efficient way to over-write the boundary values of a texture? (I am familiar with the simpleSurfaceWrite example that illustrates writing to a texture.)

Thanks

See: