The state of resources needs to be tracked on device level.
The state that are being tracked include:
- Modification stamps: Each time a resource is modified, this stamp is increased. Inside the render graph nodes track the resources including this stamp.
- Image layouts: The layout of pixels of an image on the GPU depends on the command being executed. A certain
vkCmd* requires the image to be in a certain layout. Using incorrect layouts could lead to rendering artifacts.
- Resource ownership: Resources that are externally managed (swap chain or external) uses a different workflow as its state can be altered externally and needs to be reset.
- Read/Write access masks: To generate correct and performing pipeline barriers the src/dst access masks needs to be accurate and precise. When creating pipeline barriers the resource usage up to that point should be known and the resource usage from that point on.
Definition in file vk_resource_state_tracker.hh.