Skip to content

Conversation

@SaschaWillems
Copy link
Collaborator

@SaschaWillems SaschaWillems commented Aug 30, 2025

Description

Important note: If you compile shaders locally, you have to use a very recent version of the slang compiler. The one shipped with the SDK is outdated and broken. Make sure to grab the latest one from https://github.com/shader-slang/slang/releases

This adds Slang shaders to additional samples:

  1. buffer device address
  2. calibrated timestamps
  3. color write enable
  4. compute nbody
  5. compute nbody (hpp)
  6. conservative rasterization
  7. conditional rendering
  8. debug utils
  9. descriptor buffer basic
  10. descriptor indexing
  11. dynamic blending
  12. dynamic line rasterization
  13. dynamic multisample rasterization
  14. dynamic primitive clipping
  15. dynamic uniform buffers
  16. dynamic uniform buffers (hpp)
  17. extended dynamic state2
  18. fragment shader barycentric
  19. fragment shading rate
  20. graphics pipeline library
  21. gshader to mshader
  22. hdr
  23. hdr (hpp)
  24. host image copy
  25. instancing
  26. instancing (hpp)
  27. logic op dynamic state
  28. memory budget
  29. mesh shading
  30. mesh shading (hpp)
  31. open cl interop
  32. open gl interop
  33. patch control points
  34. push descriptors
  35. push descriptors (hpp)
  36. portability
  37. ray queries
  38. ray tracing basics
  39. ray tracing extended
  40. ray tracing position fetch
  41. separte image sampler
  42. separte image sampler (hpp)
  43. shader debug printf
  44. sparse image
  45. synchronization 2
  46. terrain tessellation
  47. terrain tessellation (hpp)
  48. texture compression basisu
  49. texture loading
  50. texture loading (hpp)
  51. texture mipmap generation
  52. texture mipmap generation (hpp)
  53. timeline semaphores
  54. timestamp queries
  55. timestamp queries (hpp)
  56. vertex dynamic state

Also enables SPIR-V 1.4 at framework level when using Slang.

Additional notes:

  • Adds a new option VKB_SKIP_SLANG_SHADER_COMPILATION to skip compilation of Slang shaders (you can still use Slang shaders via the precompiled SPIR-V files)
  • Disables Slang offline compilation in CI for MacOS/iOS due to broken Slang compiler in SDK (this step is unnecessary anyway)
  • Some samples may look slightly different than their GLSL counterparts, that's not (easily) fixable

Refs #1385

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

This is needed to get proper support for SPIR-V compiled from Slang shaders
- instancing
- conditional rendering
- conservative rasterization
- dynamic uniform buffers
- descriptor buffer basic
- fragment shading rate
- hdr (+hpp)
- graphics pipeline library
- mesh shading (+hpp)
- texture loading (+hpp)
- push descriptors (+hpp
- open cl interop
- separte image sampler (+hpp)
- texture mipmap generation (+hpp)
- shader debug printf
- texture compression basisu
- compute nbody (+hpp)
- dynamic primitive clipping
- logic op dynamic state
- sparse image
- color write enable
- debug utils
- dynamic line rasterization
- ray queries
- ray tracing basics
- ray tracing extended
- ray tracing position fetch
- terrain tessellation
- patch control points
- synchronization 2
- vertex dynamic state
@SRSaunders
Copy link
Contributor

It looks like two issues are occurring here with Apple CI:

  1. PR Update Apple min deployment versions and iOS Simulator build config #1405 will fix CI issues with macOS (and iOS) when using runners with the latest Sequoia SDKs, as is here.
  2. The iOS CI is also failing because it has access to slang from the Vulkan SDK, and generates an error when compiling the sparse image shader (note: sparse images are not yet supported on Apple):

/Users/runner/work/Vulkan-Samples/Vulkan-Samples/shaders/sparse_image/slang/sparse.frag.slang(45): error 36107: entrypoint 'main' does not support compilation target 'spirv' with stage 'fragment'
float4 main(VSOutput input)
^~~~
/Users/runner/work/Vulkan-Samples/Vulkan-Samples/shaders/sparse_image/slang/sparse.frag.slang(56): note: see using of 'CheckAccessFullyMapped'
} while (!CheckAccessFullyMapped(residencyCode));
** BUILD FAILED **
^~~~~~~~~~~~~~~~~~~~~~

