Skip to content

Commit

Permalink
Add LunarG api dump layer to ANGLE vulkan back-end
Browse files Browse the repository at this point in the history
Bug: angleproject:8623
Change-Id: Ia4dbd5915c5fe918cd65e09b468e0b8d094522f7
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5601070
Commit-Queue: Mark Łobodziński <[email protected]>
Reviewed-by: Cody Northrop <[email protected]>
Commit-Queue: Cody Northrop <[email protected]>
  • Loading branch information
mark-lunarg authored and Angle LUCI CQ committed Jun 19, 2024
1 parent 1917377 commit 37b2487
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
/third_party/libunwind/src
/third_party/llvm-build
/third_party/llvm/src
/third_party/lunarg-vulkantools/src
/third_party/markupsafe
/third_party/meson
/third_party/nasm
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
path = third_party/glslang/src
url = https://chromium.googlesource.com/external/github.com/KhronosGroup/glslang
gclient-condition = not build_with_chromium
[submodule "third_party/lunarg-vulkantools/src"]
path = third_party/lunarg-vulkantools/src
url = https://chromium.googlesource.com/external/github.com/LunarG/VulkanTools
gclient-condition = not build_with_chromium
[submodule "third_party/spirv-cross/src"]
path = third_party/spirv-cross/src
url = https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross
Expand Down
8 changes: 8 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,10 @@ if (is_android && symbol_level != 0) {
}
}

if (angle_enable_vulkan_api_dump_layer) {
sources += [ "$root_out_dir/libVkLayer_lunarg_api_dump$shlib_extension" ]
}

script = rebase_path("${root_build_dir}/android/compress_symbols.py",
root_build_dir)

Expand All @@ -1779,6 +1783,10 @@ if (is_android && symbol_level != 0) {
}
}

if (angle_enable_vulkan_api_dump_layer) {
deps += [ "$angle_lunarg_vulkantools_dir:VkLayer_lunarg_api_dump" ]
}

outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]

android_nm = "${android_tool_prefix}nm"
Expand Down
5 changes: 5 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,11 @@ deps = {
'condition': 'not build_with_chromium',
},

'third_party/lunarg-vulkantools/src': {
'url': '{chromium_git}/external/github.com/LunarG/VulkanTools@413b7630fa6005667c83133ee7475e14309d1d93',
'condition': 'not build_with_chromium',
},

'third_party/spirv-cross/src': {
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3',
'condition': 'not build_with_chromium',
Expand Down
1 change: 1 addition & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ per-file third_party/jsoncpp=*
per-file third_party/libc++/src=*
per-file third_party/libc++abi/src=*
per-file third_party/libunwind/src=*
per-file third_party/lunarg-vulkantools/src=*
per-file third_party/markupsafe=*
per-file third_party/mesa/src=*
per-file third_party/meson=*
Expand Down
15 changes: 15 additions & 0 deletions android/angle_apk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ if (enable_java_templates) {
"($android_secondary_abi_toolchain)" ]
}
}
if (angle_enable_vulkan_api_dump_layer) {
secondary_abi_shared_libraries +=
[ "$angle_lunarg_vulkantools_dir:VkLayer_lunarg_api_dump" +
"($android_secondary_abi_toolchain)" ]
}
} else {
_secondary_out_dir = get_label_info(
":compressed_symbols($android_secondary_abi_toolchain)",
Expand All @@ -79,6 +84,9 @@ if (enable_java_templates) {
secondary_abi_loadable_modules += [ "${_secondary_out_dir}/lib.compressed/lib${_layer}${shlib_extension}" ]
}
}
if (angle_enable_vulkan_api_dump_layer) {
secondary_abi_loadable_modules += [ "${_secondary_out_dir}/lib.compressed/libVkLayer_lunarg_api_dump${shlib_extension}" ]
}
}
}

