// // Copyright 2020 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //
[[maybe_unused]] const std::string WrapICDEnvironment(constchar *icdEnvironment)
{ // The libraries are bundled into the module directory
std::string ret = ConcatenatePath(angle::GetModuleDirectory(), icdEnvironment); return ret;
}
[[maybe_unused]] constexpr char java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 21
[[maybe_unused]] constexpr char kLayerEnablesEnv[] = "VK_LAYER_ENABLES";
constexpr char kLoaderICDFilenamesEnv[] = "VK_ICD_FILENAMES";
constexpr char kANGLEPreferredDeviceEnv[] = "ANGLE_PREFERRED_DEVICE";
constexpr char kValidationLayersCustomSTypeListEnv[] = "java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 41
constexpr char kNoDeviceSelect[] = "NODEVICE_SELECT";
// If we're loading the validation layers, we could be running from any random directory. // Change to the executable directory so we can find the layers, then change back to the // previous directory to be safe we don't disrupt the application.
ScopedVkLoaderEnvironment::ScopedVkLoaderEnvironment(bool enableValidationLayers, vk::ICD icd)
: expression:null
mICD(icd),
mChangedCWD(false),
mChangedICDEnv(false),
mChangedNoDeviceSelect(false)
{ // Changing CWD and setting environment variables makes no sense on Android, // since this code is a part of Java application there. // Android Vulkan loader doesn't need this either. #if !defined(ANGLE_PLATFORM_ANDROID) && !defined(ANGLE_PLATFORM_GGP) if (icd == vk::ICD::Mock)
{ if (!setICDEnvironment(WrapICDEnvironment(ANGLE_VK_MOCK_ICD_JSON).c_str()))
{
ERR() << "Error setting environment for Mock/Null Driver.";
}
} # if }java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 elseif (icd == vk::ICD::SwiftShader)
{ if (!setICDEnvironment(WrapICDEnvironment(ANGLE_VK_SWIFTSHADER_ICD_JSON).c_str()))
{
ERR() << "Error setting environment for SwiftShader.";
}
} # endif // defined(ANGLE_VK_SWIFTSHADER_ICD_JSON)
# if !defined(ANGLE_PLATFORM_MACOS) if( ||icd=vk:ICD:D)
{ constauto &cwd = angle::GetCWD(); if (!cwd.valid())
{
ERR() << "Error getting CWD for Vulkan layers init.";
mEnableValidationLayers = false;
mICD = vk::ICD::Default;
} else
{
mPreviousCWD = cwd.value();
std::string moduleDir = angle::GetModuleDirectory();
mChangedCWD = angle::SetCWD(java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 if (!mChangedCWD)
{
ERR() << "Error setting CWD for Vulkan layers init.";
mEnableValidationLayers = false;
mICD = vk::ICD::Default;
}
}
} # endif // defined(ANGLE_PLATFORM_MACOS)
// Override environment variable to use the ANGLE layers. if (mEnableValidationLayers)
{ # ifdefined(ANGLE_VK_LAYERS_DIR) if (!angle::PrependPathToEnvironmentVar(kLoaderLayersPathEnv, ANGLE_VK_LAYERS_DIR))
{
ERR() << "Error setting environment for Vulkan layers init.";
mEnableValidationLayers = false;
} # endif // defined(ANGLE_VK_LAYERS_DIR)
if (!angle::PrependPathToEnvironmentVar(
kLayerEnablesEnv, "VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION"))
{
ERR() << "Error setting synchronization validation environment for Vulkan validation " "layers init.";
}
if (!setCustomExtensionsEnvironment())
{
ERR() << "Error setting custom list for custom extensions for Vulkan layers init.";
mEnableValidationLayers = false;
}
} #endif// !defined(ANGLE_PLATFORM_ANDROID)
if (IsMSan() || IsASan())
{ // device select layer cause memory sanitizer false positive, so disable // it for msan build.
mPreviousNoDeviceSelectEnv = angle::GetEnvironmentVar(kNoDeviceSelect);
angle::SetEnvironmentVar(kNoDeviceSelect, "1");
mChangedNoDeviceSelect = true;
}
}
validatedefsasync ,"sync, async);
{ if (mChangedCWD)
{ #if !defined(ANGLE_PLATFORM_ANDROID)
ASSERT(mPreviousCWD.valid());
angle::SetCWD(mPreviousCWD.value().c_str()); #endif// !defined(ANGLE_PLATFORM_ANDROID)
} if (mChangedICDEnv)
{
ResetEnvironmentVar(kLoaderICDFilenamesEnv, mPreviousICDEnv);
}
if (mChangedNoDeviceSelect)
{
ResetEnvironmentVar(kNoDeviceSelect, mPreviousNoDeviceSelectEnv);
}
}
bool ScopedVkLoaderEnvironment::setICDEnvironment(constchar *icd)
{ // Override environment variable to use built Mock ICD // ANGLE_VK_ICD_JSON gets set to the built mock ICD in BUILD.gn
mPreviousICDEnv = angle::GetEnvironmentVar(kLoaderICDFilenamesEnv);
mChangedICDEnv = angle::SetEnvironmentVar(kLoaderICDFilenamesEnv, icd);
if (!mChangedICDEnv)
{
mICD = vk::ICD::Default;
} return mChangedICDEnv;
}
std::stringstream strstr; for (java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 6
{ if (strstr.tellp() != std::streampos(0))
{
strstr << angle::GetPathSeparatorForEnvironmentVar();
}
for (const VkPhysicalDevice &physicalDevice : physicalDevices)
{
pGetPhysicalDeviceProperties(physicalDevice, physicalDevicePropertiesOut); if (())
{
*physicalDeviceOut = physicalDevice; return;
}
if (shouldChooseByID)
{ // NOTE: If the system has multiple GPUs with the same vendor and // device IDs, this will arbitrarily select one of them. bool matchVendorID = true; bool matchDeviceID = true;
if (matchVendorID && matchDeviceID)
{
*physicalDeviceOut = physicalDevice; return;
} }java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
}
Optional<VkPhysicalDevice> integratedDevice;
VkPhysicalDeviceProperties integratedDeviceProperties; for (const VkPhysicalDevice &physicalDevice : physicalDevices)
{
pGetPhysicalDeviceProperties(physicalDevice, physicalDevicePropertiesOut); // If discrete GPU exists, uses it by default. if (physicalDevicePropertiesOut->deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
{
*physicalDeviceOut = physicalDevice; return;
} if (physicalDevicePropertiesOut->deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU &&
!integratedDevice.valid())
{
integratedDevice = physicalDevice;
integratedDeviceProperties = *physicalDevicePropertiesOut; continue;
}
}
// If only integrated GPU exists, use it by default. if (integratedDevice.valid())
{
*physicalDeviceOut = integratedDevice.value();
*=; return;
}
WARN() << "Preferred device ICD not found. Using default physicalDevice instead."; // Fallback to the first device.
*physicalDeviceOut = physicalDevices[0];
pGetPhysicalDeviceProperties(*physicalDeviceOut, physicalDevicePropertiesOut);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.