diff --git a/Cargo.lock b/Cargo.lock index 1a7d9b58..b74f4a8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1899,6 +1899,7 @@ dependencies = [ "ec-h264-syntax", "ec-h265-syntax", "vulkanalia", + "windows", ] [[package]] @@ -2018,12 +2019,116 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d107c80dd656e1a2c254dfb1d57ece73b7f515b8a8684c270c23cab68f4a440d" +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + [[package]] name = "wit-bindgen" version = "0.57.1" diff --git a/crates/ec-hw/src/hw.rs b/crates/ec-hw/src/hw.rs index e6759e19..8ccbde73 100644 --- a/crates/ec-hw/src/hw.rs +++ b/crates/ec-hw/src/hw.rs @@ -343,12 +343,14 @@ pub fn dup_fd(fd: std::os::fd::RawFd) -> Result { /// A D3D11 texture of packed 32-bit RGB pixels (DXGI_FORMAT_B8G8R8A8_UNORM or R8G8B8A8_UNORM, one mip, one layer) shared as an NT handle from `IDXGIResource1::CreateSharedHandle`. /// -/// The encoder's import cache keys on the handle value: keep one handle open per texture for as long as frames come from it. The D3D11 writes must be finished before the call, and the texture left unwritten until its coded picture is returned. +/// [`D3d11Pool::submit`] makes these. The encoder's import cache keys on `id`, unique per texture. The D3D11 writes must be finished before the call, and the texture left unwritten until its coded picture is returned. #[cfg(windows)] #[derive(Debug, Clone, Copy)] pub struct D3d11Frame<'a> { /// Shared NT handle; borrowed, not closed. pub handle: std::os::windows::io::BorrowedHandle<'a>, + /// Identity of the texture, unique for the process lifetime. + pub id: u64, /// Width in pixels, even; at least the encoder width. pub width: u32, /// Height in pixels, even; at least the encoder height. @@ -362,6 +364,7 @@ impl D3d11Frame<'_> { fn texture(&self) -> ec_vk::D3d11Texture<'_> { ec_vk::D3d11Texture { handle: self.handle, + id: self.id, width: self.width, height: self.height, bgr: self.order == RgbOrder::Bgra, @@ -369,6 +372,33 @@ impl D3d11Frame<'_> { } } +/// Copies captured D3D11 frames into a ring of shared textures for [`HwEncoder::encode_d3d11`], waiting for each copy to finish. Use it on the thread that owns the device's immediate context (the capture callback). +#[cfg(windows)] +pub struct D3d11Pool(ec_vk::D3d11Pool); + +#[cfg(windows)] +impl D3d11Pool { + /// A pool on the device that produces the frames. + pub fn new(device: &ec_vk::windows::Win32::Graphics::Direct3D11::ID3D11Device) -> Result { + Ok(D3d11Pool(ec_vk::D3d11Pool::new(device)?)) + } + + /// Copies `frame` (B8G8R8A8 or R8G8B8A8, one mip, one layer) into the next shared texture. The result is valid until the pool reuses that texture, four calls later. + pub fn submit( + &mut self, + frame: &ec_vk::windows::Win32::Graphics::Direct3D11::ID3D11Texture2D, + ) -> Result> { + let t = self.0.submit(frame)?; + Ok(D3d11Frame { + handle: t.handle, + id: t.id, + width: t.width, + height: t.height, + order: if t.bgr { RgbOrder::Bgra } else { RgbOrder::Rgba }, + }) + } +} + /// Whether [`HwEncoder::encode_d3d11`] can import textures of `order` on this machine's Vulkan device. #[cfg(windows)] pub fn d3d11_supported(order: RgbOrder) -> bool { diff --git a/crates/ec-hw/src/lib.rs b/crates/ec-hw/src/lib.rs index a0be61e9..9a98f427 100644 --- a/crates/ec-hw/src/lib.rs +++ b/crates/ec-hw/src/lib.rs @@ -93,7 +93,7 @@ pub use ec_vk::{DmaBufFormat, DmaBufPlane}; #[cfg(target_os = "linux")] pub use hw::{DmaBufFrame, DmaBufYuvFrame, dmabuf_modifiers, dup_fd}; #[cfg(windows)] -pub use hw::{D3d11Frame, d3d11_supported}; +pub use hw::{D3d11Frame, D3d11Pool, d3d11_supported}; pub use hw::{ Backend, Capability, CodecProfile, Direction, EncodeInput, HwDecoder, HwEncoder, RgbFrame, RgbOrder, RgbOutput, capabilities, diff --git a/crates/ec-vk/src/lib.rs b/crates/ec-vk/src/lib.rs index a6cd1d3e..426516a5 100644 --- a/crates/ec-vk/src/lib.rs +++ b/crates/ec-vk/src/lib.rs @@ -14,7 +14,7 @@ mod history; pub use av1::{Av1Encoder, Av1EncoderConfig}; pub use h265::{H265Encoder, H265EncoderConfig}; #[cfg(windows)] -pub use vk_video_ffi::{D3d11Texture, d3d11_importable}; +pub use vk_video_ffi::{D3d11Pool, D3d11Texture, d3d11_importable, windows}; #[cfg(target_os = "linux")] pub use vk_video_ffi::{DmaBuf, DmaBufExport, DmaBufFormat, DmaBufPlane, dup_raw_fd, read_dmabuf, rgb_import_modifiers}; pub use vk_video_ffi::{ diff --git a/shims/vk-video-ffi/Cargo.toml b/shims/vk-video-ffi/Cargo.toml index cf368631..b9f3e3d4 100644 --- a/shims/vk-video-ffi/Cargo.toml +++ b/shims/vk-video-ffi/Cargo.toml @@ -8,7 +8,19 @@ authors.workspace = true [dependencies] vulkanalia = { version = "0.35", features = ["libloading"] } +[target.'cfg(windows)'.dependencies] +windows = { version = "0.62.2", features = [ + "Win32_Foundation", + "Win32_Security", + "Win32_Graphics_Direct3D11", + "Win32_Graphics_Dxgi", + "Win32_Graphics_Dxgi_Common", +] } + [dev-dependencies] ec-av1-syntax.workspace = true ec-h264-syntax.workspace = true ec-h265-syntax.workspace = true + +[target.'cfg(windows)'.dev-dependencies] +windows = { version = "0.62.2", features = ["Win32_Graphics_Direct3D"] } diff --git a/shims/vk-video-ffi/examples/d3d11_pool.rs b/shims/vk-video-ffi/examples/d3d11_pool.rs new file mode 100644 index 00000000..102b0523 --- /dev/null +++ b/shims/vk-video-ffi/examples/d3d11_pool.rs @@ -0,0 +1,111 @@ +#[cfg(windows)] +fn main() { + use std::os::windows::io::AsRawHandle; + + use vk_video_ffi::D3d11Pool; + use windows::Win32::Foundation::{HANDLE, HMODULE}; + use windows::Win32::Graphics::Direct3D::D3D_DRIVER_TYPE_WARP; + use windows::Win32::Graphics::Direct3D11::{ + D3D11_CPU_ACCESS_READ, D3D11_CREATE_DEVICE_BGRA_SUPPORT, D3D11_MAP_READ, + D3D11_MAPPED_SUBRESOURCE, D3D11_SDK_VERSION, D3D11_SUBRESOURCE_DATA, D3D11_TEXTURE2D_DESC, + D3D11_USAGE_DEFAULT, D3D11_USAGE_STAGING, D3D11CreateDevice, ID3D11Device, ID3D11Device1, + ID3D11Texture2D, + }; + use windows::Win32::Graphics::Dxgi::Common::{DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_SAMPLE_DESC}; + use windows::core::Interface; + + let (w, h) = (256u32, 144u32); + let mut device: Option = None; + unsafe { + D3D11CreateDevice( + None, + D3D_DRIVER_TYPE_WARP, + HMODULE::default(), + D3D11_CREATE_DEVICE_BGRA_SUPPORT, + None, + D3D11_SDK_VERSION, + Some(&mut device), + None, + None, + ) + .expect("WARP device"); + } + let device = device.expect("device"); + let context = unsafe { device.GetImmediateContext() }.expect("context"); + let desc = |usage, cpu: u32, bind: u32| D3D11_TEXTURE2D_DESC { + Width: w, + Height: h, + MipLevels: 1, + ArraySize: 1, + Format: DXGI_FORMAT_B8G8R8A8_UNORM, + SampleDesc: DXGI_SAMPLE_DESC { Count: 1, Quality: 0 }, + Usage: usage, + BindFlags: bind, + CPUAccessFlags: cpu, + MiscFlags: 0, + }; + let mut pool = D3d11Pool::new(&device).expect("pool"); + let mut ids = Vec::new(); + for round in 0..6u32 { + let pixels: Vec = (0..w * h * 4).map(|i| (i * 7 + round * 13) as u8).collect(); + let init = D3D11_SUBRESOURCE_DATA { + pSysMem: pixels.as_ptr().cast(), + SysMemPitch: w * 4, + SysMemSlicePitch: 0, + }; + let mut src: Option = None; + unsafe { + device + .CreateTexture2D(&desc(D3D11_USAGE_DEFAULT, 0, 8), Some(&init), Some(&mut src)) + .expect("source texture"); + } + let src = src.expect("source"); + let frame = pool.submit(&src).expect("submit"); + ids.push(frame.id); + let dev1: ID3D11Device1 = device.cast().expect("ID3D11Device1"); + let opened: ID3D11Texture2D = + unsafe { dev1.OpenSharedResource1(HANDLE(frame.handle.as_raw_handle())) } + .expect("OpenSharedResource1"); + let mut staging: Option = None; + unsafe { + device + .CreateTexture2D( + &desc(D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ.0 as u32, 0), + None, + Some(&mut staging), + ) + .expect("staging"); + } + let staging = staging.expect("staging"); + let mut got = vec![0u8; pixels.len()]; + unsafe { + context.CopyResource(&staging, &opened); + let mut map = D3D11_MAPPED_SUBRESOURCE::default(); + context.Map(&staging, 0, D3D11_MAP_READ, 0, Some(&mut map)).expect("map"); + for y in 0..h as usize { + let row = std::slice::from_raw_parts( + map.pData.cast::().add(y * map.RowPitch as usize), + w as usize * 4, + ); + got[y * w as usize * 4..][..w as usize * 4].copy_from_slice(row); + } + context.Unmap(&staging, 0); + } + println!( + "round {round} id {} {}x{} bgr {} {}", + frame.id, + frame.width, + frame.height, + frame.bgr, + if got == pixels { "identical" } else { "DIFFERS" } + ); + } + println!("ids {ids:?}"); + match vk_video_ffi::Gpu::open() { + Ok(gpu) => println!("vulkan: importable bgr {}", vk_video_ffi::d3d11_importable(&gpu, true)), + Err(e) => println!("vulkan: {e}"), + } +} + +#[cfg(not(windows))] +fn main() {} diff --git a/shims/vk-video-ffi/src/av1_encode.rs b/shims/vk-video-ffi/src/av1_encode.rs index 69c64cfc..297d0eb7 100644 --- a/shims/vk-video-ffi/src/av1_encode.rs +++ b/shims/vk-video-ffi/src/av1_encode.rs @@ -309,7 +309,7 @@ impl Av1EncodeSession { self.enc.flush_last() } - /// Number of D3D11 texture imports made so far; a texture re-used by handle is imported once. + /// Number of D3D11 texture imports made so far; a texture re-used by id is imported once. #[cfg(windows)] pub fn d3d11_imports(&self) -> usize { self.enc.import_count() diff --git a/shims/vk-video-ffi/src/d3d11.rs b/shims/vk-video-ffi/src/d3d11.rs index 8d49087a..10a5ae41 100644 --- a/shims/vk-video-ffi/src/d3d11.rs +++ b/shims/vk-video-ffi/src/d3d11.rs @@ -1,4 +1,17 @@ -use std::os::windows::io::{AsRawHandle, BorrowedHandle}; +use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, OwnedHandle}; + +use windows::Win32::Graphics::Direct3D11::{ + D3D11_BIND_RENDER_TARGET, D3D11_BIND_SHADER_RESOURCE, D3D11_QUERY_DESC, D3D11_QUERY_EVENT, + D3D11_RESOURCE_MISC_SHARED, D3D11_RESOURCE_MISC_SHARED_NTHANDLE, D3D11_TEXTURE2D_DESC, + D3D11_USAGE_DEFAULT, ID3D11Device, ID3D11DeviceContext, ID3D11Query, ID3D11Texture2D, +}; +use windows::Win32::Graphics::Dxgi::Common::{ + DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_SAMPLE_DESC, +}; +use windows::Win32::Graphics::Dxgi::{ + DXGI_SHARED_RESOURCE_READ, DXGI_SHARED_RESOURCE_WRITE, IDXGIResource1, +}; +use windows::core::{Interface, PCWSTR}; use vulkanalia::prelude::v1_3::*; use vulkanalia::vk::KhrExternalMemoryWin32ExtensionDeviceCommands; @@ -12,11 +25,13 @@ const HANDLE_TYPE: vk::ExternalMemoryHandleTypeFlags = /// A D3D11 texture of DXGI_FORMAT_B8G8R8A8_UNORM or R8G8B8A8_UNORM pixels shared as an NT handle (`IDXGIResource1::CreateSharedHandle`), one mip and one array layer. /// -/// The import cache keys on the handle value: keep one handle open per texture while sending frames from it. The D3D11 writes must be complete (flushed and finished) before the call, and the texture must not be written again until the coded picture comes back. +/// The import cache keys on `id`: give every texture its own, never reused ([`D3d11Pool`] does). The D3D11 writes must be complete (flushed and finished) before the call, and the texture must not be written again until the coded picture comes back. #[derive(Debug, Clone, Copy)] pub struct D3d11Texture<'a> { /// Shared NT handle of the texture; borrowed, not closed. pub handle: BorrowedHandle<'a>, + /// Identity of the texture, unique for the process lifetime. + pub id: u64, /// Width in pixels. pub width: u32, /// Height in pixels. @@ -69,7 +84,7 @@ pub fn d3d11_importable(gpu: &Gpu, bgr: bool) -> bool { #[derive(PartialEq, Eq)] struct Key { - handle: usize, + id: u64, width: u32, height: u32, bgr: bool, @@ -78,7 +93,7 @@ struct Key { impl Key { fn new(src: &D3d11Texture) -> Self { Key { - handle: src.handle.as_raw_handle() as usize, + id: src.id, width: src.width, height: src.height, bgr: src.bgr, @@ -225,3 +240,139 @@ impl ImportCache { } } } + +const POOL_SIZE: usize = 4; + +struct Shared { + texture: ID3D11Texture2D, + handle: OwnedHandle, + desc: D3D11_TEXTURE2D_DESC, + id: u64, +} + +static NEXT_ID: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); + +/// Copies frames (a Windows.Graphics.Capture surface, for one) into a ring of shared NT-handle textures the encoder imports. +/// +/// Call [`D3d11Pool::submit`] on the thread that owns the device's immediate context, such as the capture callback. +pub struct D3d11Pool { + device: ID3D11Device, + context: ID3D11DeviceContext, + query: ID3D11Query, + ring: Vec, + next: usize, +} + +fn d3d(e: windows::core::Error, call: &str) -> Error { + Error::Invalid(format!("{call}: {e}")) +} + +impl D3d11Pool { + /// A pool on the device that produces the frames. + pub fn new(device: &ID3D11Device) -> Result { + let context = unsafe { device.GetImmediateContext() }.map_err(|e| d3d(e, "GetImmediateContext"))?; + let desc = D3D11_QUERY_DESC { + Query: D3D11_QUERY_EVENT, + MiscFlags: 0, + }; + let mut query = None; + unsafe { device.CreateQuery(&desc, Some(&mut query)) }.map_err(|e| d3d(e, "CreateQuery"))?; + let query = query.ok_or_else(|| Error::Invalid("CreateQuery returned no query".into()))?; + Ok(D3d11Pool { + device: device.clone(), + context, + query, + ring: Vec::new(), + next: 0, + }) + } + + /// Copies `frame` (B8G8R8A8 or R8G8B8A8, one mip, one layer, not multisampled) into the next shared texture and waits for the copy to finish. The result stays valid until the pool hands out the same texture again, [`POOL_SIZE`] calls later. + pub fn submit(&mut self, frame: &ID3D11Texture2D) -> Result, Error> { + let mut src = D3D11_TEXTURE2D_DESC::default(); + unsafe { frame.GetDesc(&mut src) }; + let bgr = match src.Format { + DXGI_FORMAT_B8G8R8A8_UNORM => true, + DXGI_FORMAT_R8G8B8A8_UNORM => false, + _ => return Err(Error::Unsupported(format!("D3D11 frame format {}", src.Format.0))), + }; + if src.MipLevels != 1 || src.ArraySize != 1 || src.SampleDesc.Count != 1 { + return Err(Error::Invalid("D3D11 frame must have one mip, one layer, one sample".into())); + } + let desc = D3D11_TEXTURE2D_DESC { + Width: src.Width, + Height: src.Height, + MipLevels: 1, + ArraySize: 1, + Format: src.Format, + SampleDesc: DXGI_SAMPLE_DESC { + Count: 1, + Quality: 0, + }, + Usage: D3D11_USAGE_DEFAULT, + BindFlags: (D3D11_BIND_SHADER_RESOURCE.0 | D3D11_BIND_RENDER_TARGET.0) as u32, + CPUAccessFlags: 0, + MiscFlags: (D3D11_RESOURCE_MISC_SHARED.0 | D3D11_RESOURCE_MISC_SHARED_NTHANDLE.0) as u32, + }; + let k = self.next; + self.next = (k + 1) % POOL_SIZE; + if self.ring.get(k).is_none_or(|s| s.desc != desc) { + let shared = self.shared(&desc)?; + if k < self.ring.len() { + self.ring[k] = shared; + } else { + self.ring.push(shared); + } + } + let shared = &self.ring[k]; + let mut done = windows::core::BOOL(0); + unsafe { + self.context.CopyResource(&shared.texture, frame); + self.context.End(&self.query); + self.context.Flush(); + while done.0 == 0 { + self.context + .GetData( + &self.query, + Some((&raw mut done).cast()), + size_of::() as u32, + 0, + ) + .map_err(|e| d3d(e, "GetData"))?; + if done.0 == 0 { + std::thread::yield_now(); + } + } + } + Ok(D3d11Texture { + handle: shared.handle.as_handle(), + id: shared.id, + width: src.Width, + height: src.Height, + bgr, + }) + } + + fn shared(&self, desc: &D3D11_TEXTURE2D_DESC) -> Result { + let mut texture = None; + unsafe { self.device.CreateTexture2D(desc, None, Some(&mut texture)) } + .map_err(|e| d3d(e, "CreateTexture2D"))?; + let texture = texture.ok_or_else(|| Error::Invalid("CreateTexture2D returned no texture".into()))?; + let resource: IDXGIResource1 = texture.cast().map_err(|e| d3d(e, "IDXGIResource1"))?; + let raw = unsafe { + resource.CreateSharedHandle( + None, + DXGI_SHARED_RESOURCE_READ.0 | DXGI_SHARED_RESOURCE_WRITE.0, + PCWSTR::null(), + ) + } + .map_err(|e| d3d(e, "CreateSharedHandle"))?; + let handle = unsafe { OwnedHandle::from_raw_handle(raw.0) }; + Ok(Shared { + texture, + handle, + desc: *desc, + id: NEXT_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed), + }) + } +} diff --git a/shims/vk-video-ffi/src/h264_encode.rs b/shims/vk-video-ffi/src/h264_encode.rs index 0a935ade..32247751 100644 --- a/shims/vk-video-ffi/src/h264_encode.rs +++ b/shims/vk-video-ffi/src/h264_encode.rs @@ -406,7 +406,7 @@ impl H264EncodeSession { self.enc.flush_last() } - /// Number of D3D11 texture imports made so far; a texture re-used by handle is imported once. + /// Number of D3D11 texture imports made so far; a texture re-used by id is imported once. #[cfg(windows)] pub fn d3d11_imports(&self) -> usize { self.enc.import_count() diff --git a/shims/vk-video-ffi/src/h265_encode.rs b/shims/vk-video-ffi/src/h265_encode.rs index 2ef85b6b..ff2b34de 100644 --- a/shims/vk-video-ffi/src/h265_encode.rs +++ b/shims/vk-video-ffi/src/h265_encode.rs @@ -351,7 +351,7 @@ impl H265EncodeSession { self.enc.flush_last() } - /// Number of D3D11 texture imports made so far; a texture re-used by handle is imported once. + /// Number of D3D11 texture imports made so far; a texture re-used by id is imported once. #[cfg(windows)] pub fn d3d11_imports(&self) -> usize { self.enc.import_count() diff --git a/shims/vk-video-ffi/src/lib.rs b/shims/vk-video-ffi/src/lib.rs index 3a8885e8..f7a16572 100644 --- a/shims/vk-video-ffi/src/lib.rs +++ b/shims/vk-video-ffi/src/lib.rs @@ -30,7 +30,9 @@ pub use av1_decode::{ pub use av1_encode::{Av1EncodeConfig, Av1EncodeSession, Av1Picture, Av1Ref}; pub use session::DPB_SLOTS; #[cfg(windows)] -pub use d3d11::{D3d11Texture, d3d11_importable}; +pub use d3d11::{D3d11Pool, D3d11Texture, d3d11_importable}; +#[cfg(windows)] +pub use windows; #[cfg(target_os = "linux")] pub use dmabuf::{DmaBuf, DmaBufExport, DmaBufFormat, DmaBufPlane, dup_raw_fd, read_dmabuf, rgb_import_modifiers}; pub use vp9_decode::{