Desktop: Add rudimentary support for custom WGPU adapter selection (#3201)

* rudimentary custom wgpu adapter selection

* WgpuContextBuilder

* wasm fix

* fix wasm warnings

* Clean up

* Review suggestions

* fix
This commit is contained in:
Timon
2025-09-25 14:38:26 +00:00
committed by GitHub
parent 4e47b5db93
commit ed22e6a63d
8 changed files with 181 additions and 54 deletions

View File

@@ -4,7 +4,6 @@ pub mod texture_upload;
use crate::shader_runtime::ShaderRuntime;
use anyhow::Result;
pub use context::Context;
use dyn_any::StaticType;
use futures::lock::Mutex;
use glam::UVec2;
@@ -16,9 +15,14 @@ use vello::{AaConfig, AaSupport, RenderParams, Renderer, RendererOptions, Scene}
use wgpu::util::TextureBlitter;
use wgpu::{Origin3d, SurfaceConfiguration, TextureAspect};
pub use context::Context as WgpuContext;
pub use context::ContextBuilder as WgpuContextBuilder;
pub use wgpu::Backends as WgpuBackends;
pub use wgpu::Features as WgpuFeatures;
#[derive(dyn_any::DynAny)]
pub struct WgpuExecutor {
pub context: Context,
pub context: WgpuContext,
vello_renderer: Mutex<Renderer>,
pub shader_runtime: ShaderRuntime,
}
@@ -182,10 +186,10 @@ impl WgpuExecutor {
impl WgpuExecutor {
pub async fn new() -> Option<Self> {
Self::with_context(Context::new().await?)
Self::with_context(WgpuContext::new().await?)
}
pub fn with_context(context: Context) -> Option<Self> {
pub fn with_context(context: WgpuContext) -> Option<Self> {
let vello_renderer = Renderer::new(
&context.device,
RendererOptions {