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

Function GetEnvironment

layers/vk_layer_config.cpp:52–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50#endif
51
52std::string GetEnvironment(const char* variable) {
53#if !defined(__ANDROID__) && !defined(_WIN32)
54 const char* output = getenv(variable);
55 return output == NULL ? "" : output;
56#elif defined(_WIN32)
57 int size = GetEnvironmentVariable(variable, NULL, 0);
58 if (size == 0) {
59 return "";
60 }
61 char* buffer = new char[size];
62 GetEnvironmentVariable(variable, buffer, size);
63 std::string output = buffer;
64 delete[] buffer;
65 return output;
66#elif defined(__ANDROID__)
67 std::string var = variable;
68
69 if (std::string_view{variable} != kForceDefaultCallbackKey) {
70 // kForceDefaultCallbackKey is a special key that needs to be recognized for backwards compatibilty.
71 // For all other strings, prefix the requested variable with "debug.vvl." so that desktop environment settings can be used
72 // on Android.
73 var = "debug.vvl." + var;
74 }
75
76 const prop_info* prop_info = __system_property_find(var.data());
77
78 if (prop_info) {
79 std::string property;
80 __system_property_read_callback(prop_info, PropCallback, &property);
81 return property;
82 } else {
83 return "";
84 }
85#else
86 return "";
87#endif
88}
89
90void SetEnvironment(const char* variable, const char* value) {
91#if !defined(__ANDROID__) && !defined(_WIN32)

Callers 9

CheckAndroidVersionFunction · 0.85
GetTempFilePathFunction · 0.85
GetCondWaitTimeoutFunction · 0.85
GetShowStatsEnvVarFunction · 0.85
FinishDeviceSetupMethod · 0.85
LayerCreateCallbackFunction · 0.85
GetVkEnvironmentVariableFunction · 0.85
InitFrameworkMethod · 0.85

Calls 3

__system_property_findFunction · 0.85
dataMethod · 0.45

Tested by 1

GetVkEnvironmentVariableFunction · 0.68