mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Merge #735
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:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user