735: Set descriptor set name when creating bind group r=kvark a=GabrielMajeri

**Description**
There is a [`TODO` in the code](a02a566841/wgpu-core/src/device/mod.rs (L1428)) for setting the descriptor set name when creating a bind group. It was blocked on https://github.com/gfx-rs/gfx-extras/pull/5

**Testing**
Tested with examples from `wgpu-rs`.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
This commit is contained in:
bors[bot]
2020-06-19 13:33:32 +00:00
committed by GitHub
3 changed files with 16 additions and 10 deletions

3
Cargo.lock generated
View File

@@ -470,8 +470,7 @@ dependencies = [
[[package]]
name = "gfx-descriptor"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf35f5d66d1bc56e63e68d7528441453f25992bd954b84309d23c659df2c5da"
source = "git+https://github.com/gfx-rs/gfx-extras?rev=438353c3f75368c12024ad2fc03cbeb15f351fd9#438353c3f75368c12024ad2fc03cbeb15f351fd9"
dependencies = [
"fxhash",
"gfx-hal",

View File

@@ -24,7 +24,6 @@ fxhash = "0.2"
log = "0.4"
hal = { package = "gfx-hal", version = "0.5.2" }
gfx-backend-empty = "0.5"
gfx-descriptor = "0.1"
parking_lot = "0.10"
peek-poke = "0.2"
raw-window-handle = { version = "0.3", optional = true }
@@ -38,6 +37,10 @@ vec_map = "0.8.1"
git = "https://github.com/gfx-rs/naga"
rev = "e3aea9619865b16a24164d46ab29cca36ad7daf2"
[dependencies.gfx-descriptor]
git = "https://github.com/gfx-rs/gfx-extras"
rev = "438353c3f75368c12024ad2fc03cbeb15f351fd9"
[dependencies.gfx-memory]
git = "https://github.com/gfx-rs/gfx-extras"
rev = "438353c3f75368c12024ad2fc03cbeb15f351fd9"

View File

@@ -1408,7 +1408,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let bind_group_layout = &bind_group_layout_guard[desc.layout];
assert_eq!(desc.bindings.len(), bind_group_layout.entries.len(), "Bind group has {} entries and bind group layout has {} entries, they should be the same.", desc.bindings.len(), bind_group_layout.entries.len());
let desc_set = unsafe {
let mut desc_set = unsafe {
let mut desc_sets = ArrayVec::<[_; 1]>::new();
device
.desc_allocator
@@ -1424,14 +1424,18 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
desc_sets.pop().unwrap()
};
if let Some(..) = desc.label {
//TODO: https://github.com/gfx-rs/gfx-extras/pull/5
//unsafe {
// let label = ffi::CStr::from_ptr(desc.label).to_string_lossy();
// device.raw.set_descriptor_set_name(desc_set.raw_mut(), &label);
//}
// Set the descriptor set's label for easier debugging.
if let Some(label) = desc.label {
unsafe {
device
.raw
.set_descriptor_set_name(desc_set.raw_mut(), &label);
}
}
// Rebind `desc_set` as immutable
let desc_set = desc_set;
// fill out the descriptors
let mut used = TrackerSet::new(B::VARIANT);
{