Skip to content

Commit 1e3e298

Browse files
committed
location assignment: failing compiletests
1 parent aacd739 commit 1e3e298

File tree

6 files changed

+231
-0
lines changed

6 files changed

+231
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
#[spirv(vertex)]
20+
pub fn main(out1: &mut [f32; 3], out2: &mut f32) {
21+
*out1 = Default::default();
22+
*out2 = Default::default();
23+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
OpCapability Shader
2+
OpMemoryModel Logical Simple
3+
OpEntryPoint Vertex %1 "main" %2 %3
4+
OpName %2 "out1"
5+
OpName %3 "out2"
6+
OpName %6 "<[f32OpDecorate %7 ArrayStride 4
7+
OpDecorate %2 Location 0
8+
OpDecorate %3 Location 1
9+
%8 = OpTypeFloat 32
10+
%9 = OpTypeInt 32 0
11+
%10 = OpConstant %9 3
12+
%11 = OpTypeArray %8 %10
13+
%12 = OpTypePointer Output %11
14+
%13 = OpTypePointer Output %8
15+
%14 = OpTypeVoid
16+
%15 = OpTypeFunction %14
17+
%7 = OpTypeArray %8 %10
18+
%16 = OpTypeFunction %7
19+
%17 = OpConstant %8 0
20+
%2 = OpVariable %12 Output
21+
%3 = OpVariable %13 Output
22+
%1 = OpFunction %14 None %15
23+
%18 = OpLabel
24+
%19 = OpFunctionCall %7 %6
25+
%20 = OpCompositeExtract %8 %19 0
26+
%21 = OpCompositeExtract %8 %19 1
27+
%22 = OpCompositeExtract %8 %19 2
28+
%23 = OpCompositeConstruct %11 %20 %21 %22
29+
OpStore %2 %23
30+
OpStore %3 %17
31+
OpNoLine
32+
OpReturn
33+
OpFunctionEnd
34+
%6 = OpFunction %7 None %16
35+
%24 = OpLabel
36+
%25 = OpCompositeConstruct %7 %17 %17 %17
37+
OpNoLine
38+
OpReturnValue %25
39+
OpFunctionEnd
40+
error: error:0:0 - [VUID-StandaloneSpirv-OpEntryPoint-08722] Entry-point has conflicting output location assignment at location 1, component 0
41+
OpEntryPoint Vertex %1 "main" %out1 %out2
42+
|
43+
= note: spirv-val failed
44+
= note: module `$TEST_BUILD_DIR/spirv-attr/location_assignment_array_f32.vulkan1.2`
45+
46+
error: aborting due to 1 previous error
47+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// build-pass
2+
// compile-flags: -C llvm-args=--scalar-block-layout -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+
#[repr(C)]
20+
#[derive(Copy, Clone, Default)]
21+
pub struct ManyFloats {
22+
a: f32,
23+
b: f32,
24+
c: f32,
25+
}
26+
27+
#[spirv(vertex)]
28+
pub fn main(out1: &mut ManyFloats, out2: &mut f32) {
29+
const {
30+
assert!(size_of::<ManyFloats>() == 12);
31+
}
32+
*out1 = Default::default();
33+
*out2 = Default::default();
34+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
OpCapability Shader
2+
OpMemoryModel Logical Simple
3+
OpEntryPoint Vertex %1 "main" %2 %3
4+
OpName %5 "ManyFloats"
5+
OpMemberName %5 0 "a"
6+
OpMemberName %5 1 "b"
7+
OpMemberName %5 2 "c"
8+
OpName %6 "ManyFloats"
9+
OpMemberName %6 0 "a"
10+
OpMemberName %6 1 "b"
11+
OpMemberName %6 2 "c"
12+
OpName %2 "out1"
13+
OpName %3 "out2"
14+
OpMemberDecorate %6 0 Offset 0
15+
OpMemberDecorate %6 1 Offset 4
16+
OpMemberDecorate %6 2 Offset 8
17+
OpDecorate %2 Location 0
18+
OpDecorate %3 Location 1
19+
%7 = OpTypeFloat 32
20+
%5 = OpTypeStruct %7 %7 %7
21+
%8 = OpTypePointer Output %5
22+
%9 = OpTypePointer Output %7
23+
%10 = OpTypeVoid
24+
%11 = OpTypeFunction %10
25+
%6 = OpTypeStruct %7 %7 %7
26+
%12 = OpConstant %7 0
27+
%2 = OpVariable %8 Output
28+
%3 = OpVariable %9 Output
29+
%1 = OpFunction %10 None %11
30+
%13 = OpLabel
31+
%14 = OpCompositeConstruct %6 %12 %12 %12
32+
%15 = OpCompositeExtract %7 %14 0
33+
%16 = OpCompositeExtract %7 %14 1
34+
%17 = OpCompositeExtract %7 %14 2
35+
%18 = OpCompositeConstruct %5 %15 %16 %17
36+
OpStore %2 %18
37+
OpStore %3 %12
38+
OpNoLine
39+
OpReturn
40+
OpFunctionEnd
41+
error: error:0:0 - [VUID-StandaloneSpirv-OpEntryPoint-08722] Entry-point has conflicting output location assignment at location 1, component 0
42+
OpEntryPoint Vertex %1 "main" %out1 %out2
43+
|
44+
= note: spirv-val failed
45+
= note: module `$TEST_BUILD_DIR/spirv-attr/location_assignment_many_f32_struct.vulkan1.2`
46+
47+
error: aborting due to 1 previous error
48+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
#[repr(C)]
20+
#[derive(Copy, Clone, Default)]
21+
pub struct Vec3AndFloat {
22+
a: Vec3,
23+
b: f32,
24+
}
25+
26+
#[spirv(vertex)]
27+
pub fn main(out1: &mut Vec3AndFloat, out2: &mut f32) {
28+
const {
29+
assert!(size_of::<Vec3AndFloat>() == 16);
30+
}
31+
*out1 = Default::default();
32+
*out2 = Default::default();
33+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
OpCapability Shader
2+
OpMemoryModel Logical Simple
3+
OpEntryPoint Vertex %1 "main" %2 %3
4+
OpName %5 "Vec3AndFloat"
5+
OpMemberName %5 0 "a"
6+
OpMemberName %5 1 "b"
7+
OpName %6 "Vec3AndFloat"
8+
OpMemberName %6 0 "a"
9+
OpMemberName %6 1 "b"
10+
OpName %2 "out1"
11+
OpName %3 "out2"
12+
OpMemberDecorate %6 0 Offset 0
13+
OpMemberDecorate %6 1 Offset 12
14+
OpDecorate %2 Location 0
15+
OpDecorate %3 Location 1
16+
%7 = OpTypeFloat 32
17+
%8 = OpTypeVector %7 3
18+
%5 = OpTypeStruct %8 %7
19+
%9 = OpTypePointer Output %5
20+
%10 = OpTypePointer Output %7
21+
%11 = OpTypeVoid
22+
%12 = OpTypeFunction %11
23+
%6 = OpTypeStruct %8 %7
24+
%13 = OpConstant %7 0
25+
%14 = OpConstantComposite %8 %13 %13 %13
26+
%2 = OpVariable %9 Output
27+
%3 = OpVariable %10 Output
28+
%1 = OpFunction %11 None %12
29+
%15 = OpLabel
30+
%16 = OpCompositeConstruct %6 %14 %13
31+
%17 = OpCompositeExtract %8 %16 0
32+
%18 = OpCompositeExtract %7 %16 1
33+
%19 = OpCompositeConstruct %5 %17 %18
34+
OpStore %2 %19
35+
OpStore %3 %13
36+
OpNoLine
37+
OpReturn
38+
OpFunctionEnd
39+
error: error:0:0 - [VUID-StandaloneSpirv-OpEntryPoint-08722] Entry-point has conflicting output location assignment at location 1, component 0
40+
OpEntryPoint Vertex %1 "main" %out1 %out2
41+
|
42+
= note: spirv-val failed
43+
= note: module `$TEST_BUILD_DIR/spirv-attr/location_assignment_vec3_f32.vulkan1.2`
44+
45+
error: aborting due to 1 previous error
46+

0 commit comments

Comments
 (0)