wgpu: Bump to `0.14.0`
Also bump `raw-window-handle` to `0.5`, as now required.
This commit is contained in:
parent
dbfd28e708
commit
183b8adbf0
|
@ -633,12 +633,6 @@ version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b"
|
checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "copyless"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
|
@ -1981,12 +1975,6 @@ dependencies = [
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "inplace_it"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e567468c50f3d4bc7397702e09b380139f9b9288b4e909b070571007f8b5bf78"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "instant"
|
name = "instant"
|
||||||
version = "0.1.12"
|
version = "0.1.12"
|
||||||
|
@ -2394,9 +2382,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f50357e1167a3ab92d6b3c7f4bf5f7fd13fde3f4b28bf0d5ea07b5100fdb6c0"
|
checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-set",
|
"bit-set",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -3205,9 +3193,9 @@ checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ron"
|
name = "ron"
|
||||||
version = "0.7.1"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
|
checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -3364,7 +3352,7 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"ouroboros",
|
"ouroboros",
|
||||||
"raw-window-handle 0.4.3",
|
"raw-window-handle 0.5.0",
|
||||||
"ruffle_render",
|
"ruffle_render",
|
||||||
"swf",
|
"swf",
|
||||||
"typed-arena",
|
"typed-arena",
|
||||||
|
@ -4459,18 +4447,19 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu"
|
name = "wgpu"
|
||||||
version = "0.13.1"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "277e967bf8b7820a76852645a6bce8bbd31c32fda2042e82d8e3ea75fda8892d"
|
checksum = "c2272b17bffc8a0c7d53897435da7c1db587c87d3a14e8dae9cdb8d1d210fc0f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec 0.7.2",
|
"arrayvec 0.7.2",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"raw-window-handle 0.4.3",
|
"raw-window-handle 0.5.0",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
|
"static_assertions",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
|
@ -4481,22 +4470,21 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-core"
|
name = "wgpu-core"
|
||||||
version = "0.13.2"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89b92788dec9d0c1bed849a1b83f01b2ee12819bf04a79c90f68e4173f7b5ba2"
|
checksum = "73d14cad393054caf992ee02b7da6a372245d39a484f7461c1f44f6f6359bd28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec 0.7.2",
|
"arrayvec 0.7.2",
|
||||||
"bit-vec",
|
"bit-vec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"copyless",
|
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"profiling",
|
"profiling",
|
||||||
"raw-window-handle 0.4.3",
|
"raw-window-handle 0.5.0",
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
|
@ -4508,9 +4496,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-hal"
|
name = "wgpu-hal"
|
||||||
version = "0.13.2"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "20cbdfc3d0637dba3d5536b93adef3d26023a0b96f0e1ee5ee9560a401d9f646"
|
checksum = "cdae6a80dbc725343f02f854b310b37190be946aeea65e9d83afaa7d840ebaac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_system_properties",
|
"android_system_properties",
|
||||||
"arrayvec 0.7.2",
|
"arrayvec 0.7.2",
|
||||||
|
@ -4525,7 +4513,6 @@ dependencies = [
|
||||||
"glow",
|
"glow",
|
||||||
"gpu-alloc",
|
"gpu-alloc",
|
||||||
"gpu-descriptor",
|
"gpu-descriptor",
|
||||||
"inplace_it",
|
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"khronos-egl",
|
"khronos-egl",
|
||||||
"libloading",
|
"libloading",
|
||||||
|
@ -4536,8 +4523,9 @@ dependencies = [
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"profiling",
|
"profiling",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle 0.4.3",
|
"raw-window-handle 0.5.0",
|
||||||
"renderdoc-sys",
|
"renderdoc-sys",
|
||||||
|
"smallvec",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
|
@ -4547,9 +4535,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-types"
|
name = "wgpu-types"
|
||||||
version = "0.13.2"
|
version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1f762cbc08e1a51389859cf9c199c7aef544789cf3510889aab12c607f701604"
|
checksum = "28fb86c1909233c804aa79b7dd1ad06ebd979b2a465e3e980582db0ea9e69f3f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bitflags_serde_shim",
|
"bitflags_serde_shim",
|
||||||
|
|
|
@ -6,11 +6,11 @@ edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wgpu = "0.13.0"
|
wgpu = "0.14.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
ruffle_render = { path = "..", features = ["tessellator"] }
|
ruffle_render = { path = "..", features = ["tessellator"] }
|
||||||
bytemuck = { version = "1.12.1", features = ["derive"] }
|
bytemuck = { version = "1.12.1", features = ["derive"] }
|
||||||
raw-window-handle = "0.4"
|
raw-window-handle = "0.5"
|
||||||
clap = { version = "4.0.12", features = ["derive"], optional = true }
|
clap = { version = "4.0.12", features = ["derive"], optional = true }
|
||||||
enum-map = "2.4.1"
|
enum-map = "2.4.1"
|
||||||
fnv = "1.0.7"
|
fnv = "1.0.7"
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::{
|
||||||
RenderTarget, SwapChainTarget, Texture, TextureOffscreen, Transforms,
|
RenderTarget, SwapChainTarget, Texture, TextureOffscreen, Transforms,
|
||||||
};
|
};
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
|
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
||||||
use ruffle_render::backend::{RenderBackend, ShapeHandle, ViewportDimensions};
|
use ruffle_render::backend::{RenderBackend, ShapeHandle, ViewportDimensions};
|
||||||
use ruffle_render::bitmap::{Bitmap, BitmapHandle, BitmapSource};
|
use ruffle_render::bitmap::{Bitmap, BitmapHandle, BitmapSource};
|
||||||
use ruffle_render::commands::CommandList;
|
use ruffle_render::commands::CommandList;
|
||||||
|
@ -49,17 +50,13 @@ impl WgpuRenderBackend<SwapChainTarget> {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let target = SwapChainTarget::new(
|
let target =
|
||||||
surface,
|
SwapChainTarget::new(surface, &descriptors.adapter, (1, 1), &descriptors.device);
|
||||||
descriptors.surface_format,
|
|
||||||
(1, 1),
|
|
||||||
&descriptors.device,
|
|
||||||
);
|
|
||||||
Self::new(Arc::new(descriptors), target)
|
Self::new(Arc::new(descriptors), target)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
pub fn for_window<W: raw_window_handle::HasRawWindowHandle>(
|
pub fn for_window<W: HasRawWindowHandle + HasRawDisplayHandle>(
|
||||||
window: &W,
|
window: &W,
|
||||||
size: (u32, u32),
|
size: (u32, u32),
|
||||||
backend: wgpu::Backends,
|
backend: wgpu::Backends,
|
||||||
|
@ -81,12 +78,7 @@ impl WgpuRenderBackend<SwapChainTarget> {
|
||||||
power_preference,
|
power_preference,
|
||||||
trace_path,
|
trace_path,
|
||||||
))?;
|
))?;
|
||||||
let target = SwapChainTarget::new(
|
let target = SwapChainTarget::new(surface, &descriptors.adapter, size, &descriptors.device);
|
||||||
surface,
|
|
||||||
descriptors.surface_format,
|
|
||||||
size,
|
|
||||||
&descriptors.device,
|
|
||||||
);
|
|
||||||
Self::new(Arc::new(descriptors), target)
|
Self::new(Arc::new(descriptors), target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +129,7 @@ impl<T: RenderTarget> WgpuRenderBackend<T> {
|
||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Allow the sample count to be set from command line/settings file.
|
||||||
let surface = Surface::new(
|
let surface = Surface::new(
|
||||||
&descriptors,
|
&descriptors,
|
||||||
DEFAULT_SAMPLE_COUNT,
|
DEFAULT_SAMPLE_COUNT,
|
||||||
|
@ -190,29 +183,8 @@ impl<T: RenderTarget> WgpuRenderBackend<T> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let (device, queue) = request_device(&adapter, trace_path).await?;
|
let (device, queue) = request_device(&adapter, trace_path).await?;
|
||||||
let info = adapter.get_info();
|
|
||||||
// Ideally we want to use an RGBA non-sRGB surface format, because Flash colors and
|
Ok(Descriptors::new(adapter, device, queue))
|
||||||
// blending are done in sRGB space -- we don't want the GPU to adjust the colors.
|
|
||||||
// Some platforms may only support an sRGB surface, in which case we will draw to an
|
|
||||||
// intermediate linear buffer and then copy to the sRGB surface.
|
|
||||||
let surface_format = surface
|
|
||||||
.and_then(|surface| {
|
|
||||||
let formats = surface.get_supported_formats(&adapter);
|
|
||||||
formats
|
|
||||||
.iter()
|
|
||||||
.find(|format| {
|
|
||||||
matches!(
|
|
||||||
format,
|
|
||||||
wgpu::TextureFormat::Rgba8Unorm | wgpu::TextureFormat::Bgra8Unorm
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.or_else(|| formats.first())
|
|
||||||
.cloned()
|
|
||||||
})
|
|
||||||
// No surface (rendering to texture), default to linear RBGA.
|
|
||||||
.unwrap_or(wgpu::TextureFormat::Rgba8Unorm);
|
|
||||||
// TODO: Allow the sample count to be set from command line/settings file.
|
|
||||||
Ok(Descriptors::new(device, queue, info, surface_format))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_shape_internal(
|
fn register_shape_internal(
|
||||||
|
@ -619,7 +591,7 @@ async fn request_device(
|
||||||
.request_device(
|
.request_device(
|
||||||
&wgpu::DeviceDescriptor {
|
&wgpu::DeviceDescriptor {
|
||||||
label: None,
|
label: None,
|
||||||
features: wgpu::Features::empty(),
|
features: wgpu::Features::DEPTH24PLUS_STENCIL8,
|
||||||
limits,
|
limits,
|
||||||
},
|
},
|
||||||
trace_path,
|
trace_path,
|
||||||
|
|
|
@ -6,10 +6,9 @@ use fnv::FnvHashMap;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
pub struct Descriptors {
|
pub struct Descriptors {
|
||||||
|
pub adapter: wgpu::Adapter,
|
||||||
pub device: wgpu::Device,
|
pub device: wgpu::Device,
|
||||||
pub info: wgpu::AdapterInfo,
|
|
||||||
pub limits: wgpu::Limits,
|
pub limits: wgpu::Limits,
|
||||||
pub surface_format: wgpu::TextureFormat,
|
|
||||||
pub queue: wgpu::Queue,
|
pub queue: wgpu::Queue,
|
||||||
pub bitmap_samplers: BitmapSamplers,
|
pub bitmap_samplers: BitmapSamplers,
|
||||||
pub bind_layouts: BindLayouts,
|
pub bind_layouts: BindLayouts,
|
||||||
|
@ -20,12 +19,7 @@ pub struct Descriptors {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Descriptors {
|
impl Descriptors {
|
||||||
pub fn new(
|
pub fn new(adapter: wgpu::Adapter, device: wgpu::Device, queue: wgpu::Queue) -> Self {
|
||||||
device: wgpu::Device,
|
|
||||||
queue: wgpu::Queue,
|
|
||||||
info: wgpu::AdapterInfo,
|
|
||||||
surface_format: wgpu::TextureFormat,
|
|
||||||
) -> Self {
|
|
||||||
let limits = device.limits();
|
let limits = device.limits();
|
||||||
let bind_layouts = BindLayouts::new(&device);
|
let bind_layouts = BindLayouts::new(&device);
|
||||||
let bitmap_samplers = BitmapSamplers::new(&device);
|
let bitmap_samplers = BitmapSamplers::new(&device);
|
||||||
|
@ -33,10 +27,9 @@ impl Descriptors {
|
||||||
let quad = Quad::new(&device);
|
let quad = Quad::new(&device);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
adapter,
|
||||||
device,
|
device,
|
||||||
info,
|
|
||||||
limits,
|
limits,
|
||||||
surface_format,
|
|
||||||
queue,
|
queue,
|
||||||
bitmap_samplers,
|
bitmap_samplers,
|
||||||
bind_layouts,
|
bind_layouts,
|
||||||
|
|
|
@ -50,16 +50,35 @@ impl RenderTargetFrame for SwapChainTargetFrame {
|
||||||
impl SwapChainTarget {
|
impl SwapChainTarget {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
surface: wgpu::Surface,
|
surface: wgpu::Surface,
|
||||||
format: wgpu::TextureFormat,
|
adapter: &wgpu::Adapter,
|
||||||
size: (u32, u32),
|
(width, height): (u32, u32),
|
||||||
device: &wgpu::Device,
|
device: &wgpu::Device,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
// Ideally we want to use an RGBA non-sRGB surface format, because Flash colors and
|
||||||
|
// blending are done in sRGB space -- we don't want the GPU to adjust the colors.
|
||||||
|
// Some platforms may only support an sRGB surface, in which case we will draw to an
|
||||||
|
// intermediate linear buffer and then copy to the sRGB surface.
|
||||||
|
let formats = surface.get_supported_formats(adapter);
|
||||||
|
let format = formats
|
||||||
|
.iter()
|
||||||
|
.find(|format| {
|
||||||
|
matches!(
|
||||||
|
format,
|
||||||
|
wgpu::TextureFormat::Rgba8Unorm | wgpu::TextureFormat::Bgra8Unorm
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.or_else(|| formats.first())
|
||||||
|
.copied()
|
||||||
|
// No surface (rendering to texture), default to linear RBGA.
|
||||||
|
.unwrap_or(wgpu::TextureFormat::Rgba8Unorm);
|
||||||
|
|
||||||
let surface_config = wgpu::SurfaceConfiguration {
|
let surface_config = wgpu::SurfaceConfiguration {
|
||||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||||
format,
|
format,
|
||||||
width: size.0,
|
width,
|
||||||
height: size.1,
|
height,
|
||||||
present_mode: wgpu::PresentMode::Fifo,
|
present_mode: wgpu::PresentMode::Fifo,
|
||||||
|
alpha_mode: surface.get_supported_alpha_modes(adapter)[0],
|
||||||
};
|
};
|
||||||
surface.configure(device, &surface_config);
|
surface.configure(device, &surface_config);
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -29,11 +29,6 @@ use std::rc::Rc;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[cfg(feature = "imgtests")]
|
|
||||||
fn get_img_platform_suffix(info: &wgpu::AdapterInfo) -> String {
|
|
||||||
format!("{}-{:?}", std::env::consts::OS, info.backend)
|
|
||||||
}
|
|
||||||
|
|
||||||
const RUN_IMG_TESTS: bool = cfg!(feature = "imgtests");
|
const RUN_IMG_TESTS: bool = cfg!(feature = "imgtests");
|
||||||
|
|
||||||
fn set_logger() {
|
fn set_logger() {
|
||||||
|
@ -1500,7 +1495,8 @@ fn run_swf(
|
||||||
.capture_frame(false)
|
.capture_frame(false)
|
||||||
.expect("Failed to capture image");
|
.expect("Failed to capture image");
|
||||||
|
|
||||||
let suffix = get_img_platform_suffix(&renderer.descriptors().info);
|
let info = renderer.descriptors().adapter.get_info();
|
||||||
|
let suffix = format!("{}-{:?}", std::env::consts::OS, info.backend);
|
||||||
|
|
||||||
let expected_image_path = base_path.join(format!("expected-{}.png", &suffix));
|
let expected_image_path = base_path.join(format!("expected-{}.png", &suffix));
|
||||||
let expected_image = image::open(&expected_image_path);
|
let expected_image = image::open(&expected_image_path);
|
||||||
|
|
Loading…
Reference in New Issue