The Android develop view reads its frame back through memory (TD-1) because wgpu's Vulkan swapchain never pre-rotates, and a portrait window on this tablet's landscape panel then tears. The fix is a small patch to each of these two crates, and this commit is only the ground it lands on: both are byte-for-byte the crates.io sources the lockfile already resolved, so the commits that follow are the patch and nothing else. third_party/ is excluded from the workspace, or every path dependency under the root would become a member and `--workspace` would test and lint upstream code as ours. The README says how to carry the patches across a Slint or wgpu bump, which matters because a stale version here does not fail the build — cargo just warns and uses the unpatched crate.
57 lines
1.8 KiB
Rust
57 lines
1.8 KiB
Rust
use alloc::{boxed::Box, vec::Vec};
|
|
|
|
use crate::{
|
|
DeviceError, DynCommandBuffer, DynFence, DynResource, DynSurface, DynSurfaceTexture,
|
|
FenceValue, Queue, SurfaceError,
|
|
};
|
|
|
|
use super::DynResourceExt as _;
|
|
|
|
pub trait DynQueue: DynResource {
|
|
unsafe fn submit(
|
|
&self,
|
|
command_buffers: &[&dyn DynCommandBuffer],
|
|
surface_textures: &[&dyn DynSurfaceTexture],
|
|
signal_fence: (&mut dyn DynFence, FenceValue),
|
|
) -> Result<(), DeviceError>;
|
|
unsafe fn present(
|
|
&self,
|
|
surface: &dyn DynSurface,
|
|
texture: Box<dyn DynSurfaceTexture>,
|
|
) -> Result<(), SurfaceError>;
|
|
unsafe fn get_timestamp_period(&self) -> f32;
|
|
}
|
|
|
|
impl<Q: Queue + DynResource> DynQueue for Q {
|
|
unsafe fn submit(
|
|
&self,
|
|
command_buffers: &[&dyn DynCommandBuffer],
|
|
surface_textures: &[&dyn DynSurfaceTexture],
|
|
signal_fence: (&mut dyn DynFence, FenceValue),
|
|
) -> Result<(), DeviceError> {
|
|
let command_buffers = command_buffers
|
|
.iter()
|
|
.map(|cb| (*cb).expect_downcast_ref())
|
|
.collect::<Vec<_>>();
|
|
let surface_textures = surface_textures
|
|
.iter()
|
|
.map(|surface| (*surface).expect_downcast_ref())
|
|
.collect::<Vec<_>>();
|
|
let signal_fence = (signal_fence.0.expect_downcast_mut(), signal_fence.1);
|
|
unsafe { Q::submit(self, &command_buffers, &surface_textures, signal_fence) }
|
|
}
|
|
|
|
unsafe fn present(
|
|
&self,
|
|
surface: &dyn DynSurface,
|
|
texture: Box<dyn DynSurfaceTexture>,
|
|
) -> Result<(), SurfaceError> {
|
|
let surface = surface.expect_downcast_ref();
|
|
unsafe { Q::present(self, surface, texture.unbox()) }
|
|
}
|
|
|
|
unsafe fn get_timestamp_period(&self) -> f32 {
|
|
unsafe { Q::get_timestamp_period(self) }
|
|
}
|
|
}
|