From b6b0928087c61200e2969812f667da099818674d Mon Sep 17 00:00:00 2001 From: iris <2+iris@noreply.localhost> Date: Fri, 4 Sep 2026 17:47:44 -0400 Subject: [PATCH] Take winit out of iris-core, which makes it build for Android iris-core wanted exactly one thing from winit: PhysicalSize 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` 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 --- iris/Cargo.lock | 1 - iris/core/Cargo.toml | 1 - iris/core/src/render/mod.rs | 14 +++++++++----- iris/src/default/render.rs | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/iris/Cargo.lock b/iris/Cargo.lock index 0796ff1..78e9db3 100644 --- a/iris/Cargo.lock +++ b/iris/Cargo.lock @@ -1070,7 +1070,6 @@ dependencies = [ "fxhash", "image", "wgpu", - "winit", ] [[package]] diff --git a/iris/core/Cargo.toml b/iris/core/Cargo.toml index a85a26d..71edca5 100644 --- a/iris/core/Cargo.toml +++ b/iris/core/Cargo.toml @@ -4,7 +4,6 @@ version.workspace = true edition.workspace = true [dependencies] -winit = { workspace = true } wgpu = { workspace = true } bytemuck ={ workspace = true } image = { workspace = true } diff --git a/iris/core/src/render/mod.rs b/iris/core/src/render/mod.rs index 1695efa..0489ab5 100644 --- a/iris/core/src/render/mod.rs +++ b/iris/core/src/render/mod.rs @@ -3,14 +3,13 @@ use std::num::NonZero; use crate::{ UiData, UiRenderState, render::{data::PrimitiveInstance, texture::GpuTextures, util::ArrBuf}, - util::HashMap, + util::{HashMap, Vec2}, }; use data::WindowUniform; use wgpu::{ util::{BufferInitDescriptor, DeviceExt}, *, }; -use winit::dpi::PhysicalSize; mod data; mod primitive; @@ -118,10 +117,15 @@ impl UiRenderNode { } } - pub fn resize(&mut self, size: &PhysicalSize, 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, queue: &Queue) { + let size = size.into(); let slice = &[WindowUniform { - width: size.width as f32, - height: size.height as f32, + width: size.x, + height: size.y, }]; queue.write_buffer(&self.window_buffer, 0, bytemuck::cast_slice(slice)); } diff --git a/iris/src/default/render.rs b/iris/src/default/render.rs index 625a9fa..970d44c 100644 --- a/iris/src/default/render.rs +++ b/iris/src/default/render.rs @@ -52,7 +52,7 @@ impl UiRenderer { self.config.width = size.width; self.config.height = size.height; 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 {