MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / GetLayerDataPtr

Function GetLayerDataPtr

tests/layers/device_profile_api.cpp:54–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52// For the given data key, look up the layer_data instance from given layer_data_map
53template <typename DATA_T>
54DATA_T* GetLayerDataPtr(void* data_key, std::unordered_map<void*, DATA_T*>& layer_data_map) {
55 DATA_T* debug_data;
56 /* TODO: We probably should lock here, or have caller lock */
57 auto got = layer_data_map.find(data_key);
58
59 if (got == layer_data_map.end()) {
60 debug_data = new DATA_T;
61 layer_data_map[(void*)data_key] = debug_data;
62 } else {
63 debug_data = got->second;
64 }
65
66 return debug_data;
67}
68
69template <typename DATA_T>
70void FreeLayerDataPtr(void* data_key, std::unordered_map<void*, DATA_T*>& layer_data_map) {

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected