Vulkan-Samples icon indicating copy to clipboard operation
Vulkan-Samples copied to clipboard

Add a new sample for VK_EXT_device_fault

Open melihmete opened this issue 1 month ago • 5 comments

Description

When developing Vulkan applications, understanding and handling GPU errors is crucial. Currently, traditional graphics debugging methods do not give detailed information about GPU faults. The VK_EXT_device_fault extension provides detailed information when ERROR_DEVICE_LOST occur, while the VK_EXT_device_address_binding_report extension helps monitor GPU memory usage by reporting allocated and bound/unbound addresses in Vulkan application.

General Checklist:

Please ensure the following points are checked:

  • [x] My code follows the coding style
  • [x] I have reviewed file licenses
  • [x] I have commented any added functions (in line with Doxygen)
  • [x] I have commented any code that could be hard to understand
  • [x] My changes do not add any new compiler warnings
  • [x] My changes do not add any new validation layer errors or warnings
  • [x] I have used existing framework/helper functions where possible
  • [x] My changes do not add any regressions
  • [x] I have tested every sample to ensure everything runs correctly
  • [x] This PR describes the scope and expected impact of the changes I am making

Note: The Samples CI runs a number of checks including:

  • [x] I have updated the header Copyright to reflect the current year (CI build will fail if Copyright is out of date)
  • [x] My changes build on Windows, Linux, macOS and Android. Otherwise I have documented any exceptions

If this PR contains framework changes:

  • [n/a] I did a full batch run using the batch command line argument to make sure all samples still work properly

Sample Checklist

If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist:

  • [x] I have tested the sample on at least one compliant Vulkan implementation
  • [n/a] If the sample is vendor-specific, I have tagged it appropriately
  • [n/a] I have stated on what implementation the sample has been tested so that others can test on different implementations and platforms
  • [n/a] Any dependent assets have been merged and published in downstream modules
  • [x] For new samples, I have added a paragraph with a summary to the appropriate chapter in the readme of the folder that the sample belongs to e.g. api samples readme
  • [x] For new samples, I have added a tutorial README.md file to guide users through what they need to know to implement code using this feature. For example, see conditional_rendering
  • [x] For new samples, I have added a link to the Antora navigation so that the sample will be listed at the Vulkan documentation site

melihmete avatar Nov 19 '25 14:11 melihmete

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 19 '25 14:11 CLAassistant

I see a bunch of compilation errors when I try to build this:

samples/extensions/device_fault/device_fault.cpp:595:49: error: macro "REQUEST_REQUIRED_FEATURE" passed 4 arguments, but takes just 3
  595 |                          bufferDeviceAddress);
      |                                                 ^

framework/core/physical_device.h:188: note: macro "REQUEST_REQUIRED_FEATURE" defined here
  188 | #define REQUEST_REQUIRED_FEATURE(gpu, Feature, flag) gpu.request_required_feature<Feature>(&Feature::flag, #Feature, #flag)
      | 

samples/extensions/device_fault/device_fault.cpp:601:41: error: macro "REQUEST_REQUIRED_FEATURE" passed 4 arguments, but takes just 3
  601 |                          deviceFault);
      |                                         ^

samples/extensions/device_fault/device_fault.cpp:607:50: error: macro "REQUEST_OPTIONAL_FEATURE" passed 4 arguments, but takes just 3
  607 |                          reportAddressBinding);
      |                                                  ^

framework/core/physical_device.h:187: note: macro "REQUEST_OPTIONAL_FEATURE" defined here
  187 | #define REQUEST_OPTIONAL_FEATURE(gpu, Feature, flag) gpu.request_optional_feature<Feature>(&Feature::flag, #Feature, #flag)
      | 

samples/extensions/device_fault/device_fault.h:31:18: error: 'virtual void DeviceFault::request_gpu_features(vkb::PhysicalDevice&)' marked 'override', but does not override
   31 |     virtual void request_gpu_features(vkb::PhysicalDevice &gpu) override;
      |                  ^~~~~~~~~~~~~~~~~~~~

samples/extensions/device_fault/device_fault.cpp:592:5: error: 'REQUEST_REQUIRED_FEATURE' was not declared in this scope
  592 |     REQUEST_REQUIRED_FEATURE(gpu,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~

samples/extensions/device_fault/device_fault.cpp:604:5: error: 'REQUEST_OPTIONAL_FEATURE' was not declared in this scope
  604 |     REQUEST_OPTIONAL_FEATURE(gpu,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~

samples/extensions/device_fault/device_fault.cpp:610:22: error: invalid use of incomplete type 'class vkb::PhysicalDevice'
  610 |     auto &features = gpu.get_mutable_requested_features();
      |                      ^~~

framework/core/device.h:36:7: note: forward declaration of 'class vkb::PhysicalDevice'
   36 | class PhysicalDevice;
      |       ^~~~~~~~~~~~~~
     

gary-sweet avatar Nov 20 '25 12:11 gary-sweet

@gary-sweet All fixed and pushed the changes.

melihmete avatar Nov 20 '25 13:11 melihmete

Can you move the shaders to a subdirectory called "glsl"? We support different shading languages and the goal is for all samples to have shaders in different shading languages (glsl, slang and/or hlsl).

SaschaWillems avatar Nov 20 '25 20:11 SaschaWillems

This does build ok for me now, and correctly reports as not-supported. I can't say any more than that though.

gary-sweet avatar Dec 01 '25 10:12 gary-sweet

@SaschaWillems Hello, I've just received errors regarding Quality Checks / Copyright Headers Check in the files I haven't modified. Should I fix them or is it related to CI needs a fixing?

melihmete avatar Dec 15 '25 13:12 melihmete

As per yesterdays call we'll ignore the CI failure caused by files you didn't touch. We'll try to make that CI step more robust/less error prone.

SaschaWillems avatar Dec 16 '25 17:12 SaschaWillems