Last active
October 4, 2024 03:58
-
-
Save gterzian/aa5d96a89db280017b04917eee67f6ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------- MODULE Presentation ---------------------------- | |
EXTENDS FiniteSets, Integers, Sequences | |
VARIABLES next_presentation_id, current_presentation_id, pending_ids | |
CONSTANT N | |
---------------------------------------------------------------------------- | |
TypeOk == /\ next_presentation_id \in Int | |
/\ current_presentation_id \in Int | |
/\ pending_ids \in Seq(Int) | |
\* When there are no pending map asyncs, current is always next minus one. | |
PresentationSync == Len(pending_ids) = 0 | |
=> current_presentation_id = next_presentation_id - 1 | |
---------------------------------------------------------------------------- | |
Init == /\ next_presentation_id = 1 | |
/\ current_presentation_id = 0 | |
/\ pending_ids = <<>> | |
SwapchainPresent == /\ next_presentation_id' = next_presentation_id + 1 | |
/\ pending_ids' = Append(pending_ids, next_presentation_id) | |
/\ UNCHANGED<<current_presentation_id>> | |
UpdateContext == /\ next_presentation_id' = next_presentation_id + 1 | |
/\ current_presentation_id' = next_presentation_id | |
/\ UNCHANGED<<pending_ids>> | |
UpdateImage == /\ Len(pending_ids) = 1 | |
/\ current_presentation_id' = IF Head(pending_ids) > current_presentation_id | |
THEN Head(pending_ids) | |
ELSE current_presentation_id | |
/\ pending_ids' = Tail(pending_ids) | |
/\ UNCHANGED<<next_presentation_id>> | |
Next == \/ SwapchainPresent | |
\/ UpdateContext | |
\/ UpdateImage | |
Spec == Init /\ [][Next]_<<next_presentation_id, | |
current_presentation_id, | |
pending_ids>> | |
---------------------------------------------------------------------------- | |
THEOREM Spec => [](TypeOk /\ PresentationSync) | |
============================================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment