Skip to content

Commit

Permalink
Removed the previous now redundant Block decorating for runtime arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoDulka committed Aug 31, 2023
1 parent 58aa529 commit 6b5c5ab
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 28 deletions.
21 changes: 3 additions & 18 deletions src/back/spv/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1664,25 +1664,10 @@ impl Writer {
.to_words(&mut self.logical_layout.declarations);

pointer_type_id
} else if substitute_inner_type_lookup.is_some() {
inner_type_id
} else {
// This is a global variable in the Storage address space. The only
// way it could have `global_needs_wrapper() == false` is if it has
// a runtime-sized array. In this case, we need to decorate it with
// Block.
if let crate::AddressSpace::Storage { .. } = global_variable.space {
let decorated_id = match ir_module.types[global_variable.ty].inner {
crate::TypeInner::BindingArray { base, .. } => {
self.get_type_id(LookupType::Handle(base))
}
_ => inner_type_id,
};
self.decorate(decorated_id, Decoration::Block, &[]);
}
if substitute_inner_type_lookup.is_some() {
inner_type_id
} else {
self.get_pointer_id(&ir_module.types, global_variable.ty, class)?
}
self.get_pointer_id(&ir_module.types, global_variable.ty, class)?
};

let init_word = match (global_variable.space, self.zero_initialize_workgroup_memory) {
Expand Down
1 change: 0 additions & 1 deletion tests/out/spv/access.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ OpDecorate %33 ArrayStride 4
OpDecorate %36 ArrayStride 16
OpDecorate %47 DescriptorSet 0
OpDecorate %47 Binding 0
OpDecorate %20 Block
OpDecorate %49 DescriptorSet 0
OpDecorate %49 Binding 1
OpDecorate %50 Block
Expand Down
1 change: 0 additions & 1 deletion tests/out/spv/binding-buffer-arrays.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ OpMemberDecorate %8 0 Offset 0
OpDecorate %11 NonWritable
OpDecorate %11 DescriptorSet 0
OpDecorate %11 Binding 0
OpDecorate %5 Block
OpDecorate %15 DescriptorSet 0
OpDecorate %15 Binding 10
OpDecorate %16 Block
Expand Down
2 changes: 0 additions & 2 deletions tests/out/spv/boids.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ OpMemberDecorate %14 0 Offset 0
OpDecorate %16 NonWritable
OpDecorate %16 DescriptorSet 0
OpDecorate %16 Binding 1
OpDecorate %9 Block
OpDecorate %18 DescriptorSet 0
OpDecorate %18 Binding 2
OpDecorate %9 Block
OpDecorate %36 BuiltIn GlobalInvocationId
%2 = OpTypeVoid
%3 = OpTypeInt 32 0
Expand Down
1 change: 0 additions & 1 deletion tests/out/spv/bounds-check-restrict.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ OpMemberDecorate %10 3 Offset 112
OpDecorate %10 Block
OpDecorate %13 DescriptorSet 0
OpDecorate %13 Binding 0
OpDecorate %10 Block
%2 = OpTypeVoid
%3 = OpTypeFloat 32
%6 = OpTypeInt 32 0
Expand Down
1 change: 0 additions & 1 deletion tests/out/spv/bounds-check-zero.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ OpMemberDecorate %10 3 Offset 112
OpDecorate %10 Block
OpDecorate %13 DescriptorSet 0
OpDecorate %13 Binding 0
OpDecorate %10 Block
%2 = OpTypeVoid
%3 = OpTypeFloat 32
%6 = OpTypeInt 32 0
Expand Down
1 change: 0 additions & 1 deletion tests/out/spv/collatz.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ OpMemberDecorate %5 0 Offset 0
OpDecorate %5 Block
OpDecorate %7 DescriptorSet 0
OpDecorate %7 Binding 0
OpDecorate %5 Block
OpDecorate %48 BuiltIn GlobalInvocationId
%2 = OpTypeVoid
%3 = OpTypeInt 32 0
Expand Down
2 changes: 0 additions & 2 deletions tests/out/spv/debug-symbol-terrain.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,8 @@ OpDecorate %30 Block
OpMemberDecorate %30 0 Offset 0
OpDecorate %32 DescriptorSet 0
OpDecorate %32 Binding 1
OpDecorate %16 Block
OpDecorate %34 DescriptorSet 0
OpDecorate %34 Binding 2
OpDecorate %18 Block
OpDecorate %36 DescriptorSet 0
OpDecorate %36 Binding 0
OpDecorate %37 Block
Expand Down
1 change: 0 additions & 1 deletion tests/out/spv/pointers.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ OpMemberDecorate %7 0 Offset 0
OpDecorate %7 Block
OpDecorate %10 DescriptorSet 0
OpDecorate %10 Binding 0
OpDecorate %7 Block
%2 = OpTypeVoid
%4 = OpTypeInt 32 1
%3 = OpTypeVector %4 2
Expand Down

0 comments on commit 6b5c5ab

Please sign in to comment.