dougallj / applegpu

Apple G13 GPU architecture docs and tools
BSD 3-Clause "New" or "Revised" License
545 stars 40 forks source link

Handle pixel fence wait/signal instructions #42

Closed alyssarosenzweig closed 1 year ago

alyssarosenzweig commented 1 year ago

In my current understanding, each pixel has a number of associated fences. From the perspective of a pixel shader invocation P, a fence is completed when every older pixel shader invocation P' shading the same pixel (due to overdraw in the scene) has signalled the fence or completed execution. This includes the vacuous case when there is no overdraw. A given pixel shader can wait for this condition (wait_pix with the desired fence ID) and can signal to other pixels that it's safe to proceed. This mechanism can be used to implement rasterizer-ordered views and fragment shader interlock, but in its most basic form it's just required to properly order writes to the tilebuffer.