diff options
| author | s-ol <s+removethis@s-ol.nu> | 2026-05-04 21:45:39 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2026-05-14 15:00:13 +0000 |
| commit | 0bdd9ae4e181283ac1d21b52cce7b28c565d936f (patch) | |
| tree | 141632d39cda63d9a605b182041006ada7031ec2 /src/gpu.rs | |
| parent | switch to WESL shaders (diff) | |
| download | wgsl-view-0bdd9ae4e181283ac1d21b52cce7b28c565d936f.tar.gz wgsl-view-0bdd9ae4e181283ac1d21b52cce7b28c565d936f.zip | |
tsv-video-*: share code
Diffstat (limited to 'src/gpu.rs')
| -rw-r--r-- | src/gpu.rs | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -1,10 +1,9 @@ use std::time::Duration; use ash::vk; -use texture_share_vk_base::vk_device::VkDevice; -use texture_share_vk_base::vk_entry::VkEntry; -use texture_share_vk_base::vk_instance::VkInstance; -use texture_share_vk_base::vk_setup::VkSetup; +use texture_share_vk_client::base::{ + vk_device::VkDevice, vk_entry::VkEntry, vk_instance::VkInstance, vk_setup::VkSetup, +}; use texture_share_vk_client::VkClient; const TSV_SERVER_EXECUTABLE: &str = "/usr/bin/texture-share-vk-server"; @@ -121,12 +120,11 @@ pub fn create_tsv_client(device: &wgpu::Device) -> VkClient { .expect("connect to texture-share-vk server") } -/// Image format for texture-share-vk, matching RGBA8. -pub const TSV_FORMAT: texture_share_vk_base::ipc::platform::img_data::ImgFormat = - texture_share_vk_base::ipc::platform::img_data::ImgFormat::R8G8B8A8; - /// Re-export ImgFormat and ImgType for use in binaries. -pub use texture_share_vk_base::ipc::platform::img_data::{ImgFormat, ImgType}; +pub use texture_share_vk_client::base::ipc::platform::img_data::{ImgFormat, ImgType}; + +/// Image format for texture-share-vk, matching RGBA8. +pub const TSV_FORMAT: ImgFormat = ImgFormat::R8G8B8A8; /// Convert a TSV ImgFormat to a wgpu TextureFormat. pub fn img_format_to_wgpu(fmt: ImgFormat) -> wgpu::TextureFormat { @@ -261,6 +259,14 @@ pub fn refresh_textures( needs_rebind } +pub fn img_type_to_wgpu(image_type: ImgType, depth_or_array_layers: u32) -> wgpu::TextureDimension { + match image_type { + ImgType::D3 => wgpu::TextureDimension::D3, + ImgType::D2 if depth_or_array_layers > 1 => wgpu::TextureDimension::D3, + ImgType::D2 => wgpu::TextureDimension::D2, + } +} + fn img_type_to_view_dimension( image_type: ImgType, depth_or_array_layers: u32, |
