Skip to content

Commit

Permalink
Merge #875
Browse files Browse the repository at this point in the history
875: Add labels to pipelines r=trivial a=kvark

This isn't functional until gfx-hal-0.6 is published, but the API is there.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
  • Loading branch information
bors[bot] and kvark authored Aug 13, 2020
2 parents 6e3e88d + d8341c5 commit 92aaa2b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion player/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ features = ["replay", "raw-window-handle"]

[dependencies.wgpu-subscriber]
path = "../wgpu-subscriber"
version = "0.5"
version = "0.1"

[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
gfx-backend-vulkan = { version = "0.5", features = ["x11"] }
Expand Down
25 changes: 16 additions & 9 deletions wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2878,7 +2878,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
parent,
};
// TODO: cache
let pipeline = unsafe {
let raw = unsafe {
device
.raw
.create_graphics_pipeline(&pipeline_desc, None)
Expand All @@ -2887,9 +2887,12 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
_ => panic!("failed to create graphics pipeline: {}", err),
})?
};
if let Some(_) = desc.label {
//TODO-0.6: device.set_graphics_pipeline_name(&mut raw, label)
}

(
pipeline,
raw,
pipeline_layout_id,
layout.life_guard.add_ref(),
derived_bind_group_count,
Expand Down Expand Up @@ -3130,20 +3133,24 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
parent,
};

match unsafe { device.raw.create_compute_pipeline(&pipeline_desc, None) } {
Ok(pipeline) => (
pipeline,
pipeline_layout_id,
layout.life_guard.add_ref(),
derived_bind_group_count,
),
let raw = match unsafe { device.raw.create_compute_pipeline(&pipeline_desc, None) } {
Ok(pipeline) => pipeline,
Err(hal::pso::CreationError::OutOfMemory(_)) => {
return Err(pipeline::CreateComputePipelineError::Device(
DeviceError::OutOfMemory,
))
}
other => panic!("Compute pipeline creation error: {:?}", other),
};
if let Some(_) = desc.label {
//TODO-0.6: device.raw.set_compute_pipeline_name(&mut raw, label);
}
(
raw,
pipeline_layout_id,
layout.life_guard.add_ref(),
derived_bind_group_count,
)
};

let pipeline = pipeline::ComputePipeline {
Expand Down
4 changes: 3 additions & 1 deletion wgpu-core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
device::{DeviceError, RenderPassContext},
id::{DeviceId, PipelineLayoutId, ShaderModuleId},
validation::StageError,
LifeGuard, RefCount, Stored,
Label, LifeGuard, RefCount, Stored,
};
use std::borrow::{Borrow, Cow};
use thiserror::Error;
Expand Down Expand Up @@ -68,6 +68,7 @@ pub enum ImplicitLayoutError {
#[cfg_attr(feature = "trace", derive(serde::Serialize))]
#[cfg_attr(feature = "replay", derive(serde::Deserialize))]
pub struct ComputePipelineDescriptor<'a> {
pub label: Label<'a>,
/// The layout of bind groups for this pipeline.
pub layout: Option<PipelineLayoutId>,
/// The compiled compute stage and its entry point.
Expand Down Expand Up @@ -129,6 +130,7 @@ pub struct VertexStateDescriptor<'a> {
#[cfg_attr(feature = "trace", derive(serde::Serialize))]
#[cfg_attr(feature = "replay", derive(serde::Deserialize))]
pub struct RenderPipelineDescriptor<'a> {
pub label: Label<'a>,
/// The layout of bind groups for this pipeline.
pub layout: Option<PipelineLayoutId>,
/// The compiled vertex stage and its entry point.
Expand Down
2 changes: 1 addition & 1 deletion wgpu-subscriber/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wgpu-subscriber"
version = "0.5.0"
version = "0.1.0"
authors = ["wgpu developers"]
edition = "2018"
description = "WebGPU tracing subscriber"
Expand Down

0 comments on commit 92aaa2b

Please sign in to comment.