I have a kernel :

"il_ps_2_0\n"

"dcl_cb cb0[1]\n"

"dcl_input_interp(linear) v0.xy\n"

"dcl_output_generic o0.x___\n"

"dcl_resource_id(0)_type(2d)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float)\n"

"dcl_resource_id(1)_type(2d)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float)\n"

"dcl_literal l0, 0x00000000, 0x00000000, 0x00000000, 0x00000000\n"

"dcl_literal l1, 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000\n"

//l2==128

"dcl_literal l2, 0x43000000, 0x43000000, 0x00000000, 0x00000000\n"

"dcl_literal l3, 0x3F000000, 0x3F000000, 0x00000000, 0x00000000\n"

"mov r0.__zw, l0\n"

"sub r2.x, v0.x, l3\n"//making normal thread number

"mad r2.z, r2.x , l2.x, r0.w"//making normal memory pointer

"sample_resource(0)_sampler(0) r0.xy__, r2.z\n"

"sample_resource(1)_sampler(0) r2.y, r0.y\n"

"mad_ieee r0.__z_, r0.x, r2.y, r0.z\n"

"mov o0.x___, r0.z\n"

"ret_dyn\n"

"end\n";

Memory pointers are ok, and data on resource 0 looks like this

for each thread(128 at all):

N0(12, 1 ) ... N63(12,1) N64(32,1).... N127(32,1)

but result looks like in is for first thread N0(12,1) and all another (32,1)

So I don't know why it samples another values

When you declare resources like this-

dcl_resource_id(0)_type(2d)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float)

Sampling is expected to be done using a normalized co-ordinate(x/width, y/height). If you want to use un-normalized co-ordinates, declare resources with unnorm keyword.

dcl_resource_id(0)_type(2d, unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float)