I am playing with the number of patches and have quite a wide range of behaviours that I can not understand easely : for eg go with 8x6 patches and you start getting weird ( corruption on the scene )
You can recover them easily ( for eg changing dynamically the patches to 4x4 & updating buffers ) will leave corruption on screen.
I suspect some form of stomping during the kernel function but Not entirely sure.
Has any one hit the same problem ?
Hi @pom73 - what sort of corruption do you mean? I’ve just tried setting
patches to 8 x 6 and
terrain to size
[8, 6] and don’t see anything weird on iOS 13 iPhone 11, or the Intel GPU or AMD on my MacBook Pro running Xcode 11 & Catalina.
Could you describe your hardware and operating systems, please? And either upload a photo or the zipped project?
so for eg, using the final codeproj,
let patches = (horizontal: 8, vertical: 6)
yields green pixel to appear when I rotate the terrain or if I zoom in zoom out. This is not happening for patches that are 6 by 6 for eg.
What I suspect is that the kernel is writing in areas outside of his intended destination but I am not sure 100% about it. Hard to confirm.
Mac (Retina 5K, 27-inch, 2017) / radeon 8 Gb / Catelina
btw, Never too late to say that your book is awesome
That’s frustrating. I’m just not seeing the same thing. Does this also happen on your iPhone / iPad?
And are you running the final code as supplied with the book with only that one change?
Thank you - I’m glad that you’re enjoying it!
It s on my Mac. ( iMac : Mac (Retina 5K, 27-inch, 2017) / radeon 8 Gb / Catalina ). I am still debugging it btw, I will reply to this if I get any sense about the why.
Might just be related to how the nb of patches and the dispatch ThreadgroupsPerGrid / ThreadPergroups computation.
Btw, after a couple of hours, I realized something : because the kernel function is set for 1D ( for the uint pid [[ thread_position_in_grid ]] in the shader ) you can t do a 2D dispatch on a grid.
in other words, if the kernel was using a uint2 then I could potentially build up the patches tessellation points in 2D as well.
in chapter 11, it s clearly written that we are doing a 1D compute shader, it just strike me that if I wanted to go after a 2D one, I would have to rewrite the shader for it to work
Can you tell me if indeed that s the case ?
Chapter 16, Particle Systems goes into compute in more depth. I’m not quite sure what you are trying to achieve.
The kernel function is just a way of working out how much each patch should be divided by the tessellator.
The vertex function then moves the generated vertices around in 3d.
Indeed chapter 16 goes beyond. What I wanted to do was to update the tessellation Buffers ( edge Factors ) in 2D not in 1D. I played a lot with the dispatch only to understand a bit late that the definition of the kernel function ( the signature of it ) dictates how dispatch can be done in relation to thread groups per grid and threads per group.
Otherwise, the problem I mentioned above is gone if if set a dispatch “properly”. setting thread groups per grid to the max of the cards and only 1 thread per thread groups make it work in any patches configuration I can try.
@pom73 Do you still have issues with this?