Skip to content

Commit 6ab5f94

Browse files
committed
update to wpgu 30
1 parent 2b57f5b commit 6ab5f94

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

media-video/vulkan/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ thiserror = "2"
1515
smallvec = "1"
1616
ezk-image = { workspace = true, features = ["multi-thread", "NV12", "RGBA", "BGRA", "ARGB", "ABGR"] }
1717

18-
wgpu = { version = "29", default-features = false, features = ["vulkan"] }
18+
wgpu = { version = "30", default-features = false, features = ["vulkan"] }
1919
anyhow = "1"
2020

2121
[dev-dependencies]

media-video/vulkan/src/image.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ impl Image {
740740
usage,
741741
view_formats: &[],
742742
},
743+
wgpu::TextureUses::UNINITIALIZED,
743744
),
744745
)
745746
}
@@ -835,6 +836,9 @@ impl Image {
835836
usage.insert(wgpu::TextureUsages::RENDER_ATTACHMENT);
836837
}
837838

839+
let initial_state =
840+
texture_uses_from_layout(self.inner.state.lock().unwrap()[0].current_layout);
841+
838842
device.create_texture_from_hal::<wgpu::hal::vulkan::Api>(
839843
hal_texture,
840844
&wgpu::TextureDescriptor {
@@ -847,10 +851,23 @@ impl Image {
847851
usage,
848852
view_formats: &[],
849853
},
854+
initial_state,
850855
)
851856
}
852857
}
853858

859+
fn texture_uses_from_layout(layout: vk::ImageLayout) -> wgpu::TextureUses {
860+
match layout {
861+
vk::ImageLayout::TRANSFER_SRC_OPTIMAL => wgpu::TextureUses::COPY_SRC,
862+
vk::ImageLayout::TRANSFER_DST_OPTIMAL => wgpu::TextureUses::COPY_DST,
863+
vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL => wgpu::TextureUses::RESOURCE,
864+
vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL => wgpu::TextureUses::COLOR_TARGET,
865+
vk::ImageLayout::PRESENT_SRC_KHR => wgpu::TextureUses::PRESENT,
866+
vk::ImageLayout::GENERAL => wgpu::TextureUses::STORAGE_READ_ONLY,
867+
_ => wgpu::TextureUses::UNINITIALIZED,
868+
}
869+
}
870+
854871
impl Drop for Inner {
855872
fn drop(&mut self) {
856873
unsafe {

0 commit comments

Comments
 (0)