Module screen_13::pool

source ·
Expand description

Resource leasing and pooling types.

Screen 13 provides caching for acceleration structure, buffer and image resources which may be leased from configurable pools using their corresponding information structure. Most programs will do fine with a single FifoPool.

Leased resources may be bound directly to a render graph and used in the same manner as regular resources. After rendering has finished, the leased resources will return to the pool for reuse.

§Buckets

The provided Pool implementations store resources in buckets, with each implementation offering a different strategy which balances performance (more buckets) with memory efficiency (fewer buckets).

Screen 13’s pools can be grouped into two major categories:

§Examples

Leasing an image:

let mut pool = LazyPool::new(&device);

let info = ImageInfo::new_2d(vk::Format::R8G8B8A8_UNORM, 8, 8, vk::ImageUsageFlags::STORAGE);
let my_image = pool.lease(info)?;

assert!(my_image.info.usage.contains(vk::ImageUsageFlags::STORAGE));

§When Should You Use Which Pool?

These are fairly high-level break-downs of when each pool should be considered. You may need to investigate each type of pool individually to provide the absolute best fit for your purpose.

§Use a FifoPool when:

  • Low memory usage is most important
  • Automatic bucket management is desired

§Use a LazyPool when:

  • Resources have different attributes each frame

§Use a HashPool when:

  • High performance is most important
  • Resources have consistent attributes each frame

Modules§

  • Pool which leases from a single bucket per resource type.
  • Pool which leases by exactly matching the information before creating new resources.
  • Pool which leases by looking for compatibile information before creating new resources.

Structs§

Traits§

  • Allows leasing of resources using driver information structures.