389: [0.4] Transition and binding fixes r=grovesNL a=kvark

Back-ports #387 as well as a tiny bit of #378 to v0.4 branch and bumps the patch version.
Fixes  #384

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot] 2019-11-29 03:04:29 +00:00 committed by GitHub
commit 073c7d779d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 33 deletions

View File

@ -1,5 +1,9 @@
# Change Log
## 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:

4
Cargo.lock generated
View File

@ -620,7 +620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wgpu-native"
version = "0.4.0"
version = "0.4.1"
dependencies = [
"arrayvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -649,7 +649,7 @@ version = "0.1.0"
dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wgpu-native 0.4.0",
"wgpu-native 0.4.1",
]
[[package]]

View File

@ -1,6 +1,6 @@
[package]
name = "wgpu-native"
version = "0.4.0"
version = "0.4.1"
authors = [
"Dzmitry Malyshau <kvark@mozilla.com>",
"Joshua Groves <josh@joshgroves.com>",

View File

@ -14,7 +14,7 @@ use crate::{
use smallvec::{smallvec, SmallVec};
use std::convert::identity;
use std::slice;
pub const DEFAULT_BIND_GROUPS: usize = 4;
type BindGroupMask = u8;
@ -38,16 +38,21 @@ pub enum Provision {
Changed { was_compatible: bool },
}
struct TakeSome<I> {
iter: I,
#[derive(Clone)]
pub struct FollowUpIter<'a> {
iter: slice::Iter<'a, BindGroupEntry>,
}
impl<T, I> Iterator for TakeSome<I>
where
I: Iterator<Item = Option<T>>,
{
type Item = T;
fn next(&mut self) -> Option<T> {
self.iter.next().and_then(identity)
impl<'a> Iterator for FollowUpIter<'a> {
type Item = (BindGroupId, &'a [BufferAddress]);
fn next(&mut self) -> Option<Self::Item> {
self.iter
.next()
.and_then(|entry| {
Some((
entry.actual_value()?,
entry.dynamic_offsets.as_slice(),
))
})
}
}
@ -165,11 +170,7 @@ impl Binder {
bind_group_id: BindGroupId,
bind_group: &BindGroup<B>,
offsets: &[BufferAddress],
) -> Option<(
PipelineLayoutId,
impl 'a + Iterator<Item = BindGroupId>,
impl 'a + Iterator<Item = &'a BufferAddress>,
)> {
) -> Option<(PipelineLayoutId, FollowUpIter<'a>)> {
log::trace!("\tBinding [{}] = group {:?}", index, bind_group_id);
debug_assert_eq!(B::VARIANT, bind_group_id.backend());
@ -186,14 +187,9 @@ impl Binder {
log::trace!("\t\tbinding up to {}", end);
Some((
self.pipeline_layout_id?,
TakeSome {
iter: self.entries[index + 1 .. end]
.iter()
.map(|entry| entry.actual_value()),
},
self.entries[index + 1 .. end]
.iter()
.flat_map(|entry| entry.dynamic_offsets.as_slice()),
FollowUpIter {
iter: self.entries[index + 1 .. end].iter(),
}
))
} else {
log::trace!("\t\tskipping above compatible {}", compatible_count);

View File

@ -127,12 +127,12 @@ pub fn compute_pass_set_bind_group<B: GfxBackend>(
&*texture_guard,
);
if let Some((pipeline_layout_id, follow_up_sets, follow_up_offsets)) = pass
if let Some((pipeline_layout_id, follow_ups)) = pass
.binder
.provide_entry(index as usize, bind_group_id, bind_group, offsets)
{
let bind_groups = iter::once(bind_group.raw.raw())
.chain(follow_up_sets.map(|bg_id| bind_group_guard[bg_id].raw.raw()));
.chain(follow_ups.clone().map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw()));
unsafe {
pass.raw.bind_compute_descriptor_sets(
&pipeline_layout_guard[pipeline_layout_id].raw,
@ -140,7 +140,7 @@ pub fn compute_pass_set_bind_group<B: GfxBackend>(
bind_groups,
offsets
.iter()
.chain(follow_up_offsets)
.chain(follow_ups.flat_map(|(_, offsets)| offsets))
.map(|&off| off as hal::command::DescriptorSetOffset),
);
}

View File

@ -258,12 +258,12 @@ pub fn render_pass_set_bind_group<B: GfxBackend>(
pass.trackers.merge_extend(&bind_group.used);
if let Some((pipeline_layout_id, follow_up_sets, follow_up_offsets)) = pass
if let Some((pipeline_layout_id, follow_ups)) = pass
.binder
.provide_entry(index as usize, bind_group_id, bind_group, offsets)
{
let bind_groups = iter::once(bind_group.raw.raw())
.chain(follow_up_sets.map(|bg_id| bind_group_guard[bg_id].raw.raw()));
.chain(follow_ups.clone().map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw()));
unsafe {
pass.raw.bind_graphics_descriptor_sets(
&&pipeline_layout_guard[pipeline_layout_id].raw,
@ -271,7 +271,7 @@ pub fn render_pass_set_bind_group<B: GfxBackend>(
bind_groups,
offsets
.iter()
.chain(follow_up_offsets)
.chain(follow_ups.flat_map(|(_, offsets)| offsets))
.map(|&off| off as hal::command::DescriptorSetOffset),
);
}

View File

@ -129,7 +129,7 @@ impl ResourceState for TextureState {
let pending = PendingTransition {
id,
selector: hal::image::SubresourceRange {
aspects: hal::format::Aspects::COLOR,
aspects: aspect,
levels: level .. level + 1,
layers: range.clone(),
},