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