Skip to content

Commit e3c7d05

Browse files
committed
rspirv2 dis: switch dis present to default
1 parent 028ada4 commit e3c7d05

91 files changed

Lines changed: 2744 additions & 2737 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,10 +752,17 @@ impl CodegenArgs {
752752
use rspirv2::core::inst_set::CoreInstSet;
753753
use rspirv2::dis::DisOptions;
754754
use rspirv2::module::Module;
755+
use rspirv2::operand::LiteralStringEscape;
755756

756757
let words = insts.assemble();
757758
match Module::<CoreInstSet>::from_words_maybe_header(bytemuck::cast_slice(&words)) {
758-
Ok(module) => module.dis(DisOptions::like_rspirv()).to_string(),
759+
Ok(module) => module
760+
.dis(DisOptions {
761+
color: false,
762+
literal_string_escape: LiteralStringEscape::EscapeNewlines,
763+
..DisOptions::default()
764+
})
765+
.to_string(),
759766
Err(err) => format!("rspirv2 parsing failed: {err}"),
760767
}
761768
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
%1 = OpFunction %2 None %3
2-
%4 = OpLabel
3-
OpLine %5 82 13
4-
OpMemoryBarrier %6 %7
5-
OpNoLine
6-
OpReturn
7-
OpFunctionEnd
1+
%1 = OpFunction %2 None %3
2+
%4 = OpLabel
3+
OpLine %5 82 13
4+
OpMemoryBarrier %6 %7
5+
OpNoLine
6+
OpReturn
7+
OpFunctionEnd
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
%1 = OpFunction %2 None %3
2-
%4 = OpLabel
3-
OpLine %5 47 13
4-
OpControlBarrier %6 %7 %8
5-
OpNoLine
6-
OpReturn
7-
OpFunctionEnd
1+
%1 = OpFunction %2 None %3
2+
%4 = OpLabel
3+
OpLine %5 47 13
4+
OpControlBarrier %6 %7 %8
5+
OpNoLine
6+
OpReturn
7+
OpFunctionEnd
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
%1 = OpFunction %2 None %3
2-
%4 = OpLabel
3-
OpLine %5 37 8
4-
%6 = OpDPdx %7 %8
5-
OpLine %5 79 8
6-
%9 = OpDPdy %7 %8
7-
OpLine %5 119 8
8-
%10 = OpFwidth %7 %8
9-
OpNoLine
10-
OpReturn
11-
OpFunctionEnd
1+
%1 = OpFunction %2 None %3
2+
%4 = OpLabel
3+
OpLine %5 37 8
4+
%6 = OpDPdx %7 %8
5+
OpLine %5 79 8
6+
%9 = OpDPdy %7 %8
7+
OpLine %5 119 8
8+
%10 = OpFwidth %7 %8
9+
OpNoLine
10+
OpReturn
11+
OpFunctionEnd
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
%1 = OpFunction %2 None %3
2-
%4 = OpLabel
3-
OpLine %5 50 8
4-
%6 = OpDPdxFine %7 %8
5-
OpLine %5 92 8
6-
%9 = OpDPdyFine %7 %8
7-
OpLine %5 131 8
8-
%10 = OpFwidthFine %7 %8
9-
OpLine %5 65 8
10-
%11 = OpDPdxCoarse %7 %8
11-
OpLine %5 107 8
12-
%12 = OpDPdyCoarse %7 %8
13-
OpLine %5 143 8
14-
%13 = OpFwidthCoarse %7 %8
15-
OpNoLine
16-
OpReturn
17-
OpFunctionEnd
1+
%1 = OpFunction %2 None %3
2+
%4 = OpLabel
3+
OpLine %5 50 8
4+
%6 = OpDPdxFine %7 %8
5+
OpLine %5 92 8
6+
%9 = OpDPdyFine %7 %8
7+
OpLine %5 131 8
8+
%10 = OpFwidthFine %7 %8
9+
OpLine %5 65 8
10+
%11 = OpDPdxCoarse %7 %8
11+
OpLine %5 107 8
12+
%12 = OpDPdyCoarse %7 %8
13+
OpLine %5 143 8
14+
%13 = OpFwidthCoarse %7 %8
15+
OpNoLine
16+
OpReturn
17+
OpFunctionEnd
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
%1 = OpFunction %2 None %3
2-
%4 = OpLabel
3-
OpLine %5 82 13
4-
OpMemoryBarrier %6 %7
5-
OpNoLine
6-
OpReturn
7-
OpFunctionEnd
1+
%1 = OpFunction %2 None %3
2+
%4 = OpLabel
3+
OpLine %5 82 13
4+
OpMemoryBarrier %6 %7
5+
OpNoLine
6+
OpReturn
7+
OpFunctionEnd
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
%1 = OpFunction %2 None %3
2-
%4 = OpLabel
3-
OpLine %5 47 13
4-
OpControlBarrier %6 %7 %8
5-
OpNoLine
6-
OpReturn
7-
OpFunctionEnd
1+
%1 = OpFunction %2 None %3
2+
%4 = OpLabel
3+
OpLine %5 47 13
4+
OpControlBarrier %6 %7 %8
5+
OpNoLine
6+
OpReturn
7+
OpFunctionEnd
Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
OpCapability Shader
2-
OpCapability StorageBufferArrayDynamicIndexing
3-
OpCapability ShaderNonUniform
4-
OpCapability RuntimeDescriptorArray
5-
OpCapability StorageBufferArrayNonUniformIndexing
6-
OpMemoryModel Logical Simple
7-
OpEntryPoint Vertex %1 "main" %2 %3 %4
8-
OpName %2 "index"
9-
OpName %3 "buffers"
10-
OpName %4 "out"
11-
OpDecorate %8 Block
12-
OpMemberDecorate %8 0 Offset 0
13-
OpDecorate %2 Location 0
14-
OpDecorate %3 NonWritable
15-
OpDecorate %3 Binding 0
16-
OpDecorate %3 DescriptorSet 0
17-
OpDecorate %4 Location 0
18-
OpDecorate %9 NonUniform
19-
%10 = OpTypeInt 32 0
20-
%11 = OpTypePointer Input %10
21-
%12 = OpTypeFloat 32
22-
%13 = OpTypeVector %12 4
23-
%8 = OpTypeStruct %13
24-
%14 = OpTypeRuntimeArray %8
25-
%15 = OpTypePointer StorageBuffer %14
26-
%16 = OpTypePointer Output %13
27-
%17 = OpTypeVoid
28-
%18 = OpTypeFunction %17
29-
%2 = OpVariable %11 Input
30-
%19 = OpTypePointer StorageBuffer %8
31-
%3 = OpVariable %15 StorageBuffer
32-
%20 = OpTypePointer StorageBuffer %13
33-
%21 = OpConstant %10 0
34-
%4 = OpVariable %16 Output
35-
%1 = OpFunction %17 None %18
36-
%22 = OpLabel
37-
%23 = OpLoad %10 %2
38-
%9 = OpAccessChain %19 %3 %23
39-
%24 = OpAccessChain %20 %9 %21
40-
%25 = OpLoad %13 %24
41-
OpStore %4 %25
42-
OpNoLine
43-
OpReturn
44-
OpFunctionEnd
1+
OpCapability Shader
2+
OpCapability StorageBufferArrayDynamicIndexing
3+
OpCapability ShaderNonUniform
4+
OpCapability RuntimeDescriptorArray
5+
OpCapability StorageBufferArrayNonUniformIndexing
6+
OpMemoryModel Logical Simple
7+
OpEntryPoint Vertex %1 "main" %index %buffers %out
8+
OpName %index "index"
9+
OpName %buffers "buffers"
10+
OpName %out "out"
11+
OpDecorate %_struct_8 Block
12+
OpMemberDecorate %_struct_8 0 Offset 0
13+
OpDecorate %index Location 0
14+
OpDecorate %buffers NonWritable
15+
OpDecorate %buffers Binding 0
16+
OpDecorate %buffers DescriptorSet 0
17+
OpDecorate %out Location 0
18+
OpDecorate %9 NonUniform
19+
%u32 = OpTypeInt 32 0
20+
%_ptr_Input_u32 = OpTypePointer Input %u32
21+
%f32 = OpTypeFloat 32
22+
%v4f32 = OpTypeVector %f32 4
23+
%_struct_8 = OpTypeStruct %v4f32
24+
%_runtimearr__struct_8 = OpTypeRuntimeArray %_struct_8
25+
%_ptr_StorageBuffer__runtimearr__struct_8 = OpTypePointer StorageBuffer %_runtimearr__struct_8
26+
%_ptr_Output_v4f32 = OpTypePointer Output %v4f32
27+
%void = OpTypeVoid
28+
%18 = OpTypeFunction %void
29+
%index = OpVariable %_ptr_Input_u32 Input
30+
%_ptr_StorageBuffer__struct_8 = OpTypePointer StorageBuffer %_struct_8
31+
%buffers = OpVariable %_ptr_StorageBuffer__runtimearr__struct_8 StorageBuffer
32+
%_ptr_StorageBuffer_v4f32 = OpTypePointer StorageBuffer %v4f32
33+
%u32_0 = OpConstant %u32 0
34+
%out = OpVariable %_ptr_Output_v4f32 Output
35+
%1 = OpFunction %void None %18
36+
%22 = OpLabel
37+
%23 = OpLoad %u32 %index
38+
%9 = OpAccessChain %_ptr_StorageBuffer__struct_8 %buffers %23
39+
%24 = OpAccessChain %_ptr_StorageBuffer_v4f32 %9 %u32_0
40+
%25 = OpLoad %v4f32 %24
41+
OpStore %out %25
42+
OpNoLine
43+
OpReturn
44+
OpFunctionEnd
Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
OpCapability Shader
2-
OpCapability StorageBufferArrayDynamicIndexing
3-
OpCapability RuntimeDescriptorArray
4-
OpMemoryModel Logical Simple
5-
OpEntryPoint Vertex %1 "main" %2 %3 %4
6-
OpName %2 "index"
7-
OpName %3 "buffers"
8-
OpName %4 "out"
9-
OpDecorate %8 Block
10-
OpMemberDecorate %8 0 Offset 0
11-
OpDecorate %2 Location 0
12-
OpDecorate %3 NonWritable
13-
OpDecorate %3 Binding 0
14-
OpDecorate %3 DescriptorSet 0
15-
OpDecorate %4 Location 0
16-
%9 = OpTypeInt 32 0
17-
%10 = OpTypePointer Input %9
18-
%11 = OpTypeFloat 32
19-
%12 = OpTypeVector %11 4
20-
%8 = OpTypeStruct %12
21-
%13 = OpTypeRuntimeArray %8
22-
%14 = OpTypePointer StorageBuffer %13
23-
%15 = OpTypePointer Output %12
24-
%16 = OpTypeVoid
25-
%17 = OpTypeFunction %16
26-
%2 = OpVariable %10 Input
27-
%18 = OpTypePointer StorageBuffer %8
28-
%3 = OpVariable %14 StorageBuffer
29-
%19 = OpTypePointer StorageBuffer %12
30-
%20 = OpConstant %9 0
31-
%4 = OpVariable %15 Output
32-
%1 = OpFunction %16 None %17
33-
%21 = OpLabel
34-
%22 = OpLoad %9 %2
35-
%23 = OpAccessChain %18 %3 %22
36-
%24 = OpAccessChain %19 %23 %20
37-
%25 = OpLoad %12 %24
38-
OpStore %4 %25
39-
OpNoLine
40-
OpReturn
41-
OpFunctionEnd
1+
OpCapability Shader
2+
OpCapability StorageBufferArrayDynamicIndexing
3+
OpCapability RuntimeDescriptorArray
4+
OpMemoryModel Logical Simple
5+
OpEntryPoint Vertex %1 "main" %index %buffers %out
6+
OpName %index "index"
7+
OpName %buffers "buffers"
8+
OpName %out "out"
9+
OpDecorate %_struct_8 Block
10+
OpMemberDecorate %_struct_8 0 Offset 0
11+
OpDecorate %index Location 0
12+
OpDecorate %buffers NonWritable
13+
OpDecorate %buffers Binding 0
14+
OpDecorate %buffers DescriptorSet 0
15+
OpDecorate %out Location 0
16+
%u32 = OpTypeInt 32 0
17+
%_ptr_Input_u32 = OpTypePointer Input %u32
18+
%f32 = OpTypeFloat 32
19+
%v4f32 = OpTypeVector %f32 4
20+
%_struct_8 = OpTypeStruct %v4f32
21+
%_runtimearr__struct_8 = OpTypeRuntimeArray %_struct_8
22+
%_ptr_StorageBuffer__runtimearr__struct_8 = OpTypePointer StorageBuffer %_runtimearr__struct_8
23+
%_ptr_Output_v4f32 = OpTypePointer Output %v4f32
24+
%void = OpTypeVoid
25+
%17 = OpTypeFunction %void
26+
%index = OpVariable %_ptr_Input_u32 Input
27+
%_ptr_StorageBuffer__struct_8 = OpTypePointer StorageBuffer %_struct_8
28+
%buffers = OpVariable %_ptr_StorageBuffer__runtimearr__struct_8 StorageBuffer
29+
%_ptr_StorageBuffer_v4f32 = OpTypePointer StorageBuffer %v4f32
30+
%u32_0 = OpConstant %u32 0
31+
%out = OpVariable %_ptr_Output_v4f32 Output
32+
%1 = OpFunction %void None %17
33+
%21 = OpLabel
34+
%22 = OpLoad %u32 %index
35+
%23 = OpAccessChain %_ptr_StorageBuffer__struct_8 %buffers %22
36+
%24 = OpAccessChain %_ptr_StorageBuffer_v4f32 %23 %u32_0
37+
%25 = OpLoad %v4f32 %24
38+
OpStore %out %25
39+
OpNoLine
40+
OpReturn
41+
OpFunctionEnd

0 commit comments

Comments
 (0)