cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

macdonc
Journeyman III

Computer shader question

I am missing something in computer shader indexing. I have a 8x8 matix which I want to write the tid into. Why does the second row below start at 0x10. I would have expected it to increase 0x0,0x8,0x10,....

If the matrix was 16x16, I expect this output.

"il_cs_2_0\n"
"dcl_num_thread_per_group 64\n"
"mov g[vaTid.x], vaTid.x\n"
"ret_dyn\n"
"end\n"

0 0 0 0 1 1 1 1
10 10 10 10 11 11 11 11
20 20 20 20 21 21 21 21
30 30 30 30 31 31 31 31
40 40 40 40 41 41 41 41
50 50 50 50 51 51 51 51
60 60 60 60 61 61 61 61
70 70 70 70 71 71 71 71

 

0 Likes
4 Replies

are you reading data back based on the width or the pitch? Where the pitch is the value returned from calResMap.
0 Likes

I am reading it back based on the pitch

0 Likes

Using the global buffer you are accessing the memory in a linear fashion similiar to a C array, so you need to read it based on the width. The pitch is only required if you read from a buffer written to using the color writes(o register).
0 Likes

Ok thanks. I knew it must have been something straightforward.

0 Likes