Expand All @@ -93,6 +101,10 @@ if (enable_java_templates) {
[ "$angle_vulkan_validation_layers_dir:${_layer}" ]
}
}
if (angle_enable_vulkan_api_dump_layer) {
shared_libraries +=
[ "$angle_lunarg_vulkantools_dir:VkLayer_lunarg_api_dump" ]
}
} else {
loadable_modules = []
foreach(_library, angle_libraries) {
Expand All @@ -105,6 +117,9 @@ if (enable_java_templates) {
]
}
}
if (angle_enable_vulkan_api_dump_layer) {
loadable_modules += [ "$root_out_dir/lib.compressed/libVkLayer_lunarg_api_dump${shlib_extension}" ]
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions build_overrides/lunarg_vulkantools.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2023 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.

import("//build_overrides/vulkan_common.gni")

vulkan_utility_libraries_dir = "//third_party/vulkan-utility-libraries/src"
32 changes: 32 additions & 0 deletions doc/DebuggingTips.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,38 @@ variable (set in OS-specific manner):
* 0: Turned off/disabled (default)
* 1: Turned on/enabled

## Enable Vulkan Call Logging

ANGLE can output Vulkan api call information including detailed parameter info and state. Vulkan
call logging will be enabled when the following GN arg is set:
```
angle_enable_vulkan_api_dump_layer = true
```

By default Vulkan call logging goes to stdout, or logcat on Android. Vulkan call logging can be
used with trace event and debug marker output as shown in [enabling general logging](#enabling-general-logging)
and [enabling Debug-Utils markers](#enabling-debug-utils-markers)

### Vulkan Call Logging on Desktop

For Vulkan call logging output to a file, set
the environment variable VK_APIDUMP_LOG_FILENAME to the correct location.

To show only Vulkan api calls without verbose parameter details set the environment variable
VK_APIDUMP_DETAILED to `false`

### Vulkan Call Logging on Android

For Vulkan call logging to a file on Android, specify the filename with an Android debug property that is
automatically deleted at the next reboot::
```
adb shell setprop debug.apidump.log_filename /data/data/[PACKAGE_NAME, i.e., com.android.angle.test for angle_trace_tests]/api_dump.txt
```

Similarly, detailed parameter output can be controlled by the following Android debug properties:
```
adb shell setprop debug.apidump.detailed false
```

## Running ANGLE under GAPID on Linux

Expand Down
3 changes: 3 additions & 0 deletions gni/angle.gni
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ declare_args() {
angle_enable_vulkan && !is_ubsan && !is_tsan && !is_asan &&
angle_debug_layers_enabled &&
(!is_android || (ndk_api_level_at_least_26 && !build_with_chromium))
angle_enable_vulkan_api_dump_layer = false

# ISpriteVisual windows cannot be validated and can lead to crashes if an invalid window is
# provided to ANGLE. Disable them for non-standalone ANGLE builds. crbug.com/1176118
Expand All @@ -300,6 +301,8 @@ declare_args() {
angle_vulkan_tools_dir = "$angle_root/third_party/vulkan-tools/src"
angle_vulkan_validation_layers_dir =
"$angle_root/third_party/vulkan-validation-layers/src"
angle_lunarg_vulkantools_dir =
"$angle_root/third_party/lunarg-vulkantools/src"

angle_build_vulkan_system_info = angle_has_build && !angle_is_winuwp

Expand Down
12 changes: 12 additions & 0 deletions src/common/vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,16 @@ if (angle_enable_vulkan) {
}
}
}

if (angle_enable_vulkan_api_dump_layer) {
group("lunarg_vulkantools") {
data_deps = []
if (!is_fuchsia) {
data_deps += [ "$angle_lunarg_vulkantools_dir:lunarg_vulkantools" ]
if (!is_android) {
data_deps += [ "$angle_lunarg_vulkantools_dir:vulkan_gen_json_files" ]
}
}
}
}
}
7 changes: 7 additions & 0 deletions src/libANGLE/renderer/vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ config("angle_vulkan_backend_config") {
if (angle_enable_vulkan_validation_layers) {
defines += [ "ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS" ]
}
if (angle_enable_vulkan_api_dump_layer) {
defines += [ "ANGLE_ENABLE_VULKAN_API_DUMP_LAYER" ]
}

defines += [ "ANGLE_ENABLE_VULKAN_SHARED_RING_BUFFER_CMD_ALLOC=" +
"${angle_enable_vulkan_shared_ring_buffer_cmd_alloc}" ]
Expand Down Expand Up @@ -153,6 +156,10 @@ template("angle_vulkan_backend_template") {
data_deps += [ "$angle_root/src/common/vulkan:vulkan_validation_layers" ]
}

if (angle_enable_vulkan_api_dump_layer) {
data_deps += [ "$angle_root/src/common/vulkan:lunarg_vulkantools" ]
}

if (is_linux || is_chromeos) {
deps += [ "$angle_root/src/common/linux:angle_dma_buf" ]
if (angle_use_gbm) {
Expand Down
3 changes: 3 additions & 0 deletions src/libANGLE/renderer/vulkan/vk_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,9 @@ angle::Result Renderer::initialize(vk::Context *context,
}

VulkanLayerVector enabledInstanceLayerNames;
#if defined(ANGLE_ENABLE_VULKAN_API_DUMP_LAYER)
enabledInstanceLayerNames.push_back("VK_LAYER_LUNARG_api_dump");
#endif
if (mEnableValidationLayers)
{
const bool layersRequested = useValidationLayers == UseValidationLayers::Yes;
Expand Down
3 changes: 3 additions & 0 deletions src/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ template("angle_common_test_utils") {
if (angle_enable_vulkan_validation_layers) {
data_deps += [ "$angle_root/src/common/vulkan:vulkan_validation_layers" ]
}
if (angle_enable_vulkan_api_dump_layer) {
data_deps += [ "$angle_root/src/common/vulkan:lunarg_vulkantools" ]
}
}
}

Expand Down
15 changes: 15 additions & 0 deletions third_party/lunarg-vulkantools/README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Name: LunarG VulkanTools
Short Name: VulkanTools
Version: N/A
URL: https://github.com/LunarG/VulkanTools
SOURCE CODE: git clone https://github.com/LunarG/VulkanTools.git
Revision: HEAD
Security Critical: no
Shipped: no
License: Apache 2.0
License File: src/LICENSE.txt

Description:

The LunarG VulkanTools repository contains the LunarG API Dump
Vulkan layer.
1 change: 1 addition & 0 deletions third_party/lunarg-vulkantools/src
Submodule src added at 413b76

0 comments on commit 37b2487

Please sign in to comment.