-
Notifications
You must be signed in to change notification settings - Fork 713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPIR-V] HLSL style register assignment for resource arrays #6932
Closed
manas-kulkarni
wants to merge
12
commits into
microsoft:main
from
manas-kulkarni:fspv_implicit_hlsl_resource_arrays
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8bf6f7c
Option to use hlsl register assignment for resource arrays
manas-kulkarni 729a393
HLSL resource array test
manas-kulkarni e202b95
Update HLSLOptions.cpp
manas-kulkarni 94dd3ec
Update vk.binding.cl.hlsl-arrays.example1.hlsl
manas-kulkarni cbfa71e
Clang format
manas-kulkarni cb471fe
Update vk.binding.cl.hlsl-arrays.example1.hlsl
manas-kulkarni 31f7204
Update vk.binding.cl.hlsl-arrays.example1.hlsl
manas-kulkarni 58e1004
One binding per array element irrespective of whether register was im…
manas-kulkarni 6901f92
Update vk.binding.cl.hlsl-arrays.example1.hlsl
manas-kulkarni 7c43bc7
Update DeclResultIdMapper.cpp
manas-kulkarni d23d8d9
Update HLSLOptions.cpp
manas-kulkarni 252cb6c
Update vk.binding.cl.hlsl-arrays.example1.hlsl
manas-kulkarni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
23 changes: 23 additions & 0 deletions
23
tools/clang/test/CodeGenSPIRV/vk.binding.cl.hlsl-arrays.example1.hlsl
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// RUN: %dxc -T ps_6_0 -E main -fspv-hlsl-resource-arrays -fcgl %s -spirv | FileCheck %s | ||
|
||
// CHECK: OpDecorate %MyTextures Binding 0 | ||
// CHECK: OpDecorate %NextTexture Binding 5 | ||
// CHECK: OpDecorate %AnotherTexture Binding 6 | ||
// CHECK: OpDecorate %MySamplers Binding 7 | ||
Texture2D MyTextures[5]; | ||
Texture2D NextTexture; | ||
Texture2D AnotherTexture; | ||
SamplerState MySamplers[2]; | ||
|
||
float4 main(float2 TexCoord : TexCoord) : SV_Target0 | ||
{ | ||
float4 result = | ||
MyTextures[0].Sample(MySamplers[0], TexCoord) + | ||
MyTextures[1].Sample(MySamplers[0], TexCoord) + | ||
MyTextures[2].Sample(MySamplers[0], TexCoord) + | ||
MyTextures[3].Sample(MySamplers[1], TexCoord) + | ||
MyTextures[4].Sample(MySamplers[1], TexCoord) + | ||
AnotherTexture.Sample(MySamplers[1], TexCoord) + | ||
NextTexture.Sample(MySamplers[1], TexCoord); | ||
return result; | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an accurate description of what is happening. In Vulkan, an array of resources take just a single binding. In the test below,
MyTextures[5]
will still use a single binding. And then binding 1-4 are left unused.Also the name of option is not very descriptive. What is an HLSL resource array? You should reference something in DirectX, you seem to want to try to match DX's binding model in someway. Even that I believe is very difficult because Vulkan's binding model is very different.