Skip to content

Commit 6a65178

Browse files
bors[bot]kvark
andauthored
Merge #360
360: Update to latest rendy with gfx-0.4 r=kvark a=kvark Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2 parents b71fc33 + 271c709 commit 6a65178

File tree

7 files changed

+170
-131
lines changed

7 files changed

+170
-131
lines changed

Cargo.lock

Lines changed: 135 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wgpu-native/Cargo.toml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,25 @@ bitflags = "1.0"
2828
copyless = "0.1"
2929
lazy_static = { version = "1.1.0", optional = true }
3030
log = "0.4"
31-
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }
32-
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }
31+
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b" }
32+
gfx-auxil = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b" }
33+
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b" }
3334
parking_lot = "0.9"
3435
raw-window-handle = { version = "0.3", optional = true }
35-
rendy-memory = { git = "https://github.com/amethyst/rendy", rev = "e8ffcabc2bc74fbb282d4f71fa55c28d0ec31c86" }
36-
rendy-descriptor = { git = "https://github.com/amethyst/rendy", rev = "e8ffcabc2bc74fbb282d4f71fa55c28d0ec31c86" }
36+
rendy-memory = { git = "https://github.com/amethyst/rendy", rev = "948ee05f7b2d129f2f1b9321c87077dd766d9672" }
37+
rendy-descriptor = { git = "https://github.com/amethyst/rendy", rev = "948ee05f7b2d129f2f1b9321c87077dd766d9672" }
3738
serde = { version = "1.0", features = ["serde_derive"], optional = true }
3839
smallvec = "0.6"
3940
vec_map = "0.8"
4041

4142
[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
42-
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }
43-
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69", optional = true }
43+
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b" }
44+
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b", optional = true }
4445

4546
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
46-
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69", features = ["x11"] }
47+
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b", features = ["x11"] }
4748

4849
[target.'cfg(windows)'.dependencies]
49-
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }
50-
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }
51-
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "3d5db15661127c8cad8d85522a68ec36c82f6e69" }
50+
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b" }
51+
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b" }
52+
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "46386475f7e823e807ec984c372ffe04dcc0a22b" }

