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

Method FinishDeviceSetup

layers/core_checks/cc_device.cpp:322–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322void CoreChecks::FinishDeviceSetup(const VkDeviceCreateInfo* pCreateInfo, const Location& loc) {
323 vvl::DeviceProxy::FinishDeviceSetup(pCreateInfo, loc);
324
325 spirv_environment = PickSpirvEnv(api_version, IsExtEnabled(extensions.vk_khr_spirv_1_4));
326 AdjustValidatorOptions(extensions, enabled_features, spirv_environment, spirv_val_options, &spirv_val_option_hash,
327 spirv_val_command);
328
329 // Allocate shader validation cache
330 if (!disabled[shader_validation_caching] && !disabled[shader_validation] && !core_validation_cache) {
331 auto tmp_path = GetTempFilePath();
332 validation_cache_path = tmp_path + "/shader_validation_cache";
333#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__GNU__)
334 validation_cache_path += "-" + std::to_string(getuid());
335#endif
336 validation_cache_path += ".bin";
337
338 std::vector<char> validation_cache_data;
339 std::ifstream read_file(validation_cache_path.c_str(), std::ios::in | std::ios::binary);
340
341 if (read_file) {
342 std::copy(std::istreambuf_iterator<char>(read_file), {}, std::back_inserter(validation_cache_data));
343 read_file.close();
344 } else {
345 LogInfo("WARNING-cache-file-error", device, loc,
346 "Cannot open shader validation cache at %s for reading (it may not exist yet)", validation_cache_path.c_str());
347 }
348
349 VkValidationCacheCreateInfoEXT cacheCreateInfo = vku::InitStructHelper();
350 cacheCreateInfo.initialDataSize = validation_cache_data.size();
351 cacheCreateInfo.pInitialData = validation_cache_data.data();
352 cacheCreateInfo.flags = 0;
353 CoreLayerCreateValidationCacheEXT(device, &cacheCreateInfo, nullptr, &core_validation_cache);
354 }
355}
356
357void CoreChecks::PreCallRecordDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator,
358 const RecordObject& record_obj) {

Callers

nothing calls this directly

Calls 7

PickSpirvEnvFunction · 0.85
IsExtEnabledFunction · 0.85
AdjustValidatorOptionsFunction · 0.85
GetTempFilePathFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected