From d44bfaa76ad2d3bb151a9058b61161cbda53ecf1 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Tue, 9 Jan 2024 23:22:31 +0100 Subject: [PATCH] Update naga to 0.19 trunk --- Cargo.toml | 4 +-- examples/pbr_compose_test.rs | 2 ++ src/compose/mod.rs | 3 +-- src/compose/test.rs | 27 ++++++++++++------- .../tests/expected/additional_import.txt | 4 +-- .../tests/expected/bad_identifiers.txt | 18 ++++++------- src/compose/tests/expected/big_shaderdefs.txt | 4 +-- src/compose/tests/expected/dup_import.txt | 6 ++--- .../tests/expected/dup_struct_import.txt | 4 +-- src/compose/tests/expected/glsl_call_wgsl.txt | 2 +- .../tests/expected/glsl_const_import.txt | 4 +-- .../tests/expected/glsl_wgsl_const_import.txt | 4 +-- src/compose/tests/expected/item_sub_point.txt | 4 +-- src/compose/tests/expected/simple_compose.txt | 2 +- .../expected/test_quoted_import_dup_name.txt | 4 +-- .../tests/expected/use_shared_global.txt | 4 +-- .../tests/expected/wgsl_call_entrypoint.txt | 2 +- .../tests/expected/wgsl_glsl_const_import.txt | 4 +-- 18 files changed, 55 insertions(+), 47 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9b8014f..c0e6e10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ prune = [] allow_deprecated = [] [dependencies] -naga = { version = "0.14.1", features = ["wgsl-in", "wgsl-out", "clone", "span"] } +naga = { git = "https://github.com/gfx-rs/wgpu", rev = "6c86b557647336694c44a9c7a08301d5f658f8e4", features = ["wgsl-in", "wgsl-out", "clone"] } tracing = "0.1" regex = "1.8" regex-syntax = "0.7" @@ -31,6 +31,6 @@ once_cell = "1.17.0" indexmap = "2" [dev-dependencies] -wgpu = { version = "0.18", features = ["naga"] } +wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "6c86b557647336694c44a9c7a08301d5f658f8e4", features = ["naga"] } futures-lite = "1" tracing-subscriber = { version = "0.3", features = ["std", "fmt"] } diff --git a/examples/pbr_compose_test.rs b/examples/pbr_compose_test.rs index acc9d1e..3adac17 100644 --- a/examples/pbr_compose_test.rs +++ b/examples/pbr_compose_test.rs @@ -142,6 +142,7 @@ fn test_wgsl_string_compile(n: usize) { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default()); let adapter = instance .enumerate_adapters(wgpu::Backends::all()) + .into_iter() .next() .unwrap(); let device = futures_lite::future::block_on( @@ -165,6 +166,7 @@ fn test_composer_compile(n: usize, composer: &mut Composer) { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default()); let adapter = instance .enumerate_adapters(wgpu::Backends::all()) + .into_iter() .next() .unwrap(); let device = futures_lite::future::block_on( diff --git a/src/compose/mod.rs b/src/compose/mod.rs index 4e5c701..0926766 100644 --- a/src/compose/mod.rs +++ b/src/compose/mod.rs @@ -495,8 +495,7 @@ impl Composer { name: None, inner: naga::TypeInner::Vector { size: naga::VectorSize::Quad, - kind: naga::ScalarKind::Float, - width: 4, + scalar: naga::Scalar::F32, }, }, naga::Span::UNDEFINED, diff --git a/src/compose/test.rs b/src/compose/test.rs index 5f6c533..2968812 100644 --- a/src/compose/test.rs +++ b/src/compose/test.rs @@ -1423,11 +1423,12 @@ mod test { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default()); let adapter = instance .enumerate_adapters(wgpu::Backends::all()) + .into_iter() .next() .unwrap(); let (device, queue) = futures_lite::future::block_on(adapter.request_device( &wgpu::DeviceDescriptor { - features: Features::MAPPABLE_PRIMARY_BUFFERS, + required_features: Features::MAPPABLE_PRIMARY_BUFFERS, ..Default::default() }, None, @@ -1439,13 +1440,6 @@ mod test { label: None, }); - let pipeline = device.create_compute_pipeline(&ComputePipelineDescriptor { - label: None, - layout: None, - module: &shader_module, - entry_point: "run_test", - }); - let output_buffer = device.create_buffer(&BufferDescriptor { label: None, size: 4, @@ -1467,6 +1461,19 @@ mod test { }], }); + let pipeline = device.create_compute_pipeline(&ComputePipelineDescriptor { + label: None, + layout: Some( + &device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: None, + bind_group_layouts: &[&layout], + push_constant_ranges: &[], + }), + ), + module: &shader_module, + entry_point: "run_test", + }); + let bindgroup = device.create_bind_group(&BindGroupDescriptor { label: None, layout: &layout, @@ -1493,7 +1500,7 @@ mod test { queue.submit([buffer]); - while !device.poll(wgpu::MaintainBase::Wait) { + while !device.poll(wgpu::MaintainBase::Wait).is_queue_empty() { println!("waiting..."); } @@ -1501,7 +1508,7 @@ mod test { .slice(..) .map_async(wgpu::MapMode::Read, |_| ()); - while !device.poll(wgpu::MaintainBase::Wait) { + while !device.poll(wgpu::MaintainBase::Wait).is_queue_empty() { println!("waiting..."); } diff --git a/src/compose/tests/expected/additional_import.txt b/src/compose/tests/expected/additional_import.txt index f57a22d..46cef6a 100644 --- a/src/compose/tests/expected/additional_import.txt +++ b/src/compose/tests/expected/additional_import.txt @@ -1,10 +1,10 @@ fn funcX_naga_oil_mod_XN53GK4TSNFSGCYTMMUX() -> f32 { - return 1.0; + return 1f; } fn funcX_naga_oil_vrt_XN53GK4TSNFSGCYTMMUXX_naga_oil_mod_XOBWHKZ3JNYX() -> f32 { let _e0: f32 = funcX_naga_oil_mod_XN53GK4TSNFSGCYTMMUX(); - return (_e0 + 1.0); + return (_e0 + 1f); } fn entry_point() -> f32 { diff --git a/src/compose/tests/expected/bad_identifiers.txt b/src/compose/tests/expected/bad_identifiers.txt index 120c896..a5ed4aa 100644 --- a/src/compose/tests/expected/bad_identifiers.txt +++ b/src/compose/tests/expected/bad_identifiers.txt @@ -6,32 +6,32 @@ - d.fine = 3.0; - e.fine_member = 4.0; + d.fine = 3f; + e.fine_member = 4f; fine: f32, fine_member: f32, - let _e1: f32 = fineX_naga_oil_mod_XMZXHGX(1.0); + let _e1: f32 = fineX_naga_oil_mod_XMZXHGX(1f); let _e20: f32 = d.fine; let _e23: f32 = e.fine_member; - let _e3: f32 = bad_X_naga_oil_mod_XMZXHGX(2.0); + let _e3: f32 = bad_X_naga_oil_mod_XMZXHGX(2f); let _e6: f32 = fineX_naga_oil_mod_XM5WG6YTBNRZQX; let _e8: f32 = bad_X_naga_oil_mod_XM5WG6YTBNRZQX; let b: f32 = (_e1 + _e3); let c: f32 = (_e6 + _e8); - return ((((2.0 + b) + c) + _e20) + _e23); + return ((((2f + b) + c) + _e20) + _e23); return in; return in_1; var d: IsFineX_naga_oil_mod_XON2HE5LDORZQX; var e: Isbad_X_naga_oil_mod_XON2HE5LDORZQX; -const bad_X_naga_oil_mod_XMNXW443UOMX: f32 = 1.0; -const fineX_naga_oil_mod_XMNXW443UOMX: f32 = 1.0; +const bad_X_naga_oil_mod_XMNXW443UOMX: f32 = 1f; +const fineX_naga_oil_mod_XMNXW443UOMX: f32 = 1f; fn bad_X_naga_oil_mod_XMZXHGX(in_1: f32) -> f32 { fn fineX_naga_oil_mod_XMZXHGX(in: f32) -> f32 { fn main() -> f32 { struct IsFineX_naga_oil_mod_XON2HE5LDORZQX { struct Isbad_X_naga_oil_mod_XON2HE5LDORZQX { -var bad_X_naga_oil_mod_XM5WG6YTBNRZQX: f32 = 1.0; -var fineX_naga_oil_mod_XM5WG6YTBNRZQX: f32 = 1.0; +var bad_X_naga_oil_mod_XM5WG6YTBNRZQX: f32 = 1f; +var fineX_naga_oil_mod_XM5WG6YTBNRZQX: f32 = 1f; } } } diff --git a/src/compose/tests/expected/big_shaderdefs.txt b/src/compose/tests/expected/big_shaderdefs.txt index 82491fa..a653fbe 100644 --- a/src/compose/tests/expected/big_shaderdefs.txt +++ b/src/compose/tests/expected/big_shaderdefs.txt @@ -1,7 +1,7 @@ fn fX_naga_oil_mod_XNVXWIX() -> f32 { - var x: f32 = 0.0; + var x: f32 = 0f; - x = 1.0; + x = 1f; let _e3: f32 = x; return _e3; } diff --git a/src/compose/tests/expected/dup_import.txt b/src/compose/tests/expected/dup_import.txt index 8b7a946..be799a3 100644 --- a/src/compose/tests/expected/dup_import.txt +++ b/src/compose/tests/expected/dup_import.txt @@ -5,9 +5,9 @@ let _e0: f32 = fX_naga_oil_mod_XMEX(); let _e1: f32 = fX_naga_oil_mod_XMIX(); return (_e0 * _e1); - return 3.1; - return 6.2; -const PIX_naga_oil_mod_XMNXW443UOMX: f32 = 3.1; + return 3.1f; + return 6.2f; +const PIX_naga_oil_mod_XMNXW443UOMX: f32 = 3.1f; fn fX_naga_oil_mod_XMEX() -> f32 { fn fX_naga_oil_mod_XMIX() -> f32 { fn main() -> f32 { diff --git a/src/compose/tests/expected/dup_struct_import.txt b/src/compose/tests/expected/dup_struct_import.txt index e0eed15..0f2611c 100644 --- a/src/compose/tests/expected/dup_struct_import.txt +++ b/src/compose/tests/expected/dup_struct_import.txt @@ -11,8 +11,8 @@ return (_e0.value / _e1.value); return _e3; return _e3; - s_a.value = 1.0; - s_b.value = 2.0; + s_a.value = 1f; + s_b.value = 2f; value: f32, var s_a: MyStructX_naga_oil_mod_XON2HE5LDOQX; var s_b: MyStructX_naga_oil_mod_XON2HE5LDOQX; diff --git a/src/compose/tests/expected/glsl_call_wgsl.txt b/src/compose/tests/expected/glsl_call_wgsl.txt index 50498c1..1df7ccf 100644 --- a/src/compose/tests/expected/glsl_call_wgsl.txt +++ b/src/compose/tests/expected/glsl_call_wgsl.txt @@ -5,7 +5,7 @@ struct VertexOutput { var gl_Position: vec4; fn wgsl_funcX_naga_oil_mod_XO5TXG3C7NVXWI5LMMUX() -> f32 { - return 53.0; + return 53f; } fn main_1() { diff --git a/src/compose/tests/expected/glsl_const_import.txt b/src/compose/tests/expected/glsl_const_import.txt index c1fee8f..2dd5d4c 100644 --- a/src/compose/tests/expected/glsl_const_import.txt +++ b/src/compose/tests/expected/glsl_const_import.txt @@ -2,12 +2,12 @@ struct FragmentOutput { @location(0) out_color: vec4, } -const my_constantX_naga_oil_mod_XMNXW23LPNYX: f32 = 0.5; +const my_constantX_naga_oil_mod_XMNXW23LPNYX: f32 = 0.5f; var out_color: vec4; fn main_1() { - out_color = vec4(1.0, 0.5, 0.0, 1.0); + out_color = vec4(1f, 0.5f, 0f, 1f); return; } diff --git a/src/compose/tests/expected/glsl_wgsl_const_import.txt b/src/compose/tests/expected/glsl_wgsl_const_import.txt index c1ab2a9..e2c69e3 100644 --- a/src/compose/tests/expected/glsl_wgsl_const_import.txt +++ b/src/compose/tests/expected/glsl_wgsl_const_import.txt @@ -1,6 +1,6 @@ -const my_constantX_naga_oil_mod_XMNXW23LPNYX: f32 = 0.5; +const my_constantX_naga_oil_mod_XMNXW23LPNYX: f32 = 0.5f; fn main() -> vec4 { - return vec4(1.0, 0.5, 0.0, 1.0); + return vec4(1f, 0.5f, 0f, 1f); } diff --git a/src/compose/tests/expected/item_sub_point.txt b/src/compose/tests/expected/item_sub_point.txt index 63daa0f..bbda779 100644 --- a/src/compose/tests/expected/item_sub_point.txt +++ b/src/compose/tests/expected/item_sub_point.txt @@ -3,14 +3,14 @@ struct FragX_naga_oil_mod_XNVXWIX { } fn fragmentX_naga_oil_mod_XNVXWIX(f_1: FragX_naga_oil_mod_XNVXWIX) -> f32 { - return (f_1.fragment * 2.0); + return (f_1.fragment * 2f); } @fragment fn main() -> @location(0) f32 { var f: FragX_naga_oil_mod_XNVXWIX; - f.fragment = 3.0; + f.fragment = 3f; let _e3: FragX_naga_oil_mod_XNVXWIX = f; let _e4: f32 = fragmentX_naga_oil_mod_XNVXWIX(_e3); return _e4; diff --git a/src/compose/tests/expected/simple_compose.txt b/src/compose/tests/expected/simple_compose.txt index d8aacaa..ce9c36b 100644 --- a/src/compose/tests/expected/simple_compose.txt +++ b/src/compose/tests/expected/simple_compose.txt @@ -1,5 +1,5 @@ fn helloX_naga_oil_mod_XNFXGGX() -> f32 { - return 1.0; + return 1f; } fn main() -> f32 { diff --git a/src/compose/tests/expected/test_quoted_import_dup_name.txt b/src/compose/tests/expected/test_quoted_import_dup_name.txt index ce3b573..d35a923 100644 --- a/src/compose/tests/expected/test_quoted_import_dup_name.txt +++ b/src/compose/tests/expected/test_quoted_import_dup_name.txt @@ -1,9 +1,9 @@ fn fooX_naga_oil_mod_XEJYXK33UMVSF63LPMR2WYZJCX() -> f32 { - return 3.0; + return 3f; } fn myfunc(foo: u32) -> f32 { - return (f32(foo) * 2.0); + return (f32(foo) * 2f); } fn main() -> f32 { diff --git a/src/compose/tests/expected/use_shared_global.txt b/src/compose/tests/expected/use_shared_global.txt index f4a1263..c1f04e5 100644 --- a/src/compose/tests/expected/use_shared_global.txt +++ b/src/compose/tests/expected/use_shared_global.txt @@ -1,8 +1,8 @@ -var aX_naga_oil_mod_XNVXWIX: f32 = 0.0; +var aX_naga_oil_mod_XNVXWIX: f32 = 0f; fn add() { let _e2: f32 = aX_naga_oil_mod_XNVXWIX; - aX_naga_oil_mod_XNVXWIX = (_e2 + 1.0); + aX_naga_oil_mod_XNVXWIX = (_e2 + 1f); return; } diff --git a/src/compose/tests/expected/wgsl_call_entrypoint.txt b/src/compose/tests/expected/wgsl_call_entrypoint.txt index 8df9240..54bfb49 100644 --- a/src/compose/tests/expected/wgsl_call_entrypoint.txt +++ b/src/compose/tests/expected/wgsl_call_entrypoint.txt @@ -1,5 +1,5 @@ fn fragmentX_naga_oil_mod_XNFXGG3DVMRSQX(frag_coord_1: vec4) -> vec4 { - return vec4((1.5 * frag_coord_1)); + return vec4((1.5f * frag_coord_1)); } @fragment diff --git a/src/compose/tests/expected/wgsl_glsl_const_import.txt b/src/compose/tests/expected/wgsl_glsl_const_import.txt index c1fee8f..2dd5d4c 100644 --- a/src/compose/tests/expected/wgsl_glsl_const_import.txt +++ b/src/compose/tests/expected/wgsl_glsl_const_import.txt @@ -2,12 +2,12 @@ struct FragmentOutput { @location(0) out_color: vec4, } -const my_constantX_naga_oil_mod_XMNXW23LPNYX: f32 = 0.5; +const my_constantX_naga_oil_mod_XMNXW23LPNYX: f32 = 0.5f; var out_color: vec4; fn main_1() { - out_color = vec4(1.0, 0.5, 0.0, 1.0); + out_color = vec4(1f, 0.5f, 0f, 1f); return; }