-
Notifications
You must be signed in to change notification settings - Fork 116
remove has_capability() checks
#531
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // build-pass | ||
| // compile-flags: -C llvm-args=--disassemble | ||
| // compile-flags: -C target-feature=+RuntimeDescriptorArray,+StorageBufferArrayDynamicIndexing | ||
| // compile-flags: -C target-feature=+ShaderNonUniform,+StorageBufferArrayNonUniformIndexing | ||
| // normalize-stderr-test "OpSource .*\n" -> "" | ||
| // normalize-stderr-test "OpLine .*\n" -> "" | ||
| // normalize-stderr-test "%\d+ = OpString .*\n" -> "" | ||
| // normalize-stderr-test "; .*\n" -> "" | ||
| // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" | ||
| // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" | ||
| // ignore-spv1.0 | ||
| // ignore-spv1.1 | ||
| // ignore-spv1.2 | ||
| // ignore-spv1.3 | ||
| // ignore-spv1.4 | ||
| // ignore-vulkan1.0 | ||
| // ignore-vulkan1.1 | ||
|
|
||
| use spirv_std::glam::*; | ||
| use spirv_std::image::*; | ||
| use spirv_std::*; | ||
|
|
||
| #[spirv(vertex)] | ||
| pub fn main( | ||
| index: u32, | ||
| #[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buffers: &RuntimeArray< | ||
| TypedBuffer<Vec4>, | ||
| >, | ||
| out: &mut Vec4, | ||
| ) { | ||
| unsafe { | ||
| *out = **buffers.index(index as usize); | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| OpCapability Shader | ||
| OpCapability StorageBufferArrayDynamicIndexing | ||
| OpCapability ShaderNonUniform | ||
| OpCapability RuntimeDescriptorArray | ||
| OpCapability StorageBufferArrayNonUniformIndexing | ||
| OpMemoryModel Logical Simple | ||
| OpEntryPoint Vertex %1 "main" %2 %3 %4 | ||
| OpName %2 "index" | ||
| OpName %3 "buffers" | ||
| OpName %4 "out" | ||
| OpDecorate %8 Block | ||
| OpMemberDecorate %8 0 Offset 0 | ||
| OpDecorate %2 Location 0 | ||
| OpDecorate %3 NonWritable | ||
| OpDecorate %3 Binding 0 | ||
| OpDecorate %3 DescriptorSet 0 | ||
| OpDecorate %4 Location 0 | ||
| OpDecorate %9 NonUniform | ||
| %10 = OpTypeInt 32 0 | ||
| %11 = OpTypePointer Input %10 | ||
| %12 = OpTypeFloat 32 | ||
| %13 = OpTypeVector %12 4 | ||
| %8 = OpTypeStruct %13 | ||
| %14 = OpTypeRuntimeArray %8 | ||
| %15 = OpTypePointer StorageBuffer %14 | ||
| %16 = OpTypePointer Output %13 | ||
| %17 = OpTypeVoid | ||
| %18 = OpTypeFunction %17 | ||
| %2 = OpVariable %11 Input | ||
| %19 = OpTypePointer StorageBuffer %8 | ||
| %3 = OpVariable %15 StorageBuffer | ||
| %20 = OpTypePointer StorageBuffer %13 | ||
| %21 = OpConstant %10 0 | ||
| %4 = OpVariable %16 Output | ||
| %1 = OpFunction %17 None %18 | ||
| %22 = OpLabel | ||
| %23 = OpLoad %10 %2 | ||
| %9 = OpAccessChain %19 %3 %23 | ||
| %24 = OpAccessChain %20 %9 %21 | ||
| %25 = OpLoad %13 %24 | ||
| OpStore %4 %25 | ||
| OpNoLine | ||
| OpReturn | ||
| OpFunctionEnd |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // build-pass | ||
| // compile-flags: -C llvm-args=--disassemble | ||
| // compile-flags: -C target-feature=+RuntimeDescriptorArray,+StorageBufferArrayDynamicIndexing | ||
| // normalize-stderr-test "OpSource .*\n" -> "" | ||
| // normalize-stderr-test "OpLine .*\n" -> "" | ||
| // normalize-stderr-test "%\d+ = OpString .*\n" -> "" | ||
| // normalize-stderr-test "; .*\n" -> "" | ||
| // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" | ||
| // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" | ||
| // ignore-spv1.0 | ||
| // ignore-spv1.1 | ||
| // ignore-spv1.2 | ||
| // ignore-spv1.3 | ||
| // ignore-spv1.4 | ||
| // ignore-vulkan1.0 | ||
| // ignore-vulkan1.1 | ||
|
|
||
| use spirv_std::glam::*; | ||
| use spirv_std::image::*; | ||
| use spirv_std::*; | ||
|
|
||
| #[spirv(vertex)] | ||
| pub fn main( | ||
| index: u32, | ||
| #[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buffers: &RuntimeArray< | ||
| TypedBuffer<Vec4>, | ||
| >, | ||
| out: &mut Vec4, | ||
| ) { | ||
| unsafe { | ||
| *out = **buffers.index(index as usize); | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
tests/compiletests/ui/arch/non_uniform/buffer_uniform.stderr
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| OpCapability Shader | ||
| OpCapability StorageBufferArrayDynamicIndexing | ||
| OpCapability RuntimeDescriptorArray | ||
| OpMemoryModel Logical Simple | ||
| OpEntryPoint Vertex %1 "main" %2 %3 %4 | ||
| OpName %2 "index" | ||
| OpName %3 "buffers" | ||
| OpName %4 "out" | ||
| OpDecorate %8 Block | ||
| OpMemberDecorate %8 0 Offset 0 | ||
| OpDecorate %2 Location 0 | ||
| OpDecorate %3 NonWritable | ||
| OpDecorate %3 Binding 0 | ||
| OpDecorate %3 DescriptorSet 0 | ||
| OpDecorate %4 Location 0 | ||
| %9 = OpTypeInt 32 0 | ||
| %10 = OpTypePointer Input %9 | ||
| %11 = OpTypeFloat 32 | ||
| %12 = OpTypeVector %11 4 | ||
| %8 = OpTypeStruct %12 | ||
| %13 = OpTypeRuntimeArray %8 | ||
| %14 = OpTypePointer StorageBuffer %13 | ||
| %15 = OpTypePointer Output %12 | ||
| %16 = OpTypeVoid | ||
| %17 = OpTypeFunction %16 | ||
| %2 = OpVariable %10 Input | ||
| %18 = OpTypePointer StorageBuffer %8 | ||
| %3 = OpVariable %14 StorageBuffer | ||
| %19 = OpTypePointer StorageBuffer %12 | ||
| %20 = OpConstant %9 0 | ||
| %4 = OpVariable %15 Output | ||
| %1 = OpFunction %16 None %17 | ||
| %21 = OpLabel | ||
| %22 = OpLoad %9 %2 | ||
| %23 = OpAccessChain %18 %3 %22 | ||
| %24 = OpAccessChain %19 %23 %20 | ||
| %25 = OpLoad %12 %24 | ||
| OpStore %4 %25 | ||
| OpNoLine | ||
| OpReturn | ||
| OpFunctionEnd |
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.
Can you add a test using this feature, but not enabling
ShaderNonUniform?It should trigger a validation error from the new SPIR-T-based validation pass, if I'm not mistaken.
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.
Done, works without any issues. I seem to have added tests for everything except ByteAddressableBuffer.
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.
To be clear, I am talking about a test that lacks the
ShaderNonUniformcapability, and therefore results in an error. If it compiles successfully and containsNonUniformdecorations, without the necessary capability, that's a bug IMO.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.
If you look at the tests this PR adds, there's a
ByteAddressableBuffervariant withNonUniformcapability, and aByteAddressableBufferUniformvariant without, all disassembled so you can diff that and see the the uniform variant missing theOpDecoration %x NonUniformThere 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.
But you removed the condition that gates
NonUniformonShaderNonUniform, and the decoration should always be emitted now... is something else removing theNonUniformdecorations?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.
Yea, here a linker pass that removes all NonUniform decorations, which has been added in #177 1.5 years ago. I wanted it so I could write just one image access asm! block with all the needed NonUniform decorations, since you can't conditionally exclude an asm line.