Also note that macOS CI does not access the VulkanSDK and will not try to compile any slang shaders, but would likely fail on the same sparse image shader if it did.

@SaschaWillems
Copy link
Collaborator Author

It's a draft for a reason.

@SRSaunders
Copy link
Contributor

SRSaunders commented Sep 1, 2025

Understood - just trying to help out re issue #1405 since this has nothing to do with your PR, only the Apple CI.

@SaschaWillems
Copy link
Collaborator Author

SaschaWillems commented Sep 1, 2025

You're welcome. We discussed that on one of our calls, and having each CI step rebuild the SPIR-V files that are already part of the repo doesn't make sense anyway. Esp. as the SDK tends to include broken/outdated compilers.

@SRSaunders
Copy link
Contributor

SRSaunders commented Sep 1, 2025

having each CI step rebuild the SPIR-V files that are already part of the repo doesn't make sense anyway

I agree.

However, the scope of the problem may be limited to iOS. At this point iOS seems to be the only CI target that requires and accesses the Vulkan SDK for static linkage to the MoltenVK framework. I believe all other CI targets depend on Vulkan-Headers only without need for the SDK (or compilers), assuming dynamic linkage to the Vulkan runtime library.

@SaschaWillems
Copy link
Collaborator Author

Should put that in a separate issue.

I'd like the comments section of this PR related to the actual PR if possible.

- descriptor indexing
- dyamic blending
- time stamp queries (+hpp)
- host image copy
- fragment shader barycentric
- memory budget
- calibrated timestamps
- dynamic multisample rasterization
- open gl interop
- portability
Use point size related built-ins
@SaschaWillems
Copy link
Collaborator Author

I tried to address all of the feedback. I would appreciate if we could merge this on our next call. Minor things can be fixed on separate PRs.

Use getCount for const array size
@SaschaWillems
Copy link
Collaborator Author

Thanks for all the feedback. I hope I've it as far as possible for me. Seeing how this PR is growing (both in size and age), I'd like to have this merged in the current state. Minor things can easily be fixed afterwards.

gary-sweet
gary-sweet previously approved these changes Oct 20, 2025
Copy link
Contributor

@gary-sweet gary-sweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just spotted some differences in the texture_loading shaders between glsl and both hlsl and slang. Those are clearly pre-existing issues and can easily be fixed after this goes in.

gpx1000
gpx1000 previously approved these changes Oct 20, 2025
@SaschaWillems SaschaWillems dismissed stale reviews from gpx1000 and gary-sweet via bc70e9d October 21, 2025 18:24
@SaschaWillems
Copy link
Collaborator Author

I have addressed all open feedback. For those that reviewed it, please (re)approve so we can merge on the next call.

gpx1000
gpx1000 previously approved these changes Oct 21, 2025
Remove attributes not required by Slang
Copy link
Contributor

@asuessenbach asuessenbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments...

@SaschaWillems
Copy link
Collaborator Author

@asuessenbach: Please let me know when you're finished with your review. It's easier for me to go through the remaining issues one last time.

Copy link
Contributor

@asuessenbach asuessenbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright now, those are my final comments on this PR!

@SaschaWillems
Copy link
Collaborator Author

@asuessenbach : Just a quick note that this PR is getting to point where github has issues loading it. Let me know when you're done with your review and I'll try to address all of feedback, but after that we should move remaining things to a separate issue. Looks like the comments are mostly cosmetic (and partially also wrong in GLSL/HLSL). I'd like to finish this PR at some point...

@marty-johnson59 marty-johnson59 merged commit 24bf97e into KhronosGroup:main Nov 17, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants