Add a bevy-texture example based on wgpu-texture (#4360)
* Add a bevy-texture example based on wgpu-texture * Use git branch of Blitz * Update existing code to new blitz * Use Device from Dioxus for bevy * Use ManualTextureView Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix texture size on window resize * Clean code * Rename example to 'bevy-example' in 'bevy' directory * Upgrade to blitz 0.1.0-alpha.5 and anyrender 0.4 * Install alsa in CI Signed-off-by: Nico Burns <nico@nicoburns.com> * Add libudev to CI Signed-off-by: Nico Burns <nico@nicoburns.com> --------- Signed-off-by: Nico Burns <nico@nicoburns.com> Co-authored-by: Jerome Caucat <jerome.caucat@smartshape.com> Co-authored-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
14 files changed
+2426
-79
No files matched your search
@@ -1,10 +1,10 @@
|
||||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: MIT
|
||||
use crate::Color;
|
||||
use dioxus_native::{CustomPaintCtx, CustomPaintSource, TextureHandle};
|
||||
use dioxus_native::{CustomPaintCtx, CustomPaintSource, DeviceHandle, TextureHandle};
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::time::Instant;
|
||||
use wgpu::{Device, Queue};
|
||||
use wgpu::Instance;
|
||||
|
||||
pub struct DemoPaintSource {
|
||||
state: DemoRendererState,
|
||||
@@ -15,9 +15,9 @@ pub struct DemoPaintSource {
|
||||
}
|
||||
|
||||
impl CustomPaintSource for DemoPaintSource {
|
||||
fn resume(&mut self, device: &Device, queue: &Queue) {
|
||||
fn resume(&mut self, _instance: &Instance, device_handle: &DeviceHandle) {
|
||||
// TODO: work out what to do about width/height
|
||||
let active_state = ActiveDemoRenderer::new(device, queue);
|
||||
let active_state = ActiveDemoRenderer::new(device_handle);
|
||||
self.state = DemoRendererState::Active(Box::new(active_state));
|
||||
}
|
||||
|
||||
@@ -110,7 +110,10 @@ impl DemoPaintSource {
|
||||
}
|
||||
|
||||
impl ActiveDemoRenderer {
|
||||
pub(crate) fn new(device: &Device, queue: &Queue) -> Self {
|
||||
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 {
|
||||
label: None,
|
||||
source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(include_str!(
|
||||
|
||||
Reference in new issue
Block a user