Let a wgpu-hal caller choose the Vulkan swapchain's preTransform
wgpu-hal creates every swapchain with `preTransform = IDENTITY` (#3345). On a tablet whose panel is mounted landscape, a portrait window then hands Android an unrotated buffer: SurfaceFlinger falls back to rotating it on the GPU (composition CLIENT), and on this device those frames tear. That is why Android draws with Skia over OpenGL today, and why the develop view pays a readback (TD-1). The field cannot just be set to `currentTransform` inside wgpu. It is a promise that the image is already drawn rotated and sized in the panel's orientation, and only the renderer above wgpu can keep it. So the patch is the smallest thing that lets that renderer ask: `vulkan::Surface::current_transform` reads the surface's transform, and `set_pre_transform` makes the next swapchain use it. The default stays IDENTITY, so desktop and any caller that does not opt in behave exactly as upstream.
This commit is contained in:
Vendored
+18
-1
@@ -28,7 +28,24 @@ upstream change would make it unnecessary.
|
||||
|
||||
## wgpu-hal 29.0.4 — Vulkan pre-rotation on Android
|
||||
|
||||
*(patch lands in the next commit)*
|
||||
Upstream creates every Vulkan swapchain with `preTransform = IDENTITY`
|
||||
(`src/vulkan/swapchain/native.rs`, gfx-rs/wgpu#3345). On Android, a window
|
||||
whose orientation differs from the panel's is then rotated by the
|
||||
compositor on the GPU (`composition=CLIENT`), and on this tablet in
|
||||
portrait those frames tear.
|
||||
|
||||
The patch adds two methods to `wgpu_hal::vulkan::Surface`:
|
||||
|
||||
- `current_transform(&Adapter)` — the surface's `currentTransform`.
|
||||
- `set_pre_transform(transform)` — the `preTransform` for the next
|
||||
swapchain. Opt-in: nothing calls it but the Skia patch below, and the
|
||||
default is still `IDENTITY`, so desktop and every other caller behave
|
||||
exactly as upstream.
|
||||
|
||||
Setting it is a promise that the caller draws rotated into a swapchain
|
||||
sized in the panel's orientation; wgpu itself rotates nothing.
|
||||
|
||||
Unnecessary once wgpu exposes pre-rotation itself (#3345).
|
||||
|
||||
## i-slint-renderer-skia 1.17.1 — rotate the canvas to match
|
||||
|
||||
|
||||
Reference in New Issue
Block a user