Skip to content

Commit

Permalink
Merge gfx-rs#556
Browse files Browse the repository at this point in the history
556: Preparations for wgpu-0.5 release r=grovesNL a=kvark

Based on gfx-rs#555 

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
  • Loading branch information
bors[bot] and kvark committed Apr 6, 2020
2 parents 384606f + 7dba052 commit 77d95f5
Show file tree
Hide file tree
Showing 35 changed files with 922 additions and 1,082 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Change Log

## v0.5 (06-04-2020)
- Crates:
- `wgpu-types`: common types between native and web targets
- `wgpu-core`: internal API for the native and remote wrappers
- Features:
- based on gfx-hal-0.5
- moved from Rendy to the new `gfx-memory` and `gfx-descriptor` crates
- passes are now recorded on the client side. The user is also responsible to keep all resources referenced in the pass up until it ends recording.
- revised GPU lifetime tracking of all resources
- revised usage tracking logic
- all IDs are now non-zero
- Mailbox present mode
- Validation:
- active pipeline
- Fixes:
- lots of small API changes to closely match upstream WebGPU
- true read-only storage bindings
- unmapping dropped buffers
- better error messages on misused swapchain frames

## v0.4.3 (20-01-2020)
- improved swap chain error handling

## v0.4.2 (15-12-2019)
- fixed render pass transitions

## v0.4.1 (28-11-2019)
- fixed depth/stencil transitions
- fixed dynamic offset iteration

## v0.4 (03-11-2019)
- Platforms: removed OpenGL/WebGL support temporarily
- Features:
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

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

4 changes: 0 additions & 4 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
newline_style = "Native"
blank_lines_upper_bound = 2
spaces_around_ranges = true
imports_layout = "HorizontalVertical"
4 changes: 2 additions & 2 deletions wgpu-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wgpu-core"
version = "0.1.0"
version = "0.5.0"
authors = [
"Dzmitry Malyshau <kvark@mozilla.com>",
"Joshua Groves <josh@joshgroves.com>",
Expand Down Expand Up @@ -45,7 +45,7 @@ optional = true
[dependencies.wgt]
path = "../wgpu-types"
package = "wgpu-types"
version = "0.1"
version = "0.5"
features = ["peek-poke"]

[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
Expand Down
39 changes: 28 additions & 11 deletions wgpu-core/src/binding_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@

use crate::{
id::{BindGroupLayoutId, BufferId, DeviceId, SamplerId, TextureViewId},
track::{DUMMY_SELECTOR, TrackerSet},
FastHashMap,
LifeGuard,
RefCount,
Stored,
track::{TrackerSet, DUMMY_SELECTOR},
FastHashMap, LifeGuard, RefCount, Stored,
};

use wgt::{BufferAddress, TextureComponentType};
use arrayvec::ArrayVec;
use gfx_descriptor::{DescriptorCounts, DescriptorSet};
use wgt::{BufferAddress, TextureComponentType};

#[cfg(feature = "serde")]
use serde_crate::{Deserialize, Serialize};
use std::borrow::Borrow;

#[repr(C)]
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
pub enum BindingType {
UniformBuffer = 0,
StorageBuffer = 1,
Expand All @@ -35,7 +36,11 @@ pub enum BindingType {

#[repr(C)]
#[derive(Clone, Debug, Hash, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
pub struct BindGroupLayoutEntry {
pub binding: u32,
pub visibility: wgt::ShaderStage,
Expand Down Expand Up @@ -80,7 +85,11 @@ pub struct PipelineLayout<B: hal::Backend> {

#[repr(C)]
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
pub struct BufferBinding {
pub buffer: BufferId,
pub offset: BufferAddress,
Expand All @@ -89,7 +98,11 @@ pub struct BufferBinding {

#[repr(C)]
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
pub enum BindingResource {
Buffer(BufferBinding),
Sampler(SamplerId),
Expand All @@ -98,7 +111,11 @@ pub enum BindingResource {

#[repr(C)]
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
pub struct BindGroupEntry {
pub binding: u32,
pub resource: BindingResource,
Expand Down
20 changes: 10 additions & 10 deletions wgpu-core/src/command/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@

use super::CommandBuffer;
use crate::{
hub::GfxBackend,
id::DeviceId,
track::TrackerSet,
Features,
LifeGuard,
Stored,
SubmissionIndex,
hub::GfxBackend, id::DeviceId, track::TrackerSet, Features, LifeGuard, Stored, SubmissionIndex,
};

use hal::{command::CommandBuffer as _, device::Device as _, pool::CommandPool as _};
Expand All @@ -27,7 +21,7 @@ struct CommandPool<B: hal::Backend> {

impl<B: hal::Backend> CommandPool<B> {
fn maintain(&mut self, lowest_active_index: SubmissionIndex) {
for i in (0 .. self.pending.len()).rev() {
for i in (0..self.pending.len()).rev() {
let index = self.pending[i]
.life_guard
.submission_index
Expand Down Expand Up @@ -55,7 +49,10 @@ impl<B: hal::Backend> CommandPool<B> {

fn allocate(&mut self) -> B::CommandBuffer {
if self.available.is_empty() {
unsafe { self.raw.allocate(20, hal::command::Level::Primary, &mut self.available) };
unsafe {
self.raw
.allocate(20, hal::command::Level::Primary, &mut self.available)
};
}
self.available.pop().unwrap()
}
Expand Down Expand Up @@ -131,7 +128,10 @@ impl<B: hal::Backend> CommandAllocator<B> {
let pool = inner.pools.get_mut(&cmd_buf.recorded_thread_id).unwrap();

if pool.available.is_empty() {
unsafe { pool.raw.allocate(20, hal::command::Level::Primary, &mut pool.available) };
unsafe {
pool.raw
.allocate(20, hal::command::Level::Primary, &mut pool.available)
};
}

pool.available.pop().unwrap()
Expand Down
15 changes: 5 additions & 10 deletions wgpu-core/src/command/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use crate::{
};

use smallvec::{smallvec, SmallVec};
use wgt::DynamicOffset;
use std::slice;
use wgt::DynamicOffset;

pub const DEFAULT_BIND_GROUPS: usize = 4;
type BindGroupMask = u8;
Expand Down Expand Up @@ -44,12 +44,7 @@ impl<'a> Iterator for FollowUpIter<'a> {
fn next(&mut self) -> Option<Self::Item> {
self.iter
.next()
.and_then(|entry| {
Some((
entry.actual_value()?,
entry.dynamic_offsets.as_slice(),
))
})
.and_then(|entry| Some((entry.actual_value()?, entry.dynamic_offsets.as_slice())))
}
}

Expand Down Expand Up @@ -151,7 +146,7 @@ impl Binder {
}

pub(crate) fn reset_expectations(&mut self, length: usize) {
for entry in self.entries[length ..].iter_mut() {
for entry in self.entries[length..].iter_mut() {
entry.expected_layout_id = None;
}
}
Expand Down Expand Up @@ -185,8 +180,8 @@ impl Binder {
Some((
self.pipeline_layout_id?,
FollowUpIter {
iter: self.entries[index + 1 .. end].iter(),
}
iter: self.entries[index + 1..end].iter(),
},
))
} else {
log::trace!("\t\tskipping above compatible {}", compatible_count);
Expand Down
Loading

0 comments on commit 77d95f5

Please sign in to comment.