Passing buffers between kernels - empty values

I have written a pair of kernel functions to generate a height map using noise.


The first kernel generates noise values as floats in a buffer. The second kernel uses the noise values to generate terrain as vertices, with the z value being copied from the noise.


(Why are they separate? 1. I want to re-use the noise buffer in other follow-on kernels or render pipelines. 2. the noise buffer need not be the same dimension as the vertex buffer. In fact, it is usually a multiple.)


When the size of the noise data buffer exceeds 128*128, all data past that is seen as zero by the terrain generator. This leads to flat sections in my terrain, where all the height values are zero.


For example, if my terrain is generated in chunks with 32*32 strips (33 * 33 vertices), and the noise multiple is 4x, so 129*129.


For now, I can use smaller terrain chunks, but I would prefer to go bigger. In addition, I want to use the exact same noise buffer to generate a normal map, and want it to be quite large. I could alternately use textures instead of a buffer, but that seems inappropriate to the terrain use case.


If I inspect the noise values in Xcode's debugger (using quicklook feature), all the values seem to be there. But I can only inspect it after waiting for the command buffer to complete processing. So it's not surprising that all the data is there. (I suspect that the quicklook feature even implicitly does a blit resource sync. I have used it to preview textures that weren't readable in my code because I forgot to blit them, but they were visible in the debugger. That was confusing.)


Image:


https://cvws.icloud-content.com/B/ARuDoUUnxDTX4EMNIIldtWMzqkGPAVQ-PzweS83D9r081yYijD0wmw7Y/Terrain+error.png?o=AsDMJ3RdFqpB9RgeXB2FZIGysmfsecsXyXYdJ88w8Cci&v=1&x=3&a=B8-AmRmaYktozE2aZjJeu7C0QU6NA_iMRAEAAAPpjEQ&e=1531856149&k=TbaTaG9E7CuqopgIjKEbxg&fl=&r=5533c690-1ef1-45a2-b0e0-2f527798a0c0-1&ckc=com.apple.clouddocs&ckz=com.apple.CloudDocs&p=59&s=hGYySkbLvBMaIlAaiqmHEPc8W5k&cd=i

Accepted Reply

The problem appears to be a driver issue. It happens on a MacBook Pro mid-2012 with GeForce 650M.


It doesn't happen on a 2017 iMac with an ATI card.

Replies

The problem appears to be a driver issue. It happens on a MacBook Pro mid-2012 with GeForce 650M.


It doesn't happen on a 2017 iMac with an ATI card.