wgpu-native/src/command/allocator.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ struct CommandPool<B: hal::Backend> {
2727
impl<B: hal::Backend> CommandPool<B> {
2828
fn allocate(&mut self) -> B::CommandBuffer {
2929
if self.available.is_empty() {
30-
let extra = self.raw.allocate_vec(20, hal::command::Level::Primary);
30+
let extra = unsafe {
31+
self.raw.allocate_vec(20, hal::command::Level::Primary)
32+
};
3133
self.available.extend(extra);
3234
}
3335

@@ -111,7 +113,9 @@ impl<B: hal::Backend> CommandAllocator<B> {
111113
let pool = inner.pools.get_mut(&cmd_buf.recorded_thread_id).unwrap();
112114

113115
if pool.available.is_empty() {
114-
let extra = pool.raw.allocate_vec(20, hal::command::Level::Primary);
116+
let extra = unsafe {
117+
pool.raw.allocate_vec(20, hal::command::Level::Primary)
118+
};
115119
pool.available.extend(extra);
116120
}
117121

wgpu-native/src/conv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ pub fn map_extent(extent: Extent3d) -> hal::image::Extent {
138138
}
139139
}
140140

141-
pub fn map_primitive_topology(primitive_topology: pipeline::PrimitiveTopology) -> hal::Primitive {
141+
pub fn map_primitive_topology(primitive_topology: pipeline::PrimitiveTopology) -> hal::pso::Primitive {
142142
use crate::pipeline::PrimitiveTopology as Pt;
143-
use hal::Primitive as H;
143+
use hal::pso::Primitive as H;
144144
match primitive_topology {
145145
Pt::PointList => H::PointList,
146146
Pt::LineList => H::LineList,
@@ -512,7 +512,7 @@ pub fn map_buffer_state(usage: resource::BufferUsage) -> hal::buffer::State {
512512
access |= A::VERTEX_BUFFER_READ;
513513
}
514514
if usage.contains(W::UNIFORM) {
515-
access |= A::CONSTANT_BUFFER_READ | A::SHADER_READ;
515+
access |= A::UNIFORM_READ | A::SHADER_READ;
516516
}
517517
if usage.contains(W::STORAGE) {
518518
access |= A::SHADER_WRITE;

wgpu-native/src/device.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ use crate::{gfx_select, hub::GLOBAL};
4848

4949
use arrayvec::ArrayVec;
5050
use copyless::VecHelper as _;
51+
use gfx_auxil::FastHashMap;
5152
use hal::{
5253
self,
53-
backend::FastHashMap,
5454
command::CommandBuffer as _,
5555
device::Device as _,
5656
queue::CommandQueue as _,
@@ -1090,7 +1090,7 @@ pub fn device_create_sampler<B: GfxBackend>(
10901090
let (device_guard, mut token) = hub.devices.read(&mut token);
10911091
let device = &device_guard[device_id];
10921092

1093-
let info = hal::image::SamplerInfo {
1093+
let info = hal::image::SamplerDesc {
10941094
min_filter: conv::map_filter(desc.min_filter),
10951095
mag_filter: conv::map_filter(desc.mag_filter),
10961096
mip_filter: conv::map_filter(desc.mipmap_filter),
@@ -1099,8 +1099,8 @@ pub fn device_create_sampler<B: GfxBackend>(
10991099
conv::map_wrap(desc.address_mode_v),
11001100
conv::map_wrap(desc.address_mode_w),
11011101
),
1102-
lod_bias: 0.0.into(),
1103-
lod_range: desc.lod_min_clamp.into() .. desc.lod_max_clamp.into(),
1102+
lod_bias: hal::image::Lod(0.0),
1103+
lod_range: hal::image::Lod(desc.lod_min_clamp) .. hal::image::Lod(desc.lod_max_clamp),
11041104
comparison: if desc.compare_function == resource::CompareFunction::Always {
11051105
None
11061106
} else {
@@ -1112,7 +1112,7 @@ pub fn device_create_sampler<B: GfxBackend>(
11121112
};
11131113

11141114
let sampler = resource::Sampler {
1115-
raw: unsafe { device.raw.create_sampler(info).unwrap() },
1115+
raw: unsafe { device.raw.create_sampler(&info).unwrap() },
11161116
device_id: Stored {
11171117
value: device_id,
11181118
ref_count: device.life_guard.ref_count.clone(),
@@ -1774,7 +1774,8 @@ pub fn device_create_render_pipeline<B: GfxBackend>(
17741774

17751775
let input_assembler = hal::pso::InputAssemblerDesc {
17761776
primitive: conv::map_primitive_topology(desc.primitive_topology),
1777-
primitive_restart: hal::pso::PrimitiveRestart::Disabled, // TODO
1777+
with_adjacency: false,
1778+
restart_index: None, //TODO
17781779
};
17791780

17801781
let blender = hal::pso::BlendDesc {
@@ -2055,11 +2056,13 @@ pub fn device_create_swap_chain<B: GfxBackend>(
20552056
let device = &device_guard[device_id];
20562057
let surface = &mut surface_guard[surface_id];
20572058

2058-
let (caps, formats, _present_modes) = {
2059+
let (caps, formats) = {
20592060
let suf = B::get_surface_mut(surface);
20602061
let adapter = &adapter_guard[device.adapter_id];
20612062
assert!(suf.supports_queue_family(&adapter.raw.queue_families[0]));
2062-
suf.compatibility(&adapter.raw.physical_device)
2063+
let formats = suf.supported_formats(&adapter.raw.physical_device);
2064+
let caps = suf.capabilities(&adapter.raw.physical_device);
2065+
(caps, formats)
20632066
};
20642067
let num_frames = swap_chain::DESIRED_NUM_FRAMES
20652068
.max(*caps.image_count.start())

wgpu-native/src/swap_chain.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ impl SwapChainDescriptor {
9797
);
9898
//TODO: check for supported
9999
config.image_usage = conv::map_texture_usage(self.usage, hal::format::Aspects::COLOR);
100-
config.composite_alpha = hal::window::CompositeAlpha::OPAQUE;
100+
config.composite_alpha_mode = hal::window::CompositeAlphaMode::OPAQUE;
101101
config.present_mode = match self.present_mode {
102-
PresentMode::NoVsync => hal::window::PresentMode::Immediate,
103-
PresentMode::Vsync => hal::window::PresentMode::Fifo,
102+
PresentMode::NoVsync => hal::window::PresentMode::IMMEDIATE,
103+
PresentMode::Vsync => hal::window::PresentMode::FIFO,
104104
};
105105
config
106106
}

wgpu-native/src/track/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
TypedId,
1919
};
2020

21-
use hal::backend::FastHashMap;
21+
use gfx_auxil::FastHashMap;
2222

2323
use std::{
2424
borrow::Borrow,

0 commit comments

Comments
 (0)