mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Fixes for mac
Fix incorrect workgroup sizes, and change strategy for assigning binding numbers; ultimately we should get correct values for those from shader compilation, but this works for now.
This commit is contained in:
parent
395d400cd1
commit
3ee81ad5a9
|
@ -277,7 +277,8 @@ impl crate::backend::Device for MtlDevice {
|
|||
}
|
||||
|
||||
unsafe fn destroy_image(&self, _image: &Self::Image) -> Result<(), Error> {
|
||||
todo!()
|
||||
// TODO figure out what we want to do here
|
||||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn create_compute_pipeline(
|
||||
|
@ -429,7 +430,7 @@ impl crate::backend::CmdBuf<MtlDevice> for CmdBuf {
|
|||
encoder.set_buffer(buf_ix, Some(&buffer.buffer), 0);
|
||||
buf_ix += 1;
|
||||
}
|
||||
let mut img_ix = 0;
|
||||
let mut img_ix = buf_ix;
|
||||
for image in &descriptor_set.images {
|
||||
encoder.set_texture(img_ix, Some(&image.texture));
|
||||
img_ix += 1;
|
||||
|
|
|
@ -264,6 +264,7 @@ fn main() -> Result<(), Error> {
|
|||
submitted.wait()?;
|
||||
println!("elapsed = {:?}", start.elapsed());
|
||||
let ts = session.fetch_query_pool(&query_pool).unwrap();
|
||||
if !ts.is_empty() {
|
||||
println!("Element kernel time: {:.3}ms", ts[0] * 1e3);
|
||||
println!(
|
||||
"Tile allocation kernel time: {:.3}ms",
|
||||
|
@ -274,12 +275,12 @@ fn main() -> Result<(), Error> {
|
|||
println!("Binning kernel time: {:.3}ms", (ts[4] - ts[3]) * 1e3);
|
||||
println!("Coarse raster kernel time: {:.3}ms", (ts[5] - ts[4]) * 1e3);
|
||||
println!("Render kernel time: {:.3}ms", (ts[6] - ts[5]) * 1e3);
|
||||
}
|
||||
|
||||
/*
|
||||
let mut data: Vec<u32> = Default::default();
|
||||
renderer.memory_buf_dev.read(&mut data).unwrap();
|
||||
piet_gpu::dump_k1_data(&data[2..]);
|
||||
trace_ptcl(&data);
|
||||
*/
|
||||
|
||||
let mut img_data: Vec<u8> = Default::default();
|
||||
|
|
|
@ -79,6 +79,7 @@ fn main() -> Result<(), Error> {
|
|||
if let Some(submitted) = submitted[frame_idx].take() {
|
||||
cmd_bufs[frame_idx] = submitted.wait().unwrap();
|
||||
let ts = session.fetch_query_pool(&query_pools[frame_idx]).unwrap();
|
||||
if !ts.is_empty() {
|
||||
info_string = format!(
|
||||
"{:.3}ms :: e:{:.3}ms|alloc:{:.3}ms|cp:{:.3}ms|bd:{:.3}ms|bin:{:.3}ms|cr:{:.3}ms|r:{:.3}ms",
|
||||
ts[6] * 1e3,
|
||||
|
@ -91,6 +92,7 @@ fn main() -> Result<(), Error> {
|
|||
(ts[6] - ts[5]) * 1e3,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let mut ctx = PietGpuRenderContext::new();
|
||||
if let Some(input) = matches.value_of("INPUT") {
|
||||
|
|
|
@ -81,6 +81,7 @@ pub struct Renderer {
|
|||
|
||||
backdrop_pipeline: Pipeline,
|
||||
backdrop_ds: DescriptorSet,
|
||||
backdrop_y: u32,
|
||||
|
||||
bin_pipeline: Pipeline,
|
||||
bin_ds: DescriptorSet,
|
||||
|
@ -170,11 +171,12 @@ impl Renderer {
|
|||
let path_ds = session
|
||||
.create_simple_descriptor_set(&path_pipeline, &[&memory_buf_dev, &config_buf])?;
|
||||
|
||||
let backdrop_code = if session.gpu_info().workgroup_limits.max_invocations >= 1024 {
|
||||
include_shader!(session, "../shader/gen/backdrop_lg")
|
||||
let (backdrop_code, backdrop_y) =
|
||||
if session.gpu_info().workgroup_limits.max_invocations >= 1024 {
|
||||
(include_shader!(session, "../shader/gen/backdrop_lg"), 4)
|
||||
} else {
|
||||
println!("using small workgroup backdrop kernel");
|
||||
include_shader!(session, "../shader/gen/backdrop")
|
||||
(include_shader!(session, "../shader/gen/backdrop"), 1)
|
||||
};
|
||||
let backdrop_pipeline = session
|
||||
.create_compute_pipeline(backdrop_code, &[BindType::Buffer, BindType::BufReadOnly])?;
|
||||
|
@ -243,6 +245,7 @@ impl Renderer {
|
|||
path_ds,
|
||||
backdrop_pipeline,
|
||||
backdrop_ds,
|
||||
backdrop_y,
|
||||
bin_pipeline,
|
||||
bin_ds,
|
||||
coarse_pipeline,
|
||||
|
@ -367,7 +370,7 @@ impl Renderer {
|
|||
&self.backdrop_pipeline,
|
||||
&self.backdrop_ds,
|
||||
(((self.n_paths + 255) / 256) as u32, 1, 1),
|
||||
(256, 1, 1),
|
||||
(256, self.backdrop_y, 1),
|
||||
);
|
||||
cmd_buf.write_timestamp(&query_pool, 4);
|
||||
// Note: this barrier is not needed as an actual dependency between
|
||||
|
@ -390,7 +393,7 @@ impl Renderer {
|
|||
(self.height as u32 + 255) / 256,
|
||||
1,
|
||||
),
|
||||
(256, 256, 1),
|
||||
(256, 1, 1),
|
||||
);
|
||||
cmd_buf.write_timestamp(&query_pool, 6);
|
||||
cmd_buf.memory_barrier();
|
||||
|
|
Loading…
Reference in a new issue