Skip to content

Commit

Permalink
wgpu: Prefix WGPU labels with "vello." (#677)
Browse files Browse the repository at this point in the history
This makes them easier to identify as being from Vello when embedding
into an application.
  • Loading branch information
waywardmonkeys authored Sep 2, 2024
1 parent bf97b51 commit f08c2a8
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 40 deletions.
22 changes: 11 additions & 11 deletions vello/src/debug/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl DebugRenderer {

let clear_tint = engine.add_render_shader(
device,
"clear-tint",
"vello.debug.clear_tint",
&module,
"full_screen_quad_vert",
"solid_color_frag",
Expand All @@ -60,7 +60,7 @@ impl DebugRenderer {
);
let bboxes = engine.add_render_shader(
device,
"bbox-debug",
"vello.debug.bbox",
&module,
"bbox_vert",
"solid_color_frag",
Expand Down Expand Up @@ -91,7 +91,7 @@ impl DebugRenderer {
);
let linesoup = engine.add_render_shader(
device,
"linesoup-debug",
"vello.debug.linesoup",
&module,
"linesoup_vert",
"solid_color_frag",
Expand Down Expand Up @@ -122,7 +122,7 @@ impl DebugRenderer {
);
let linesoup_points = engine.add_render_shader(
device,
"linepoints-debug",
"vello.debug.linesoup_points",
&module,
"linepoints_vert",
"sdf_circle_frag",
Expand Down Expand Up @@ -162,7 +162,7 @@ impl DebugRenderer {
);
let unpaired_points = engine.add_render_shader(
device,
"linepoints-debug",
"vello.debug.unpaired_points",
&module,
"linepoints_vert",
"sdf_circle_frag",
Expand Down Expand Up @@ -230,10 +230,10 @@ impl DebugRenderer {
} else {
(
unpaired_pts.len(),
Some(
recording
.upload("unpaired points", bytemuck::cast_slice(&unpaired_pts[..])),
),
Some(recording.upload(
"vello.debug.unpaired_points",
bytemuck::cast_slice(&unpaired_pts[..]),
)),
)
}
} else {
Expand All @@ -245,15 +245,15 @@ impl DebugRenderer {
height: params.height,
};
let uniforms_buf = ResourceProxy::Buffer(
recording.upload_uniform("uniforms", bytemuck::bytes_of(&uniforms)),
recording.upload_uniform("vello.debug_uniforms", bytemuck::bytes_of(&uniforms)),
);

let linepoints_uniforms = [
LinepointsUniforms::new(Color::DARK_CYAN, 10.),
LinepointsUniforms::new(Color::RED, 80.),
];
let linepoints_uniforms_buf = recording.upload_uniform(
"linepoints uniforms",
"vello.debug.linepoints_uniforms",
bytemuck::bytes_of(&linepoints_uniforms),
);

Expand Down
2 changes: 1 addition & 1 deletion vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ impl BlitPipeline {
});
let shader_id = engine.add_render_shader(
device,
"blit",
"vello.blit",
&module,
"vs_main",
"fs_main",
Expand Down
62 changes: 35 additions & 27 deletions vello/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,25 @@ impl Render {
// is zero.
packed.resize(size_of::<u32>(), u8::MAX);
}
let scene_buf = ResourceProxy::Buffer(recording.upload("scene", packed));
let scene_buf = ResourceProxy::Buffer(recording.upload("vello.scene", packed));
let config_buf = ResourceProxy::Buffer(
recording.upload_uniform("config", bytemuck::bytes_of(&cpu_config.gpu)),
recording.upload_uniform("vello.config", bytemuck::bytes_of(&cpu_config.gpu)),
);
let info_bin_data_buf = ResourceProxy::new_buf(
buffer_sizes.bin_data.size_in_bytes() as u64,
"info_bin_data_buf",
"vello.info_bin_data_buf",
);
let tile_buf =
ResourceProxy::new_buf(buffer_sizes.tiles.size_in_bytes().into(), "tile_buf");
let segments_buf =
ResourceProxy::new_buf(buffer_sizes.segments.size_in_bytes().into(), "segments_buf");
let ptcl_buf = ResourceProxy::new_buf(buffer_sizes.ptcl.size_in_bytes().into(), "ptcl_buf");
ResourceProxy::new_buf(buffer_sizes.tiles.size_in_bytes().into(), "vello.tile_buf");
let segments_buf = ResourceProxy::new_buf(
buffer_sizes.segments.size_in_bytes().into(),
"vello.segments_buf",
);
let ptcl_buf =
ResourceProxy::new_buf(buffer_sizes.ptcl.size_in_bytes().into(), "vello.ptcl_buf");
let reduced_buf = ResourceProxy::new_buf(
buffer_sizes.path_reduced.size_in_bytes().into(),
"reduced_buf",
"vello.reduced_buf",
);
// TODO: really only need pathtag_wgs - 1
recording.dispatch(
Expand All @@ -207,7 +210,7 @@ impl Render {
if use_large_path_scan {
let reduced2_buf = ResourceProxy::new_buf(
buffer_sizes.path_reduced2.size_in_bytes().into(),
"reduced2_buf",
"vello.reduced2_buf",
);
recording.dispatch(
shaders.pathtag_reduce2,
Expand All @@ -229,7 +232,7 @@ impl Render {

let tagmonoid_buf = ResourceProxy::new_buf(
buffer_sizes.path_monoids.size_in_bytes().into(),
"tagmonoid_buf",
"vello.tagmonoid_buf",
);
let pathtag_scan = if use_large_path_scan {
shaders.pathtag_scan_large
Expand All @@ -248,18 +251,21 @@ impl Render {
}
let path_bbox_buf = ResourceProxy::new_buf(
buffer_sizes.path_bboxes.size_in_bytes().into(),
"path_bbox_buf",
"vello.path_bbox_buf",
);
recording.dispatch(
shaders.bbox_clear,
wg_counts.bbox_clear,
[config_buf, path_bbox_buf],
);
let bump_buf = BufferProxy::new(buffer_sizes.bump_alloc.size_in_bytes().into(), "bump_buf");
let bump_buf = BufferProxy::new(
buffer_sizes.bump_alloc.size_in_bytes().into(),
"vello.bump_buf",
);
recording.clear_all(bump_buf);
let bump_buf = ResourceProxy::Buffer(bump_buf);
let lines_buf =
ResourceProxy::new_buf(buffer_sizes.lines.size_in_bytes().into(), "lines_buf");
ResourceProxy::new_buf(buffer_sizes.lines.size_in_bytes().into(), "vello.lines_buf");
recording.dispatch(
shaders.flatten,
wg_counts.flatten,
Expand All @@ -274,7 +280,7 @@ impl Render {
);
let draw_reduced_buf = ResourceProxy::new_buf(
buffer_sizes.draw_reduced.size_in_bytes().into(),
"draw_reduced_buf",
"vello.draw_reduced_buf",
);
recording.dispatch(
shaders.draw_reduce,
Expand All @@ -283,11 +289,11 @@ impl Render {
);
let draw_monoid_buf = ResourceProxy::new_buf(
buffer_sizes.draw_monoids.size_in_bytes().into(),
"draw_monoid_buf",
"vello.draw_monoid_buf",
);
let clip_inp_buf = ResourceProxy::new_buf(
buffer_sizes.clip_inps.size_in_bytes().into(),
"clip_inp_buf",
"vello.clip_inp_buf",
);
recording.dispatch(
shaders.draw_leaf,
Expand All @@ -303,11 +309,13 @@ impl Render {
],
);
recording.free_resource(draw_reduced_buf);
let clip_el_buf =
ResourceProxy::new_buf(buffer_sizes.clip_els.size_in_bytes().into(), "clip_el_buf");
let clip_el_buf = ResourceProxy::new_buf(
buffer_sizes.clip_els.size_in_bytes().into(),
"vello.clip_el_buf",
);
let clip_bic_buf = ResourceProxy::new_buf(
buffer_sizes.clip_bics.size_in_bytes().into(),
"clip_bic_buf",
"vello.clip_bic_buf",
);
if wg_counts.clip_reduce.0 > 0 {
recording.dispatch(
Expand All @@ -318,7 +326,7 @@ impl Render {
}
let clip_bbox_buf = ResourceProxy::new_buf(
buffer_sizes.clip_bboxes.size_in_bytes().into(),
"clip_bbox_buf",
"vello.clip_bbox_buf",
);
if wg_counts.clip_leaf.0 > 0 {
recording.dispatch(
Expand All @@ -340,11 +348,11 @@ impl Render {
recording.free_resource(clip_el_buf);
let draw_bbox_buf = ResourceProxy::new_buf(
buffer_sizes.draw_bboxes.size_in_bytes().into(),
"draw_bbox_buf",
"vello.draw_bbox_buf",
);
let bin_header_buf = ResourceProxy::new_buf(
buffer_sizes.bin_headers.size_in_bytes().into(),
"bin_header_buf",
"vello.bin_header_buf",
);
recording.dispatch(
shaders.binning,
Expand All @@ -365,7 +373,7 @@ impl Render {
// Note: this only needs to be rounded up because of the workaround to store the tile_offset
// in storage rather than workgroup memory.
let path_buf =
ResourceProxy::new_buf(buffer_sizes.paths.size_in_bytes().into(), "path_buf");
ResourceProxy::new_buf(buffer_sizes.paths.size_in_bytes().into(), "vello.path_buf");
recording.dispatch(
shaders.tile_alloc,
wg_counts.tile_alloc,
Expand All @@ -382,7 +390,7 @@ impl Render {
recording.free_resource(tagmonoid_buf);
let indirect_count_buf = BufferProxy::new(
buffer_sizes.indirect_count.size_in_bytes().into(),
"indirect_count",
"vello.indirect_count",
);
recording.dispatch(
shaders.path_count_setup,
Expand All @@ -391,7 +399,7 @@ impl Render {
);
let seg_counts_buf = ResourceProxy::new_buf(
buffer_sizes.seg_counts.size_in_bytes().into(),
"seg_counts_buf",
"vello.seg_counts_buf",
);
recording.dispatch_indirect(
shaders.path_count,
Expand Down Expand Up @@ -453,7 +461,7 @@ impl Render {
let out_image = ImageProxy::new(params.width, params.height, ImageFormat::Rgba8);
let blend_spill_buf = BufferProxy::new(
buffer_sizes.blend_spill.size_in_bytes().into(),
"blend_spill",
"vello.blend_spill",
);
self.fine_wg_count = Some(wg_counts.fine);
self.fine_resources = Some(FineResources {
Expand Down Expand Up @@ -530,7 +538,7 @@ impl Render {
AaConfig::Msaa8 => make_mask_lut(),
_ => unreachable!(),
};
let buf = recording.upload("mask lut", mask_lut);
let buf = recording.upload("vello.mask_lut", mask_lut);
self.mask_buf = Some(buf.into());
}
let fine_shader = match fine.aa_config {
Expand Down
2 changes: 1 addition & 1 deletion vello/src/shaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub(crate) fn full_shaders(
let source = shaders.$name.wgsl.code;
engine.add_compute_shader(
device,
$label,
concat!("vello.", $label),
source,
&$bindings,
if force_gpu {
Expand Down

0 comments on commit f08c2a8

Please sign in to comment.