Hey @warrenm, I was playing around with MPS from your tutorial http://metalbyexample.com/metal-performance-shaders-in-swift/ … now I want to try and chain some filters, Sobel and Resize for example but I'm not sure where to start. Any tips?
-
-
Replying to @jippoew
Ahh, that post is crazy-old! I’m working on new material, but it’s not ready yet. Are you using Obj-C or Swift?
1 reply 0 retweets 0 likes -
Replying to @warrenm
It still works after some tweaking ;) Always looking forward to new material! Metal has really interested me the last few years. I'm using Swift btw!
1 reply 0 retweets 0 likes -
Replying to @jippoew
Cool! So the chief thing to understand is that you can encode as much work as you want into a single command buffer; dependencies (between kernels) will be resolved automatically.
1 reply 0 retweets 0 likes -
The practical upshot of this is that you can try to encode kernels in-place, while providing a backup copy allocator to minimize allocations, but chaining from the output of one kernel to the input of another—even within one command buffer—should “just work.”
1 reply 0 retweets 0 likes -
All of this goes out the window if you’re using MTLHeap, where accesses are noted less granularly, but I suspect that for now you’re not using heaps?
2 replies 0 retweets 0 likes -
Replying to @warrenm
Nope, not using heaps. The part where I'm kind of stranded is the source and destination textures when I encode the filters, how to make sure these are the right size and set up in the correct way in general.
2 replies 0 retweets 0 likes
Hmm, so Sobel is 1:1 in general, right (modulo at most a very small border, depending on edge mode)? The question is how to allocate a destination texture of a resize kernel? In that event, I would suppose the dest size to be floor(scaleFactor*sourceSize)?
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.