Skip to content

Commit 88078c3

Browse files
committed
location assignment: compiletest failing with larger than Vec4 structs due to overlapping locations
1 parent e97524f commit 88078c3

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// build-pass
2+
// compile-flags: -C llvm-args=--disassemble
3+
// normalize-stderr-test "OpSource .*\n" -> ""
4+
// normalize-stderr-test "OpLine .*\n" -> ""
5+
// normalize-stderr-test "%\d+ = OpString .*\n" -> ""
6+
// normalize-stderr-test "; .*\n" -> ""
7+
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
8+
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
9+
// ignore-spv1.0
10+
// ignore-spv1.1
11+
// ignore-spv1.2
12+
// ignore-spv1.3
13+
// ignore-vulkan1.0
14+
// ignore-vulkan1.1
15+
16+
use spirv_std::glam::*;
17+
use spirv_std::{Image, spirv};
18+
19+
#[derive(Copy, Clone, Default)]
20+
pub struct LargerThanVec4 {
21+
a: Vec4,
22+
b: Vec2,
23+
}
24+
25+
#[spirv(vertex)]
26+
pub fn main(out1: &mut LargerThanVec4, out2: &mut Vec2, out3: &mut Mat4, out4: &mut f32) {
27+
*out1 = Default::default();
28+
*out2 = Default::default();
29+
*out3 = Default::default();
30+
*out4 = Default::default();
31+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
OpCapability Shader
2+
OpMemoryModel Logical Simple
3+
OpEntryPoint Vertex %1 "main" %2 %3 %4 %5
4+
OpName %7 "LargerThanVec4"
5+
OpMemberName %7 0 "a"
6+
OpMemberName %7 1 "b"
7+
OpName %8 "spirv_std::glam::Mat4"
8+
OpMemberName %8 0 "x_axis"
9+
OpMemberName %8 1 "y_axis"
10+
OpMemberName %8 2 "z_axis"
11+
OpMemberName %8 3 "w_axis"
12+
OpName %9 "LargerThanVec4"
13+
OpMemberName %9 0 "a"
14+
OpMemberName %9 1 "b"
15+
OpName %2 "out1"
16+
OpName %3 "out2"
17+
OpName %4 "out3"
18+
OpName %5 "out4"
19+
OpMemberDecorate %9 0 Offset 0
20+
OpMemberDecorate %9 1 Offset 16
21+
OpDecorate %2 Location 0
22+
OpDecorate %3 Location 1
23+
OpDecorate %4 Location 2
24+
OpDecorate %5 Location 3
25+
%10 = OpTypeFloat 32
26+
%11 = OpTypeVector %10 4
27+
%12 = OpTypeVector %10 2
28+
%7 = OpTypeStruct %11 %12
29+
%13 = OpTypePointer Output %7
30+
%14 = OpTypePointer Output %12
31+
%8 = OpTypeStruct %11 %11 %11 %11
32+
%15 = OpTypePointer Output %8
33+
%16 = OpTypePointer Output %10
34+
%17 = OpTypeVoid
35+
%18 = OpTypeFunction %17
36+
%9 = OpTypeStruct %11 %12
37+
%19 = OpConstant %10 0
38+
%20 = OpConstantComposite %11 %19 %19 %19 %19
39+
%21 = OpUndef %9
40+
%2 = OpVariable %13 Output
41+
%3 = OpVariable %14 Output
42+
%22 = OpTypeInt 32 0
43+
%23 = OpConstant %22 0
44+
%24 = OpConstant %22 1
45+
%4 = OpVariable %15 Output
46+
%25 = OpConstant %10 1
47+
%26 = OpConstantComposite %11 %25 %19 %19 %19
48+
%27 = OpConstantComposite %11 %19 %25 %19 %19
49+
%28 = OpConstantComposite %11 %19 %19 %25 %19
50+
%29 = OpConstantComposite %11 %19 %19 %19 %25
51+
%30 = OpConstantComposite %8 %26 %27 %28 %29
52+
%5 = OpVariable %16 Output
53+
%1 = OpFunction %17 None %18
54+
%31 = OpLabel
55+
%32 = OpCompositeInsert %9 %20 %21 0
56+
%33 = OpCompositeInsert %9 %19 %32 1 0
57+
%34 = OpCompositeInsert %9 %19 %33 1 1
58+
%35 = OpCompositeExtract %11 %34 0
59+
%36 = OpCompositeExtract %12 %34 1
60+
%37 = OpCompositeConstruct %7 %35 %36
61+
OpStore %2 %37
62+
%38 = OpInBoundsAccessChain %16 %3 %23
63+
OpStore %38 %19
64+
%39 = OpInBoundsAccessChain %16 %3 %24
65+
OpStore %39 %19
66+
OpStore %4 %30
67+
OpStore %5 %19
68+
OpNoLine
69+
OpReturn
70+
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)