Take winit out of iris-core, which makes it build for Android
iris-core wanted exactly one thing from winit: PhysicalSize<u32> in UiRenderNode::resize's signature, for two numbers it immediately turned into floats. That pulled a whole windowing backend into the layer below it. `resize` takes `impl Into<Vec2>` now, matching UiRenderState::resize beside it. The consequence is the reason: with winit in the graph, an Android build of the core failed in android-activity, which needs a backend feature nothing here selects and which iris should not be going through at all -- the plan is android-view. Without it, `cargo ndk -t arm64-v8a -P 26 build -p iris-core` produces an rlib in 30s with wgpu's Android backend included. So the widget, layout and render core already builds for the phone, and what remains is the surface, the input and the IME. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
12221ea025
commit
b6b0928087
4 files changed
+10
-8
No files matched your search
Generated
-1
@@ -1070,7 +1070,6 @@ dependencies = [
|
|||||||
"fxhash",
|
"fxhash",
|
||||||
"image",
|
"image",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
"winit",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ version.workspace = true
|
|||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
winit = { workspace = true }
|
|
||||||
wgpu = { workspace = true }
|
wgpu = { workspace = true }
|
||||||
bytemuck ={ workspace = true }
|
bytemuck ={ workspace = true }
|
||||||
image = { workspace = true }
|
image = { workspace = true }
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ use std::num::NonZero;
|
|||||||
use crate::{
|
use crate::{
|
||||||
UiData, UiRenderState,
|
UiData, UiRenderState,
|
||||||
render::{data::PrimitiveInstance, texture::GpuTextures, util::ArrBuf},
|
render::{data::PrimitiveInstance, texture::GpuTextures, util::ArrBuf},
|
||||||
util::HashMap,
|
util::{HashMap, Vec2},
|
||||||
};
|
};
|
||||||
use data::WindowUniform;
|
use data::WindowUniform;
|
||||||
use wgpu::{
|
use wgpu::{
|
||||||
util::{BufferInitDescriptor, DeviceExt},
|
util::{BufferInitDescriptor, DeviceExt},
|
||||||
*,
|
*,
|
||||||
};
|
};
|
||||||
use winit::dpi::PhysicalSize;
|
|
||||||
|
|
||||||
mod data;
|
mod data;
|
||||||
mod primitive;
|
mod primitive;
|
||||||
@@ -118,10 +117,15 @@ impl UiRenderNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resize(&mut self, size: &PhysicalSize<u32>, queue: &Queue) {
|
/// Takes a size rather than a window type: this is the only thing the
|
||||||
|
/// core wanted from winit, and depending on a windowing backend for two
|
||||||
|
/// numbers is what put `android-activity` in the core's graph for an
|
||||||
|
/// Android build that is meant to go through android-view instead.
|
||||||
|
pub fn resize(&mut self, size: impl Into<Vec2>, queue: &Queue) {
|
||||||
|
let size = size.into();
|
||||||
let slice = &[WindowUniform {
|
let slice = &[WindowUniform {
|
||||||
width: size.width as f32,
|
width: size.x,
|
||||||
height: size.height as f32,
|
height: size.y,
|
||||||
}];
|
}];
|
||||||
queue.write_buffer(&self.window_buffer, 0, bytemuck::cast_slice(slice));
|
queue.write_buffer(&self.window_buffer, 0, bytemuck::cast_slice(slice));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ impl UiRenderer {
|
|||||||
self.config.width = size.width;
|
self.config.width = size.width;
|
||||||
self.config.height = size.height;
|
self.config.height = size.height;
|
||||||
self.surface.configure(&self.device, &self.config);
|
self.surface.configure(&self.device, &self.config);
|
||||||
self.ui.resize(size, &self.queue);
|
self.ui.resize((size.width, size.height), &self.queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_encoder(device: &Device) -> CommandEncoder {
|
fn create_encoder(device: &Device) -> CommandEncoder {
|
||||||
|
|||||||
Reference in new issue
Block a user