Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wgpu to 23.0.0 #846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 88 additions & 112 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ socket2 = "0.5.5"
webrtc-util = "0.8.0"
opus = "0.3.0"
rubato = "0.15.0"
glyphon = "0.6.0"
glyphon = { git = "https://github.com/grovesNL/glyphon", rev = "f1f50ab" }
futures-util = "0.3.30"
tokio = { version = "1", features = ["full"] }
schemars = { git = "https://github.com/membraneframework-labs/schemars", rev = "a5ad1f9", features = [
"preserve_order",
] }
shared_memory = "0.12.4"
vk-video = { path = "vk-video" }
wgpu = { version = "22.1.0", default-features = false, features = [
wgpu = { version = "23.0.0", default-features = false, features = [
"wgsl",
"dx12",
"metal",
Expand Down
2 changes: 1 addition & 1 deletion compositor_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ glyphon = { workspace = true }
crossbeam-channel = { workspace = true }
resvg = "0.35.0"
nalgebra-glm = { version = "0.18.0", features = ["convert-bytemuck"] }
naga = "22.1.0"
naga = "23.0.0"
rand = { workspace = true }
tracing = { workspace = true }
shared_memory = { workspace = true, optional = true }
Expand Down
4 changes: 2 additions & 2 deletions compositor_render/src/wgpu/common_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ pub fn create_render_pipeline(
vertex: wgpu::VertexState {
buffers: &[Vertex::LAYOUT],
module: shader_module,
entry_point: crate::wgpu::common_pipeline::VERTEX_ENTRYPOINT_NAME,
entry_point: Some(crate::wgpu::common_pipeline::VERTEX_ENTRYPOINT_NAME),
compilation_options: wgpu::PipelineCompilationOptions::default(),
},
fragment: Some(wgpu::FragmentState {
module: shader_module,
entry_point: crate::wgpu::common_pipeline::FRAGMENT_ENTRYPOINT_NAME,
entry_point: Some(crate::wgpu::common_pipeline::FRAGMENT_ENTRYPOINT_NAME),
targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm,
write_mask: wgpu::ColorWrites::all(),
Expand Down
4 changes: 2 additions & 2 deletions compositor_render/src/wgpu/format/interleaved_yuv_to_rgba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ impl InterleavedYuv422ToRgbaConverter {

vertex: wgpu::VertexState {
module: &shader_module,
entry_point: "vs_main",
entry_point: Some("vs_main"),
buffers: &[Vertex::LAYOUT],
compilation_options: wgpu::PipelineCompilationOptions::default(),
},

fragment: Some(wgpu::FragmentState {
module: &shader_module,
entry_point: "fs_main",
entry_point: Some("fs_main"),
targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm,
write_mask: wgpu::ColorWrites::all(),
Expand Down
4 changes: 2 additions & 2 deletions compositor_render/src/wgpu/format/nv12_to_rgba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ impl Nv12ToRgbaConverter {

vertex: wgpu::VertexState {
module: &shader_module,
entry_point: "vs_main",
entry_point: Some("vs_main"),
buffers: &[Vertex::LAYOUT],
compilation_options: wgpu::PipelineCompilationOptions::default(),
},

fragment: Some(wgpu::FragmentState {
module: &shader_module,
entry_point: "fs_main",
entry_point: Some("fs_main"),
targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm,
write_mask: wgpu::ColorWrites::all(),
Expand Down
4 changes: 2 additions & 2 deletions compositor_render/src/wgpu/format/planar_yuv_to_rgba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ impl PlanarYuvToRgbaConverter {

vertex: wgpu::VertexState {
module: &shader_module,
entry_point: "vs_main",
entry_point: Some("vs_main"),
buffers: &[Vertex::LAYOUT],
compilation_options: wgpu::PipelineCompilationOptions::default(),
},

fragment: Some(wgpu::FragmentState {
module: &shader_module,
entry_point: "fs_main",
entry_point: Some("fs_main"),
targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm,
write_mask: wgpu::ColorWrites::all(),
Expand Down
4 changes: 2 additions & 2 deletions compositor_render/src/wgpu/format/rgba_to_yuv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ impl RgbaToYuvConverter {

vertex: wgpu::VertexState {
module: &shader_module,
entry_point: "vs_main",
entry_point: Some("vs_main"),
buffers: &[Vertex::LAYOUT],
compilation_options: wgpu::PipelineCompilationOptions::default(),
},

fragment: Some(wgpu::FragmentState {
module: &shader_module,
entry_point: "fs_main",
entry_point: Some("fs_main"),
targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::R8Unorm,
write_mask: wgpu::ColorWrites::all(),
Expand Down
4 changes: 2 additions & 2 deletions compositor_render/src/wgpu/utils/r8_fill_with_color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ impl R8FillWithValue {
primitive: PRIMITIVE_STATE,
vertex: wgpu::VertexState {
module: &shader_module,
entry_point: "vs_main",
entry_point: Some("vs_main"),
buffers: &[Vertex::LAYOUT],
compilation_options: wgpu::PipelineCompilationOptions::default(),
},
fragment: Some(wgpu::FragmentState {
module: &shader_module,
entry_point: "fs_main",
entry_point: Some("fs_main"),
targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::R8Unorm,
write_mask: wgpu::ColorWrites::all(),
Expand Down
2 changes: 1 addition & 1 deletion vk-video/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ h264-reader = { git = "https://github.com/membraneframework-labs/h264-reader.git
thiserror = "1.0.59"
tracing = "0.1.40"
vk-mem = "0.4.0"
wgpu = "22.1.0"
wgpu = "23.0.0"

[dev-dependencies]
tracing-subscriber = "0.3.18"
Expand Down
9 changes: 8 additions & 1 deletion vk-video/src/vulkan_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,11 @@ impl VulkanDecoder<'_> {
}
}

// this has to be done with Option and mut, because the closure we create has to be FnMut.
// this means we cannot consume its captures, so we have to take the option to be able to
// drop the resource.
let mut image_clone = Some(image.clone());

let hal_texture = unsafe {
wgpu::hal::vulkan::Device::texture_from_raw(
**image,
Expand All @@ -747,7 +752,9 @@ impl VulkanDecoder<'_> {
format: wgpu::TextureFormat::NV12,
mip_level_count: 1,
},
Some(Box::new(image.clone())),
Some(Box::new(move || {
image_clone.take();
})),
)
};

Expand Down
18 changes: 16 additions & 2 deletions vk-video/src/vulkan_decoder/vulkan_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ impl VulkanCtx {
None
};

// this has to be done with Option and mut, because the closure we create has to be FnMut.
// this means we cannot consume its captures, so we have to take the option to be able to
// drop the resource.
let mut instance_clone = Some(instance.clone());

let wgpu_instance = unsafe {
wgpu::hal::vulkan::Instance::from_raw(
(*entry).clone(),
Expand All @@ -221,7 +226,9 @@ impl VulkanCtx {
extensions,
wgpu::InstanceFlags::empty(),
false,
None,
Some(Box::new(move || {
instance_clone.take();
})),
)?
};

Expand Down Expand Up @@ -323,10 +330,17 @@ impl VulkanCtx {
},
};

// this has to be done with Option and mut, because the closure we create has to be FnMut.
// this means we cannot consume its captures, so we have to take the option to be able to
// drop the resource.
let mut device_clone = Some(device.clone());

let wgpu_device = unsafe {
wgpu_adapter.adapter.device_from_raw(
device.device.clone(),
false,
Some(Box::new(move || {
device_clone.take();
})),
&required_extensions,
wgpu_features,
&wgpu::MemoryHints::default(),
Expand Down