Skip to content

Commit

Permalink
Merge pull request #717 from jaytaph/dependafix
Browse files Browse the repository at this point in the history
Dependafix
  • Loading branch information
Sharktheone authored Dec 16, 2024
2 parents 2a2f7ba + e1e91c5 commit 4755e6e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 63 deletions.
70 changes: 25 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/gosub_vello/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ vello_encoding = "0.3.0"
image = "0.25.5"
smallvec = "1.13.2"
anyhow = "1.0.94"
wgpu = "22.1.0"
raw-window-handle = "0.6.2"
futures = "0.3.31"
vello_svg = { version = "0.5.0", optional = true }
Expand Down
6 changes: 3 additions & 3 deletions crates/gosub_vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ impl RenderBackend for VelloBackend {
data: &mut Self::WindowData<'_>,
size: SizeU32,
) -> Result<Self::ActiveWindowData<'a>> {
let surface = data
.adapter
.create_surface(handle, size.width, size.height, wgpu::PresentMode::AutoVsync)?;
let surface =
data.adapter
.create_surface(handle, size.width, size.height, vello::wgpu::PresentMode::AutoVsync)?;

let renderer = data.adapter.create_renderer(Some(surface.config.format))?;

Expand Down
29 changes: 15 additions & 14 deletions crates/gosub_vello/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ use std::num::NonZeroUsize;
use std::sync::Arc;

use anyhow::anyhow;
use vello::{AaSupport, Renderer as VelloRenderer, RendererOptions as VelloRendererOptions};
use wgpu::util::{
use vello::wgpu::util::{
backend_bits_from_env, dx12_shader_compiler_from_env, gles_minor_version_from_env, power_preference_from_env,
};
use wgpu::{
Adapter, Backends, CompositeAlphaMode, Device, Dx12Compiler, Gles3MinorVersion, Instance, InstanceDescriptor,
PowerPreference, Queue, Surface, SurfaceConfiguration, TextureFormat,
use vello::wgpu::{
Adapter, Backends, CompositeAlphaMode, Dx12Compiler, Gles3MinorVersion, Instance, InstanceDescriptor,
PowerPreference, Queue, Surface, SurfaceConfiguration,
};
use vello::wgpu::{Device, TextureFormat};
use vello::{AaSupport, Renderer as VelloRenderer, RendererOptions as VelloRendererOptions};

use gosub_shared::render_backend::WindowHandle;
use gosub_shared::types::Result;
Expand Down Expand Up @@ -154,7 +155,7 @@ impl Renderer {

if adapter.is_none() {
adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
.request_adapter(&vello::wgpu::RequestAdapterOptions {
power_preference: config.power_preference,
force_fallback_adapter: false,
compatible_surface: None,
Expand All @@ -164,7 +165,7 @@ impl Renderer {

if adapter.is_none() {
adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
.request_adapter(&vello::wgpu::RequestAdapterOptions {
power_preference: config.power_preference,
force_fallback_adapter: true,
compatible_surface: None,
Expand All @@ -178,16 +179,16 @@ impl Renderer {

let mut features = adapter.features();

if info.device_type == wgpu::DeviceType::DiscreteGpu {
features -= wgpu::Features::MAPPABLE_PRIMARY_BUFFERS;
if info.device_type == vello::wgpu::DeviceType::DiscreteGpu {
features -= vello::wgpu::Features::MAPPABLE_PRIMARY_BUFFERS;
}

features -= wgpu::Features::RAY_QUERY;
features -= wgpu::Features::RAY_TRACING_ACCELERATION_STRUCTURE;
features -= vello::wgpu::Features::RAY_QUERY;
features -= vello::wgpu::Features::RAY_TRACING_ACCELERATION_STRUCTURE;

let (device, queue) = adapter
.request_device(
&wgpu::DeviceDescriptor {
&vello::wgpu::DeviceDescriptor {
label: None,
required_features: Default::default(),
required_limits: Default::default(),
Expand Down Expand Up @@ -224,7 +225,7 @@ impl InstanceAdapter {
window: impl WindowHandle + 'a,
width: u32,
height: u32,
present_mode: wgpu::PresentMode,
present_mode: vello::wgpu::PresentMode,
) -> Result<SurfaceWrapper<'a>> {
let surface = self.instance.create_surface(window)?;
let capabilities = surface.get_capabilities(&self.adapter);
Expand All @@ -235,7 +236,7 @@ impl InstanceAdapter {
.ok_or(anyhow!("surface should support Rgba8Unorm or Bgra8Unorm"))?;

let config = SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
usage: vello::wgpu::TextureUsages::RENDER_ATTACHMENT,
format,
width,
height,
Expand Down

0 comments on commit 4755e6e

Please sign in to comment.