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

Add compute shader derivatives sample for Vulkan extension

Open gpx1000 opened this issue 2 months ago • 3 comments

Description

Introduce a sample demonstrating the VK_KHR_compute_shader_derivatives extension. Includes new shader, CMake, and Vulkan application files showcasing the use of derivative instructions in compute shaders with quad-based derivative groups.

General Checklist:

Please ensure the following points are checked:

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

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

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

If this PR contains framework changes:

  • [ ] 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:

  • [ ] I have tested the sample on at least one compliant Vulkan implementation
  • [ ] If the sample is vendor-specific, I have tagged it appropriately
  • [ ] I have stated on what implementation the sample has been tested so that others can test on different implementations and platforms
  • [ ] Any dependent assets have been merged and published in downstream modules
  • [ ] 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
  • [ ] 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
  • [ ] For new samples, I have added a link to the Antora navigation so that the sample will be listed at the Vulkan documentation site

gpx1000 avatar Oct 17 '25 01:10 gpx1000

Again, not sure what I'm supposed to see here, but I'm getting the same weird random frames on the display as I saw with relaxed_extended_instruction and some console output:

[info] compute-derivatives CPU: tid=(0,0) v=0.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(1,0) v=1.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(2,0) v=2.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(3,0) v=3.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(0,1) v=4.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(1,1) v=5.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(2,1) v=6.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(3,1) v=7.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(0,2) v=8.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(1,2) v=9.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(2,2) v=10.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(3,2) v=11.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(0,3) v=12.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(1,3) v=13.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(2,3) v=14.000000 ddx=1.000000 ddy=4.000000
[info] compute-derivatives CPU: tid=(3,3) v=15.000000 ddx=1.000000 ddy=4.000000

gary-sweet avatar Oct 20 '25 10:10 gary-sweet

Do we have something like a template with a framework-based hello_triangle, or so, that could be used as the base to generate a new sample?

Yes, we do. The default templates that are used when you create a new sample via our scripts include rendering the UI. That's what new samples should use, as the also include other boilerplate like documentation.

SaschaWillems avatar Oct 29 '25 19:10 SaschaWillems

The default templates that are used when you create a new sample via our scripts include rendering the UI.

@gpx1000 Maybe it's worth to recreate these very minimalistic samples (#1418, #1419, #1420, #1421) on that template?

asuessenbach avatar Oct 30 '25 11:10 asuessenbach