Require Vulkan 1.1 for wave intrinsics#138
Open
jcaw wants to merge 1 commit into
Open
Conversation
Collaborator
|
This should definitely be optional since SDL GPU only requires Vulkan 1.0 conformance. |
Shader Model 6.0 has support for GPU features such as wave intrinsics, e.g. `WaveGetLaneCount`, `WaveActiveSum` and `WaveGetLaneIndex`. Shadercross currently compiles HLSL shaders under SM 6.0. In order to support cross-compilation of HLSL shaders utilising these features to SPIR-V, spirv-cross requires a minimum of Vulkan 1.1. If this is not set explicitly, it will complain and refuse to compile the shader - this makes wave intrinsics unusable. In order to specify the target environment, we need to pass `-fspv-target-env` as a command line parameter to spirv-cross. This commit passes Vulkan 1.1 as the target environment when compiling to SPIR-V, to support these Shader Model 6.0 features. I have tested this support with b0nes164's implementation of GPU Prefix Sum[1], which utilizes wave intrinsics to increase performance, and with Vulkan 1.1 required, these shaders compile to SPIR-V and execute successfully. [1] https://github.com/b0nes164/GPUPrefixSums/tree/98d93a4e9ed2f3c8353119515bf9be90a2e137ad/GPUPrefixSumsD3D12
71d25b3 to
31e42bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shader Model 6.0 has support for GPU features such as wave intrinsics, e.g.
WaveGetLaneCount,WaveActiveSumandWaveGetLaneIndex. Shadercross currently compiles HLSL shaders for SM 6.0:SDL_shadercross/src/SDL_shadercross.c
Lines 429 to 438 in a3aad1c
In order to support cross-compilation of HLSL shaders utilising these features to SPIR-V, spirv-cross requires a minimum of Vulkan 1.1. If this is not set explicitly, it will complain and refuse to compile the shader - this currently makes wave intrinsics unusable.
In order to specify the target environment, we need to pass
-fspv-target-envas a command line parameter to spirv-cross. This PR passes Vulkan 1.1 as the target environment when compiling to SPIR-V, to support these Shader Model 6.0 features.I have tested this support with b0nes164's implementation of GPU Prefix Sum, which utilizes wave intrinsics, and with Vulkan 1.1 required, these shaders compile to SPIR-V and execute successfully.