vulkan_validation_layers.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. .. _doc_vulkan_validation_layers:
  2. Validation layers
  3. =================
  4. Validation layers enable developers to verify their application's correct use of
  5. the Vulkan API. Validation layers can be enabled in both debug and release
  6. builds, including in exported projects.
  7. .. note::
  8. Enabling validation layers has a performance impact, so only enable them
  9. when you actually need the output to debug the application.
  10. Windows
  11. -------
  12. Install the Vulkan SDK `<https://vulkan.lunarg.com/sdk/home>`__, which contains
  13. validation layers as part of its default installation. No need to enable any
  14. optional features in the installer; installing the core Vulkan SDK suffices. You
  15. don't need to reboot after installing the SDK, but you may need to close and
  16. reopen your current terminal.
  17. After installing the Vulkan SDK, run Godot with the ``--gpu-validation``
  18. :ref:`command line argument <doc_command_line_tutorial>`. You can also specify
  19. ``--gpu-abort`` which will make Godot quit as soon as a validation error happens.
  20. This can prevent your system from freezing if a validation error occurs.
  21. macOS
  22. -----
  23. .. warning::
  24. Official Godot macOS builds do **not** support validation layers, as these
  25. are statically linked against the Vulkan SDK. Dynamic linking must be used
  26. instead.
  27. In practice, this means that using validation layers on macOS **requires**
  28. you to use a Godot build compiled with the ``use_volk=yes`` SCons option.
  29. :ref:`doc_compiling_for_macos`. If testing validation layers on an exported
  30. project, you must recompile the export template and specify it as a custom
  31. export template in your project's macOS export preset.
  32. Install the Vulkan SDK `<https://vulkan.lunarg.com/sdk/home>`__, which contains
  33. validation layers as part of its default installation. No need to enable any
  34. optional features in the installer; installing the core Vulkan SDK suffices. You
  35. don't need to reboot after installing the SDK, but you may need to close and
  36. reopen your current terminal.
  37. After installing the Vulkan SDK, run a Godot binary that was compiled with
  38. ``use_volk=yes`` SCons option. Specify the ``--gpu-validation``
  39. :ref:`command line argument <doc_command_line_tutorial>`.
  40. You can also specify ``--gpu-abort`` which will make Godot quit as soon
  41. as a validation error happens. This can prevent your system from freezing
  42. if a validation error occurs.
  43. Linux, \*BSD
  44. ------------
  45. Install Vulkan validation layers from your distribution's repositories:
  46. .. tabs::
  47. .. tab:: Alpine Linux
  48. ::
  49. vulkan-validation-layers
  50. .. tab:: Arch Linux
  51. ::
  52. pacman -S vulkan-validation-layers
  53. .. tab:: Debian/Ubuntu
  54. ::
  55. apt install vulkan-validationlayers
  56. .. tab:: Fedora
  57. ::
  58. dnf install vulkan-validation-layers
  59. .. tab:: FreeBSD
  60. ::
  61. pkg install graphics/vulkan-validation-layers
  62. .. tab:: Gentoo
  63. ::
  64. emerge -an media-libs/vulkan-layers
  65. .. tab:: Mageia
  66. ::
  67. urpmi vulkan-validation-layers
  68. .. tab:: OpenBSD
  69. ::
  70. pkg_add graphics/vulkan-validation-layers
  71. .. tab:: openSUSE
  72. ::
  73. zypper install vulkan-validationlayers
  74. .. tab:: Solus
  75. ::
  76. eopkg install -c vulkan-validation-layers
  77. You don't need to reboot after installing the validation layers, but you may
  78. need to close and reopen your current terminal.
  79. After installing the package, run Godot with the ``--gpu-validation``
  80. :ref:`command line argument <doc_command_line_tutorial>`. You can also specify
  81. ``--gpu-abort`` which will make Godot quit as soon as a validation error happens.
  82. This can prevent your system from freezing if a validation error occurs.
  83. .. _doc_vulkan_validation_layers_android:
  84. Android
  85. -------
  86. After enabling validation layers on Android, a developer can see errors and
  87. warning messages in the ``adb logcat`` output.
  88. iOS
  89. ---
  90. Validation layers are currently **not** supported on iOS.
  91. Web
  92. ---
  93. Validation layers are **not** supported on the web platform, as there is no support
  94. for Vulkan there.
  95. Enabling validation layers
  96. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  97. Build validation layers from official sources
  98. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  99. To build Android libraries, follow the instructions on
  100. `Khronos' repository <https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/BUILD.md#building-on-android>`__.
  101. After a successful build, the libraries will be located in ``Vulkan-ValidationLayers/build-android/libs``.
  102. Copy libraries
  103. ^^^^^^^^^^^^^^
  104. Copy libraries from ``Vulkan-ValidationLayers/build-android/libs`` to
  105. ``godot/platform/android/java/app/libs/debug/vulkan_validation_layers``.
  106. Your Godot source directory tree should look like on the example below::
  107. godot
  108. |-- platform
  109. |-- android
  110. |-- java
  111. |-- app
  112. |-- libs
  113. |-- debug
  114. |-- vulkan_validation_layers
  115. |-- arm64-v8a
  116. |-- armeabi-v7a
  117. |-- x86
  118. |-- x86_64
  119. If the subdirectory ``libs/debug/vulkan_validation_layers`` doesn't exist, create it.
  120. Compile and run the Android app
  121. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  122. Linked validation layers are automatically loaded and enabled in Android debug builds.
  123. You can use Godot's :ref:`doc_one-click_deploy` feature to quickly test your project with the validation layers enabled.