-
Notifications
You must be signed in to change notification settings - Fork 16
SelectionId
SelectionId is an integer-like type that represents a unique identifier for the user's current selection. Every time the user selects a different set of renders in the UI, the SelectionId increments.
The motivation for SelectionId is to identify user requests that are out of date. Typically, the user can select bars in the graph faster than the retrace process can playback all of the requests. FrameRetrace will fall behind if the user rapidly selects renders.
However, every request encodes the current SelectionId in the request to the retrace process. When the asynchronous retrace thread is about to make a request, it can compare the request's SelectionId with the global SelectionId. If the UI has already incremented the global SelectionId, then the request is out of date. The user has already asked for FrameRetrace to display a different render, and there is no use in executing the request.
In this case the retrace thread drops the request on the floor. Similarly, when an asynchronous response is returned to the UI, the SelectionId is checked in the response. If the selection is out of date, the user does not want the response to be drawn on the UI.
With this mechanism, the retrace process can be at most one request behind the UI's selection. If the frame retraces in a fraction of a second, then the UI will not noticeably lag the user's actions.