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 96 of file pipeline_cache_data_vk.cc.

99  : driver_version(props.driverVersion),
100  vendor_id(props.vendorID),
101  device_id(props.deviceID),
102  data_size(p_data_size) {
103  std::memcpy(uuid, props.pipelineCacheUUID, VK_UUID_SIZE);
104 }

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 106 of file pipeline_cache_data_vk.cc.

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

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:
impeller::PipelineCacheHeaderVK::abi
uint32_t abi
Definition: pipeline_cache_data_vk.h:34
impeller::PipelineCacheHeaderVK::driver_version
uint32_t driver_version
Definition: pipeline_cache_data_vk.h:29
impeller::PipelineCacheHeaderVK::magic
uint32_t magic
Definition: pipeline_cache_data_vk.h:25
impeller::PipelineCacheHeaderVK::data_size
uint64_t data_size
Definition: pipeline_cache_data_vk.h:36
impeller::PipelineCacheHeaderVK::uuid
uint8_t uuid[VK_UUID_SIZE]
Definition: pipeline_cache_data_vk.h:35
impeller::PipelineCacheHeaderVK::device_id
uint32_t device_id
Definition: pipeline_cache_data_vk.h:31
impeller::PipelineCacheHeaderVK::vendor_id
uint32_t vendor_id
Definition: pipeline_cache_data_vk.h:30