55use core:: arch:: asm;
66use 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) ]
6046pub 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}
0 commit comments