Skip to content

Commit fdb5bbf

Browse files
committed
Auto set the output dir of vvl logs
1 parent 4c53c06 commit fdb5bbf

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/vulkan/wrapper/wrapper_instance.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,35 @@ WRAPPER_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
300300
wrapper_create_info.ppEnabledExtensionNames = wrapper_enable_extensions;
301301

302302
const char* layers[wrapper_create_info.enabledLayerCount + 1];
303+
char time_str[20];
304+
char path[256];
305+
const char* log_filename[] = { path };
306+
const char* report_flags[] = { "error", "info", "warn" };
307+
308+
const VkLayerSettingEXT layer_setting[] = {
309+
{
310+
"VK_LAYER_KHRONOS_validation",
311+
"log_filename",
312+
VK_LAYER_SETTING_TYPE_STRING_EXT,
313+
1,
314+
log_filename,
315+
},
316+
{
317+
"VK_LAYER_KHRONOS_validation",
318+
"report_flags",
319+
VK_LAYER_SETTING_TYPE_STRING_EXT,
320+
3,
321+
report_flags,
322+
},
323+
};
324+
325+
VkLayerSettingsCreateInfoEXT layer_settings_create_info = {
326+
VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT,
327+
NULL,
328+
2,
329+
layer_setting,
330+
};
331+
303332
if (CHECK_FLAG("USE_VVL")) {
304333
if (!g_intercepted_layer_path) {
305334
WLOGE("Failed to intercept GraphicsEnv::SetLayerPaths(), cannot load VVL");
@@ -329,6 +358,11 @@ WRAPPER_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
329358
}
330359
layers[wrapper_create_info.enabledLayerCount - 1] = "VK_LAYER_KHRONOS_validation";
331360
wrapper_create_info.ppEnabledLayerNames = layers;
361+
362+
get_current_time_string(time_str, sizeof(time_str));
363+
sprintf(path, "/sdcard/Documents/Wrapper/%s_%s.%s.%d.txt", "vvl", time_str, getprogname(), getpid());
364+
layer_settings_create_info.pNext = wrapper_create_info.pNext;
365+
wrapper_create_info.pNext = &layer_settings_create_info;
332366
}
333367

334368
result = dispatch_create_instance(&wrapper_create_info, pAllocator,

0 commit comments

Comments
 (0)