Regarding using tile shaders to compute tessellation factors #1535
mbarriault
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Followup from my comment some time ago in #1192.
I spent a few hours yesterday evening (finally) trying to figure out a way to nudge Metal into recognizing shader side effects during a render encoder. This is probably obvious given what Apple has said about how vertex, fragment, and tile shaders get scheduled on Apple Silicon GPUs, but I can't any way of barriering commands. I tested both void vertex and tile shaders, writing to a buffer, and using the value of that buffer during a subsequent draw call in two scenarios, one reading in vertex and the other reading in fragment, as well as reading in tile.
It should be noted that Metal on Apple Silicon offers almost no tooling to suggest barriers between commands during a render encoder.
The results were essentially exactly what one would expect under the assumption that all vertex execution during a render encoder happens first, followed serially by all fragment+tile execution.
A big asterisk on these tests was that I was only testing for buffer visibility between shader stages. Buffer visibility into the tessellator wasn't tested, which is of course is the relevancy to MoltenVK. Regardless, I don't believe the success cases are reliable. There's no guarantee that a future Apple Silicon GPU won't overlap, and without any barrier API there's no way to prevent that in a future-proof way. Due to this, I don't believe there's any scenario where tile dispatch as it exists today can be used for tessellation control.
As a bonus test, I also ran the vertex-vertex test, with appropriate memoryBarrier in between, on an AMD Mac and it rendered correctly. Using a void vertex instead of kernel for tessellation control might be a performant alternative for legacy machines (assuming of course tessellation buffer fetch happens in the vertex stage so the barrier is applied correctly).
Beta Was this translation helpful? Give feedback.
All reactions