Skip to content

Commit cc77930

Browse files
committed
location assignment: fix overlapping locations
1 parent 88078c3 commit cc77930

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

crates/rustc_codegen_spirv/src/codegen_cx/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ impl<'tcx> CodegenCx<'tcx> {
881881
Decoration::Location,
882882
std::iter::once(Operand::LiteralBit32(*location)),
883883
);
884-
*location += 1;
884+
*location += value_layout.size.bytes().div_ceil(16) as u32;
885885
}
886886

887887
match storage_class {

tests/compiletests/ui/spirv-attr/location_assignment.stderr

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ OpName %5 "out4"
1919
OpMemberDecorate %9 0 Offset 0
2020
OpMemberDecorate %9 1 Offset 16
2121
OpDecorate %2 Location 0
22-
OpDecorate %3 Location 1
23-
OpDecorate %4 Location 2
24-
OpDecorate %5 Location 3
22+
OpDecorate %3 Location 2
23+
OpDecorate %4 Location 3
24+
OpDecorate %5 Location 7
2525
%10 = OpTypeFloat 32
2626
%11 = OpTypeVector %10 4
2727
%12 = OpTypeVector %10 2
@@ -68,11 +68,3 @@ OpStore %5 %19
6868
OpNoLine
6969
OpReturn
7070
OpFunctionEnd
71-
error: error:0:0 - [VUID-StandaloneSpirv-OpEntryPoint-08722] Entry-point has conflicting output location assignment at location 1, component 0
72-
OpEntryPoint Vertex %1 "main" %out1 %out2 %out3 %out4
73-
|
74-
= note: spirv-val failed
75-
= note: module `$TEST_BUILD_DIR/spirv-attr/location_assignment.vulkan1.2`
76-
77-
error: aborting due to 1 previous error
78-

0 commit comments

Comments
 (0)