Flutter Impeller
impeller::PipelineCacheHeaderVK Struct Reference

An Impeller specific header prepended to all pipeline cache information that is persisted on disk. This information is used to perform additional integrity checks that may have been missed by the Vulkan driver. More...

#include <pipeline_cache_data_vk.h>

Public Member Functions

 PipelineCacheHeaderVK ()
 Constructs a new empty instance. More...
 
 PipelineCacheHeaderVK (const VkPhysicalDeviceProperties &props, uint64_t p_data_size)
 Constructs a new instance that will be compatible with the given physical device properties. More...
 
bool IsCompatibleWith (const PipelineCacheHeaderVK &other) const
 Determines whether the specified o is compatible with. More...
 

Public Attributes

uint32_t magic = 0xC0DEF00D
 
uint32_t driver_version = 0
 
uint32_t vendor_id = 0
 
uint32_t device_id = 0
 
uint32_t abi = sizeof(void*)
 
uint8_t uuid [VK_UUID_SIZE] = {}
 
uint64_t data_size = 0
 

Detailed Description

An Impeller specific header prepended to all pipeline cache information that is persisted on disk. This information is used to perform additional integrity checks that may have been missed by the Vulkan driver.

Inspired by https://medium.com/@zeuxcg/creating-a-robust-pipeline-cache-with-vulkan-961d09416cda.

Definition at line 23 of file pipeline_cache_data_vk.h.

Constructor & Destructor Documentation

◆ PipelineCacheHeaderVK() [1/2]

impeller::PipelineCacheHeaderVK::PipelineCacheHeaderVK ( )
default

Constructs a new empty instance.

◆ PipelineCacheHeaderVK() [2/2]

impeller::PipelineCacheHeaderVK::PipelineCacheHeaderVK ( const VkPhysicalDeviceProperties &  props,
uint64_t  p_data_size 
)
explicit

Constructs a new instance that will be compatible with the given physical device properties.

Parameters
[in]propsThe properties.
[in]p_data_sizeThe data size.

Definition at line 100 of file pipeline_cache_data_vk.cc.

103  : driver_version(props.driverVersion),
104  vendor_id(props.vendorID),
105  device_id(props.deviceID),
106  data_size(p_data_size) {
107  std::memcpy(uuid, props.pipelineCacheUUID, VK_UUID_SIZE);
108 }

References uuid.

Member Function Documentation

◆ IsCompatibleWith()

bool impeller::PipelineCacheHeaderVK::IsCompatibleWith ( const PipelineCacheHeaderVK other) const

Determines whether the specified o is compatible with.

        The size of the data following the header may be different and
        is not part of compatibility checks.
Parameters
[in]otherThe other header.
Returns
True if the specified header is compatible with this one, False otherwise. The size of the data following the header may be different.

Definition at line 110 of file pipeline_cache_data_vk.cc.

111  {
112  // Check for everything but the data size.
113  return magic == o.magic && //
114  driver_version == o.driver_version && //
115  vendor_id == o.vendor_id && //
116  device_id == o.device_id && //
117  abi == o.abi && //
118  std::memcmp(uuid, o.uuid, VK_UUID_SIZE) == 0;
119 }

References abi, device_id, driver_version, magic, uuid, and vendor_id.

Referenced by impeller::testing::TEST().

Member Data Documentation

◆ abi

uint32_t impeller::PipelineCacheHeaderVK::abi = sizeof(void*)

Definition at line 34 of file pipeline_cache_data_vk.h.

Referenced by IsCompatibleWith(), and impeller::testing::TEST().

◆ data_size

uint64_t impeller::PipelineCacheHeaderVK::data_size = 0

Definition at line 36 of file pipeline_cache_data_vk.h.

Referenced by impeller::testing::TEST().

◆ device_id

uint32_t impeller::PipelineCacheHeaderVK::device_id = 0

Definition at line 31 of file pipeline_cache_data_vk.h.

Referenced by IsCompatibleWith(), and impeller::testing::TEST().

◆ driver_version

uint32_t impeller::PipelineCacheHeaderVK::driver_version = 0

Definition at line 29 of file pipeline_cache_data_vk.h.

Referenced by IsCompatibleWith(), and impeller::testing::TEST().

◆ magic

uint32_t impeller::PipelineCacheHeaderVK::magic = 0xC0DEF00D

Definition at line 25 of file pipeline_cache_data_vk.h.

Referenced by IsCompatibleWith().

◆ uuid

uint8_t impeller::PipelineCacheHeaderVK::uuid[VK_UUID_SIZE] = {}

◆ vendor_id

uint32_t impeller::PipelineCacheHeaderVK::vendor_id = 0

Definition at line 30 of file pipeline_cache_data_vk.h.

Referenced by IsCompatibleWith(), and impeller::testing::TEST().


The documentation for this struct was generated from the following files: