Upgrade to wgpu 24 (#127)
This commit is contained in:
parent
7264e5f324
commit
bff018f6af
7 changed files with 23 additions and 15 deletions
|
@ -8,7 +8,7 @@ repository = "https://github.com/grovesNL/glyphon"
|
||||||
license = "MIT OR Apache-2.0 OR Zlib"
|
license = "MIT OR Apache-2.0 OR Zlib"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wgpu = { version = "23", default-features = false, features = ["wgsl"] }
|
wgpu = { version = "24", default-features = false, features = ["wgsl"] }
|
||||||
etagere = "0.2.10"
|
etagere = "0.2.10"
|
||||||
cosmic-text = "0.12"
|
cosmic-text = "0.12"
|
||||||
lru = { version = "0.12.1", default-features = false }
|
lru = { version = "0.12.1", default-features = false }
|
||||||
|
@ -16,7 +16,7 @@ rustc-hash = "2.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
winit = "0.30.3"
|
winit = "0.30.3"
|
||||||
wgpu = "23"
|
wgpu = "24"
|
||||||
resvg = { version = "0.44", default-features = false }
|
resvg = { version = "0.44", default-features = false }
|
||||||
pollster = "0.4.0"
|
pollster = "0.4.0"
|
||||||
criterion = { version = "0.5", features = ["html_reports"] }
|
criterion = { version = "0.5", features = ["html_reports"] }
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use wgpu::{BackendOptions, Dx12BackendOptions};
|
||||||
|
|
||||||
use pollster::block_on;
|
use pollster::block_on;
|
||||||
|
|
||||||
pub struct State {
|
pub struct State {
|
||||||
|
@ -7,11 +9,17 @@ pub struct State {
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||||
backends: wgpu::Backends::all(),
|
backends: wgpu::Backends::all(),
|
||||||
flags: wgpu::InstanceFlags::empty(),
|
flags: wgpu::InstanceFlags::empty(),
|
||||||
dx12_shader_compiler: wgpu::Dx12Compiler::Fxc,
|
backend_options: BackendOptions {
|
||||||
gles_minor_version: wgpu::Gles3MinorVersion::Automatic,
|
gl: wgpu::GlBackendOptions {
|
||||||
|
gles_minor_version: wgpu::Gles3MinorVersion::Automatic
|
||||||
|
},
|
||||||
|
dx12: Dx12BackendOptions {
|
||||||
|
shader_compiler: wgpu::Dx12Compiler::Fxc
|
||||||
|
},
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let adapter = block_on(wgpu::util::initialize_adapter_from_env_or_default(
|
let adapter = block_on(wgpu::util::initialize_adapter_from_env_or_default(
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl WindowState {
|
||||||
let scale_factor = window.scale_factor();
|
let scale_factor = window.scale_factor();
|
||||||
|
|
||||||
// Set up surface
|
// Set up surface
|
||||||
let instance = Instance::new(InstanceDescriptor::default());
|
let instance = Instance::new(&InstanceDescriptor::default());
|
||||||
let adapter = instance
|
let adapter = instance
|
||||||
.request_adapter(&RequestAdapterOptions::default())
|
.request_adapter(&RequestAdapterOptions::default())
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl WindowState {
|
||||||
let scale_factor = window.scale_factor();
|
let scale_factor = window.scale_factor();
|
||||||
|
|
||||||
// Set up surface
|
// Set up surface
|
||||||
let instance = Instance::new(InstanceDescriptor::default());
|
let instance = Instance::new(&InstanceDescriptor::default());
|
||||||
let adapter = instance
|
let adapter = instance
|
||||||
.request_adapter(&RequestAdapterOptions::default())
|
.request_adapter(&RequestAdapterOptions::default())
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl WindowState {
|
||||||
let scale_factor = window.scale_factor() as f32;
|
let scale_factor = window.scale_factor() as f32;
|
||||||
|
|
||||||
// Set up surface
|
// Set up surface
|
||||||
let instance = Instance::new(InstanceDescriptor::default());
|
let instance = Instance::new(&InstanceDescriptor::default());
|
||||||
let adapter = instance
|
let adapter = instance
|
||||||
.request_adapter(&RequestAdapterOptions::default())
|
.request_adapter(&RequestAdapterOptions::default())
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -7,7 +7,7 @@ use lru::LruCache;
|
||||||
use rustc_hash::FxHasher;
|
use rustc_hash::FxHasher;
|
||||||
use std::{collections::HashSet, hash::BuildHasherDefault, sync::Arc};
|
use std::{collections::HashSet, hash::BuildHasherDefault, sync::Arc};
|
||||||
use wgpu::{
|
use wgpu::{
|
||||||
BindGroup, DepthStencilState, Device, Extent3d, ImageCopyTexture, ImageDataLayout,
|
BindGroup, DepthStencilState, Device, Extent3d, TexelCopyTextureInfo, TexelCopyBufferLayout,
|
||||||
MultisampleState, Origin3d, Queue, RenderPipeline, Texture, TextureAspect, TextureDescriptor,
|
MultisampleState, Origin3d, Queue, RenderPipeline, Texture, TextureAspect, TextureDescriptor,
|
||||||
TextureDimension, TextureFormat, TextureUsages, TextureView, TextureViewDescriptor,
|
TextureDimension, TextureFormat, TextureUsages, TextureView, TextureViewDescriptor,
|
||||||
};
|
};
|
||||||
|
@ -186,7 +186,7 @@ impl InnerAtlas {
|
||||||
};
|
};
|
||||||
|
|
||||||
queue.write_texture(
|
queue.write_texture(
|
||||||
ImageCopyTexture {
|
TexelCopyTextureInfo {
|
||||||
texture: &self.texture,
|
texture: &self.texture,
|
||||||
mip_level: 0,
|
mip_level: 0,
|
||||||
origin: Origin3d {
|
origin: Origin3d {
|
||||||
|
@ -197,7 +197,7 @@ impl InnerAtlas {
|
||||||
aspect: TextureAspect::All,
|
aspect: TextureAspect::All,
|
||||||
},
|
},
|
||||||
&image_data,
|
&image_data,
|
||||||
ImageDataLayout {
|
TexelCopyBufferLayout {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
bytes_per_row: Some(width as u32 * self.kind.num_channels() as u32),
|
bytes_per_row: Some(width as u32 * self.kind.num_channels() as u32),
|
||||||
rows_per_image: None,
|
rows_per_image: None,
|
||||||
|
|
|
@ -6,8 +6,8 @@ use crate::{
|
||||||
use cosmic_text::{Color, SubpixelBin};
|
use cosmic_text::{Color, SubpixelBin};
|
||||||
use std::{slice, sync::Arc};
|
use std::{slice, sync::Arc};
|
||||||
use wgpu::{
|
use wgpu::{
|
||||||
Buffer, BufferDescriptor, BufferUsages, DepthStencilState, Device, Extent3d, ImageCopyTexture,
|
Buffer, BufferDescriptor, BufferUsages, DepthStencilState, Device, Extent3d, TexelCopyTextureInfo,
|
||||||
ImageDataLayout, MultisampleState, Origin3d, Queue, RenderPass, RenderPipeline, TextureAspect,
|
TexelCopyBufferLayout, MultisampleState, Origin3d, Queue, RenderPass, RenderPipeline, TextureAspect,
|
||||||
COPY_BUFFER_ALIGNMENT,
|
COPY_BUFFER_ALIGNMENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ where
|
||||||
let atlas_min = allocation.rectangle.min;
|
let atlas_min = allocation.rectangle.min;
|
||||||
|
|
||||||
queue.write_texture(
|
queue.write_texture(
|
||||||
ImageCopyTexture {
|
TexelCopyTextureInfo {
|
||||||
texture: &inner.texture,
|
texture: &inner.texture,
|
||||||
mip_level: 0,
|
mip_level: 0,
|
||||||
origin: Origin3d {
|
origin: Origin3d {
|
||||||
|
@ -479,7 +479,7 @@ where
|
||||||
aspect: TextureAspect::All,
|
aspect: TextureAspect::All,
|
||||||
},
|
},
|
||||||
&image.data,
|
&image.data,
|
||||||
ImageDataLayout {
|
TexelCopyBufferLayout {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
bytes_per_row: Some(image.width as u32 * inner.num_channels() as u32),
|
bytes_per_row: Some(image.width as u32 * inner.num_channels() as u32),
|
||||||
rows_per_image: None,
|
rows_per_image: None,
|
||||||
|
|
Loading…
Reference in a new issue