Skip to content

Commit c526055

Browse files
committed
asm vector: adjust compiletest dis/complex_image_sample_inst, remove non-sense ConstOffset
1 parent eed7cf2 commit c526055

File tree

2 files changed

+11
-27
lines changed

2 files changed

+11
-27
lines changed

tests/compiletests/ui/dis/complex_image_sample_inst.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,16 @@
55
use core::arch::asm;
66
use spirv_std::spirv;
77

8-
fn sample_proj_lod(
9-
coord: glam::Vec4,
10-
ddx: glam::Vec2,
11-
ddy: glam::Vec2,
12-
offset_x: i32,
13-
offset_y: i32,
14-
) -> glam::Vec4 {
8+
fn sample_proj_lod(coord: glam::Vec4, ddx: glam::Vec2, ddy: glam::Vec2) -> glam::Vec4 {
159
unsafe {
1610
let mut result = glam::Vec4::default();
1711
let index = 0u32;
1812
asm!(
1913
"OpDecorate %image_2d_var DescriptorSet 0",
2014
"OpDecorate %image_2d_var Binding 0",
2115
"%uint = OpTypeInt 32 0",
22-
"%int = OpTypeInt 32 1",
2316
"%float = OpTypeFloat 32",
24-
"%v2int = OpTypeVector %int 2",
2517
"%uint_0 = OpConstant %uint 0",
26-
"%int_0 = OpConstant %int 0",
2718
"%image_2d = OpTypeImage %float Dim2D 0 0 0 1 Unknown",
2819
"%sampled_image_2d = OpTypeSampledImage %image_2d",
2920
"%image_array = OpTypeRuntimeArray %sampled_image_2d",
@@ -40,23 +31,18 @@ fn sample_proj_lod(
4031
"%coord = OpLoad _ {0}",
4132
"%ddx = OpLoad _ {3}",
4233
"%ddy = OpLoad _ {4}",
43-
"%offset_x = OpLoad _ {5}",
44-
"%offset_y = OpLoad _ {6}",
45-
"%const_offset = OpConstantComposite %v2int %int_0 %int_0",
46-
"%result = OpImageSampleProjExplicitLod _ %25 %coord Grad|ConstOffset %ddx %ddy %const_offset",
34+
"%result = OpImageSampleProjExplicitLod typeof*{2} %25 %coord Grad %ddx %ddy",
4735
"OpStore {2} %result",
4836
in(reg) &coord,
4937
in(reg) &index,
5038
in(reg) &mut result,
5139
in(reg) &ddx,
5240
in(reg) &ddy,
53-
in(reg) &offset_x,
54-
in(reg) &offset_y,
5541
);
5642
result
5743
}
5844
}
5945
#[spirv(fragment)]
6046
pub fn main() {
61-
sample_proj_lod(glam::Vec4::ZERO, glam::Vec2::ZERO, glam::Vec2::ZERO, 0, 0);
47+
sample_proj_lod(glam::Vec4::ZERO, glam::Vec2::ZERO, glam::Vec2::ZERO);
6248
}

tests/compiletests/ui/dis/complex_image_sample_inst.stderr

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
%4 = OpFunctionParameter %2
33
%5 = OpFunctionParameter %6
44
%7 = OpFunctionParameter %6
5-
%8 = OpFunctionParameter %9
6-
%10 = OpFunctionParameter %9
7-
%11 = OpLabel
8-
OpLine %12 38 13
9-
%13 = OpAccessChain %14 %15 %16
10-
OpLine %12 39 13
11-
%17 = OpLoad %18 %13
12-
OpLine %12 46 13
13-
%19 = OpImageSampleProjExplicitLod %2 %17 %4 Grad|ConstOffset %5 %7 %20
5+
%8 = OpLabel
6+
OpLine %9 29 13
7+
%10 = OpAccessChain %11 %12 %13
8+
OpLine %9 30 13
9+
%14 = OpLoad %15 %10
10+
OpLine %9 34 13
11+
%16 = OpImageSampleProjExplicitLod %2 %14 %4 Grad %5 %7
1412
OpNoLine
15-
OpReturnValue %19
13+
OpReturnValue %16
1614
OpFunctionEnd

0 commit comments

Comments
 (0)