Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 2.2 KB

File metadata and controls

32 lines (26 loc) · 2.2 KB

Tutorial 02 - use validation layers - 1

Demonstrate how to use validation layers prebuilt from [Validation layer repo][1]

Pre-requirement:


  1. Download prebuilt validation layer android-binaries-*.zip from [Khronos repo][1]
  2. unzip to $this-project-root/vvl-libs

Added steps from previous example

  1. Use vulkan wrappers in common/vulkan_wrapper directory.
  2. Add the validation layer into gradle build to pack it into apk.
  3. (Optional but nice to have)Confirm the validation layer "VK_LAYER_KHRONOS_validation" is available with vkEnumerateInstanceLayerProperties().
  4. Enable the validation layer and "VK_EXT_debug_report" when creating instance.
  5. Register debug callback implemented in "VK_EXT_debug_report" with vkCreateDebugReportCallbackEXT(). Note that application could also use "VK_EXT_debug_utils" implemented in the validatio layer.

Verification

Planted error: this sample sets [VkDeviceQueueCreateInfo::pQueuePriorities]2 to nullptr, which will trigger validation layers to notify us from registered callback function vkDebugReportCallbackEX_impl(); putting a breakpoint with Android Studio, observe the breakpoint being triggered.

In logcat, you would see the error message like:

E/Vulkan-Debug-Message:: Validation -- Validation Error: [ VUID-VkDeviceQueueCreateInfo-pQueuePriorities-parameter ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xd6d720c6 | vkCreateDevice: required parameter pCreateInfo->pQueueCreateInfos[0].pQueuePriorities specified as NULL. The Vulkan spec states: pQueuePriorities must be a valid pointer to an array of queueCount float values (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkDeviceQueueCreateInfo-pQueuePriorities-parameter)

Additional References