Skip to content

Commit

Permalink
Prefix every wgpu-generated label with (wgpu internal).
Browse files Browse the repository at this point in the history
This is intended to help developers new to wgpu or to graphics debugging
quickly recognize in a debugging tool which items are wgpu-generated, as
opposed to either part of their program or part of the platform graphics
system.

I also removed existing marker-like text such as leading underscores and
angle brackets.
  • Loading branch information
kpreid authored and kvark committed Apr 16, 2022
1 parent abdf1cd commit cb7ad30
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion wgpu-core/src/command/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ fn clear_texture_via_render_passes<A: hal::Api>(
};
unsafe {
encoder.begin_render_pass(&hal::RenderPassDescriptor {
label: Some("clear_texture clear pass"),
label: Some("(wgpu internal) clear_texture clear pass"),
extent,
sample_count,
color_attachments,
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> {
)
};
let desc = hal::RenderPassDescriptor {
label: Some("Zero init discarded depth/stencil aspect"),
label: Some("(wgpu internal) Zero init discarded depth/stencil aspect"),
extent: view.extent,
sample_count: view.samples,
color_attachments: &[],
Expand Down
8 changes: 5 additions & 3 deletions wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<A: HalApi> Device<A> {
let zero_buffer = unsafe {
open.device
.create_buffer(&hal::BufferDescriptor {
label: Some("wgpu zero init buffer"),
label: Some("(wgpu internal) zero init buffer"),
size: ZERO_BUFFER_SIZE,
usage: hal::BufferUses::COPY_SRC | hal::BufferUses::COPY_DST,
memory_flags: hal::MemoryFlags::empty(),
Expand Down Expand Up @@ -784,7 +784,7 @@ impl<A: HalApi> Device<A> {
for mip_level in 0..desc.mip_level_count {
for array_layer in 0..desc.size.depth_or_array_layers {
let desc = hal::TextureViewDescriptor {
label: Some("clear texture view"),
label: Some("(wgpu internal) clear texture view"),
format: desc.format,
dimension,
usage,
Expand Down Expand Up @@ -3107,7 +3107,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
} else {
// buffer needs staging area for initialization only
let stage_desc = wgt::BufferDescriptor {
label: Some(Cow::Borrowed("<init_buffer>")),
label: Some(Cow::Borrowed(
"(wgpu internal) initializing unmappable buffer",
)),
size: desc.size,
usage: wgt::BufferUsages::MAP_WRITE | wgt::BufferUsages::COPY_SRC,
mapped_at_creation: false,
Expand Down
8 changes: 4 additions & 4 deletions wgpu-core/src/device/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl<A: hal::Api> PendingWrites<A> {
if !self.is_active {
unsafe {
self.command_encoder
.begin_encoding(Some("_PendingWrites"))
.begin_encoding(Some("(wgpu internal) PendingWrites"))
.unwrap();
}
self.is_active = true;
Expand All @@ -196,7 +196,7 @@ impl<A: hal::Api> super::Device<A> {
fn prepare_stage(&mut self, size: wgt::BufferAddress) -> Result<StagingData<A>, DeviceError> {
profiling::scope!("prepare_stage");
let stage_desc = hal::BufferDescriptor {
label: Some("_Staging"),
label: Some("(wgpu internal) Staging"),
size,
usage: hal::BufferUses::MAP_WRITE | hal::BufferUses::COPY_SRC,
memory_flags: hal::MemoryFlags::TRANSIENT,
Expand Down Expand Up @@ -754,7 +754,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
unsafe {
baked
.encoder
.begin_encoding(Some("_Transit"))
.begin_encoding(Some("(wgpu internal) Transit"))
.map_err(DeviceError::from)?
};
log::trace!("Stitching command buffer {:?} before submission", cmb_id);
Expand Down Expand Up @@ -785,7 +785,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
unsafe {
baked
.encoder
.begin_encoding(Some("_Present"))
.begin_encoding(Some("(wgpu internal) Present"))
.map_err(DeviceError::from)?
};
let texture_barriers = trackers
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/present.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (texture_id, status) = match unsafe { suf.raw.acquire_texture(FRAME_TIMEOUT_MS) } {
Ok(Some(ast)) => {
let clear_view_desc = hal::TextureViewDescriptor {
label: Some("clear surface texture view"),
label: Some("(wgpu internal) clear surface texture view"),
format: config.format,
dimension: wgt::TextureViewDimension::D2,
usage: hal::TextureUses::COLOR_TARGET,
Expand Down
8 changes: 6 additions & 2 deletions wgpu-hal/src/gles/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,12 @@ impl super::Device {
};
let shader_src = format!("#version {} es \n void main(void) {{}}", version,);
log::info!("Only vertex shader is present. Creating an empty fragment shader",);
let shader =
Self::compile_shader(gl, &shader_src, naga::ShaderStage::Fragment, Some("_dummy"))?;
let shader = Self::compile_shader(
gl,
&shader_src,
naga::ShaderStage::Fragment,
Some("(wgpu internal) dummy fragment shader"),
)?;
shaders_to_delete.push(shader);
}

Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl crate::Queue<Api> for Queue {
.to_owned()
}
};
raw.set_label("_Signal");
raw.set_label("(wgpu internal) Signal");
raw.add_completed_handler(&block);

fence.maintain();
Expand Down Expand Up @@ -370,7 +370,7 @@ impl crate::Queue<Api> for Queue {
let queue = &self.raw.lock();
objc::rc::autoreleasepool(|| {
let command_buffer = queue.new_command_buffer();
command_buffer.set_label("_Present");
command_buffer.set_label("(wgpu internal) Present");

// https://developer.apple.com/documentation/quartzcore/cametallayer/1478157-presentswithtransaction?language=objc
if !texture.present_with_transaction {
Expand Down
2 changes: 1 addition & 1 deletion wgpu/src/util/belt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl StagingBelt {
let size = self.chunk_size.max(size.get());
Chunk {
buffer: device.create_buffer(&BufferDescriptor {
label: Some("staging"),
label: Some("(wgpu internal) StagingBelt staging buffer"),
size,
usage: BufferUsages::MAP_WRITE | BufferUsages::COPY_SRC,
mapped_at_creation: true,
Expand Down

0 comments on commit cb7ad30

Please sign in to comment.