updated the dependencies - maintaining compatibility and tests (#4363)

* Update dependencies in Cargo.lock

* added in the missing bevy example which was included in recent merge

* undo unneccessary library installation in gh actions

* cleaned up further

* Update dependencies in Cargo.toml and Cargo.lock askana_escape to 0.13

* updated code to make tests work

* updated the wgpu texture example

* replaced all direct reference with use

* fixed wgpu and jsframework errors in benches and examples

* Fix: Import black_box from std::hint

* grand finale upgrade

* updated cargo.lock

* Bump hyper-util to 0.1.15 and plist to 1.7.4

* remove some unused swc dependencies and add a command to update them in the future

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-07-14 13:03:40 -07:00
1 parent 93147587b8
commit c5b33924ae
27 files changed
+774 -963

No files matched your search

+2 -2
View File
@@ -15,8 +15,8 @@ dioxus-cli-config = { workspace = true, optional = true }
axum = { workspace = true, optional = true }
tokio = { workspace = true, features = ["full"], optional = true }
tower-http = { workspace = true, features = ["auth"], optional = true }
async-trait = { version = "0.1.71", optional = true }
sqlx = { version = "0.8.2", features = [
async-trait = { version = "0.1.88", optional = true }
sqlx = { version = "0.8.6", features = [
"macros",
"migrate",
"postgres",
+2 -2
View File
@@ -7,7 +7,7 @@
//! If you `go-to-definition` on the `svg` element, you'll see its custom namespace.
use dioxus::prelude::*;
use rand::{thread_rng, Rng};
use rand::{rng, Rng};
fn main() {
dioxus::launch(|| {
@@ -42,7 +42,7 @@ fn Dice() -> Element {
view_box: "-1000 -1000 2000 2000",
onclick: move |event| {
event.prevent_default();
value.set(thread_rng().gen_range(1..=6))
value.set(rng().random_range(1..=6))
},
rect { x: -1000, y: -1000, width: 2000, height: 2000, rx: 200, fill: "#aaa" }
for ((x, y), _) in DOTS.iter().zip(active_dots.read().iter()).filter(|(_, &active)| active) {
+44 -41
View File
@@ -4,7 +4,13 @@ use crate::Color;
use dioxus_native::{CustomPaintCtx, CustomPaintSource, DeviceHandle, TextureHandle};
use std::sync::mpsc::{channel, Receiver, Sender};
use std::time::Instant;
use wgpu::Instance;
use wgpu::{
CommandEncoderDescriptor, Device, Extent3d, FragmentState, Instance, LoadOp, MultisampleState,
Operations, PipelineLayoutDescriptor, PrimitiveState, PushConstantRange, Queue,
RenderPassColorAttachment, RenderPassDescriptor, RenderPipeline, RenderPipelineDescriptor,
ShaderModuleDescriptor, ShaderSource, ShaderStages, StoreOp, Texture, TextureDescriptor,
TextureDimension, TextureFormat, TextureUsages, TextureViewDescriptor, VertexState,
};
pub struct DemoPaintSource {
state: DemoRendererState,
@@ -16,8 +22,10 @@ pub struct DemoPaintSource {
impl CustomPaintSource for DemoPaintSource {
fn resume(&mut self, _instance: &Instance, device_handle: &DeviceHandle) {
// TODO: work out what to do about width/height
let active_state = ActiveDemoRenderer::new(device_handle);
// Extract device and queue from device_handle
let device = &device_handle.device;
let queue = &device_handle.queue;
let active_state = ActiveDemoRenderer::new(device, queue);
self.state = DemoRendererState::Active(Box::new(active_state));
}
@@ -49,14 +57,14 @@ enum DemoRendererState {
#[derive(Clone)]
struct TextureAndHandle {
texture: wgpu::Texture,
texture: Texture,
handle: TextureHandle,
}
struct ActiveDemoRenderer {
device: wgpu::Device,
queue: wgpu::Queue,
pipeline: wgpu::RenderPipeline,
device: Device,
queue: Queue,
pipeline: RenderPipeline,
displayed_texture: Option<TextureAndHandle>,
next_texture: Option<TextureAndHandle>,
}
@@ -110,44 +118,39 @@ impl DemoPaintSource {
}
impl ActiveDemoRenderer {
pub(crate) fn new(device_handle: &DeviceHandle) -> Self {
let device = &device_handle.device;
let queue = &device_handle.queue;
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
pub(crate) fn new(device: &Device, queue: &Queue) -> Self {
let shader = device.create_shader_module(ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(include_str!(
"shader.wgsl"
))),
source: ShaderSource::Wgsl(std::borrow::Cow::Borrowed(include_str!("shader.wgsl"))),
});
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: None,
bind_group_layouts: &[],
push_constant_ranges: &[wgpu::PushConstantRange {
stages: wgpu::ShaderStages::FRAGMENT,
push_constant_ranges: &[PushConstantRange {
stages: ShaderStages::FRAGMENT,
range: 0..16, // full size in bytes, aligned
}],
});
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor {
label: None,
layout: Some(&pipeline_layout),
vertex: wgpu::VertexState {
vertex: VertexState {
module: &shader,
entry_point: Some("vs_main"),
buffers: &[],
compilation_options: Default::default(),
},
fragment: Some(wgpu::FragmentState {
fragment: Some(FragmentState {
module: &shader,
entry_point: Some("fs_main"),
compilation_options: Default::default(),
targets: &[Some(wgpu::TextureFormat::Rgba8Unorm.into())],
targets: &[Some(TextureFormat::Rgba8Unorm.into())],
}),
primitive: wgpu::PrimitiveState::default(),
primitive: PrimitiveState::default(),
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multisample: MultisampleState::default(),
multiview: None,
cache: None,
});
@@ -199,16 +202,16 @@ impl ActiveDemoRenderer {
let mut encoder = self
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
.create_command_encoder(&CommandEncoderDescriptor { label: None });
{
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
let mut rpass = encoder.begin_render_pass(&RenderPassDescriptor {
label: None,
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: &next_texture.create_view(&wgpu::TextureViewDescriptor::default()),
color_attachments: &[Some(RenderPassColorAttachment {
view: &next_texture.create_view(&TextureViewDescriptor::default()),
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::GREEN),
store: wgpu::StoreOp::Store,
ops: Operations {
load: LoadOp::Clear(wgpu::Color::GREEN),
store: StoreOp::Store,
},
})],
depth_stencil_attachment: None,
@@ -217,8 +220,8 @@ impl ActiveDemoRenderer {
});
rpass.set_pipeline(&self.pipeline);
rpass.set_push_constants(
wgpu::ShaderStages::FRAGMENT, // Stage (your constants are for fragment shader)
0, // Offset in bytes (start at 0)
ShaderStages::FRAGMENT, // Stage (your constants are for fragment shader)
0, // Offset in bytes (start at 0)
bytemuck::bytes_of(&push_constants),
);
rpass.draw(0..3, 0..1);
@@ -237,21 +240,21 @@ struct PushConstants {
light_color_and_time: [f32; 4],
}
fn create_texture(device: &wgpu::Device, width: u32, height: u32) -> wgpu::Texture {
device.create_texture(&wgpu::TextureDescriptor {
fn create_texture(device: &Device, width: u32, height: u32) -> Texture {
device.create_texture(&TextureDescriptor {
label: None,
size: wgpu::Extent3d {
size: Extent3d {
width,
height,
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8Unorm,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT
| wgpu::TextureUsages::TEXTURE_BINDING
| wgpu::TextureUsages::COPY_SRC,
dimension: TextureDimension::D2,
format: TextureFormat::Rgba8Unorm,
usage: TextureUsages::RENDER_ATTACHMENT
| TextureUsages::TEXTURE_BINDING
| TextureUsages::COPY_SRC,
view_formats: &[],
})
}
+6 -2
View File
@@ -124,6 +124,7 @@ impl<'a> GraphicsResources<'a> {
// Make sure we use the texture resolution limits from the adapter, so we can support images the size of the swapchain.
required_limits: wgpu::Limits::downlevel_webgl2_defaults()
.using_resolution(adapter.limits()),
memory_hints: wgpu::MemoryHints::default(),
},
None,
)
@@ -165,18 +166,21 @@ fn fs_main() -> @location(0) vec4<f32> {
layout: Some(&pipeline_layout),
vertex: wgpu::VertexState {
module: &shader,
entry_point: "vs_main",
entry_point: Some("vs_main"),
buffers: &[],
compilation_options: wgpu::PipelineCompilationOptions::default(),
},
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "fs_main",
entry_point: Some("fs_main"),
targets: &[Some(swapchain_format.into())],
compilation_options: wgpu::PipelineCompilationOptions::default(),
}),
primitive: wgpu::PrimitiveState::default(),
depth_stencil: None,
multisample: wgpu::MultisampleState::default(),
multiview: None,
cache: None,
});
let config = wgpu::SurfaceConfiguration {