-
Notifications
You must be signed in to change notification settings - Fork 7
Shader Development
Carsten Rudolph edited this page Feb 6, 2024
·
8 revisions
This page guides you on how to write portable shader code, that can be shared between the Vulkan and DirectX 12 APIs.
- Do write your shaders in HLSL, except if you only ever want to target Vulkan.
- Do prefer compiling your HLSL shaders using DXC over glslc.
- Do define each descriptor set in a separate space.
- Do define all samplers in a separate descriptor set.
- Don't use combined image samplers.
-
Do use the
SPIRV
/DXIL
macros defined by the intergrated shader targets to write API-specific code. - Do keep in mind the different definitions for push constants and input attachments between Vulkan and DirectX.
- Do define root signatures explicitly when you want to use shader reflection.
- Don't use static/immutable samplers for anything else than DirectX input attachments when using shader reflection.
The contents of this Wiki, including text, images and other resources are licensed under a Creative Commons Attribution 4.0 International License.