[−][src]Module gaclen::graphics::frame
Frames are transient images on the screen and is the core of presenting the game to the user.
Drawing frames happens in a few steps, the first one is initializing all the resources necessary:
- A
Device
that will be drawing the frame. - One or more instances of
GraphicalPass
which configure how the device draws. - Data that is to be drawn (depends highly on the application).
Once the above is ready a frame can be drawn:
- Begin frame by
Frame::begin()
. - Set up the
GraphicalPass
to be used by callingFrame::begin_pass()
. - Invoke one or more
draw
calls in order to draw the geometry. - End the pass (by calling
PassInFrame::finish_pass()
). - (optionally) repeat steps 2-4.
- Finish the frame by calling
Frame::finish()
.
Note that gaclen hides some of the underlying mechanisms for ease of use, namely - command buffers, a core concept in using vulkan effectively.
The GPU
is technically does not receive any commands until Frame::finish()
is invoked.
The draw calls correspond to recording GPU commands related to drawing given data with given context, but the execution happens completely separately after Frame::finish()
is invoked.
Additionally the frame will be presented (shown on the screen) as soon as it's available, depending exactly on the Swapchain
being used.
Currently there is no functionality to wait until a frame is drawn or draw a frame without presenting it.
Structs
Frame | A frame in the process of being drawn. |
PassInFrame | A frame in the process of being drawn using a given |
Viewport | State of a single viewport. |
Enums
FrameFinishError | Error finishing the frame. |