From 9bb06ec34074072f9c37d5f6aa8e3b774f679271 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Fri, 15 May 2020 20:57:07 -0700 Subject: [PATCH] Correct rendering (on Intel) Handle multiple passes in coarse raster. Doesn't work on NV, WIP to find out why. --- piet-gpu/bin/cli.rs | 50 +++++++++++++++++++++++++++++++----- piet-gpu/shader/coarse.comp | 18 ++++++++----- piet-gpu/shader/coarse.spv | Bin 28508 -> 28728 bytes piet-gpu/src/lib.rs | 4 +-- piet-gpu/src/pico_svg.rs | 2 +- 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/piet-gpu/bin/cli.rs b/piet-gpu/bin/cli.rs index f37f0cd..c5c0b6b 100644 --- a/piet-gpu/bin/cli.rs +++ b/piet-gpu/bin/cli.rs @@ -34,6 +34,47 @@ fn dump_state(buf: &[u8]) { } +/// Interpret the output of the binning stage, for diagnostic purposes. +#[allow(unused)] +fn trace_merge(buf: &[u32]) { + for bin in 0..256 { + println!("bin {}:", bin); + let mut starts = (0..16).map(|i| Some((bin * 16 + i) * 64)).collect::>>(); + loop { + let min_start = starts.iter().map(|st| + st.map(|st| + if buf[st / 4] == 0 { + !0 + } else { + buf[st / 4 + 2] + }).unwrap_or(!0)).min().unwrap(); + if min_start == !0 { + break; + } + let mut selected = !0; + for i in 0..16 { + if let Some(st) = starts[i] { + if buf[st/4] != 0 && buf[st/4 + 2] == min_start { + selected = i; + break; + } + } + } + let st = starts[selected].unwrap(); + println!("selected {}, start {:x}", selected, st); + for j in 0..buf[st/4] { + println!("{:x}", buf[st/4 + 2 + j as usize]) + } + if buf[st/4 + 1] == 0 { + starts[selected] = None; + } else { + starts[selected] = Some(buf[st/4 + 1] as usize); + } + } + + } +} + fn main() -> Result<(), Error> { let (instance, _) = VkInstance::new(None)?; unsafe { @@ -66,12 +107,9 @@ fn main() -> Result<(), Error> { /* let mut data: Vec = Default::default(); - device.read_buffer(&renderer.ptcl_buf, &mut data).unwrap(); - piet_gpu::dump_k1_data(&data); - - let mut data: Vec = Default::default(); - device.read_buffer(&renderer.anno_buf, &mut data).unwrap(); - piet_gpu::dump_k1_data(&data); + device.read_buffer(&renderer.bin_buf, &mut data).unwrap(); + //piet_gpu::dump_k1_data(&data); + //trace_merge(&data); */ let mut img_data: Vec = Default::default(); diff --git a/piet-gpu/shader/coarse.comp b/piet-gpu/shader/coarse.comp index f94dc6b..2ca0cff 100644 --- a/piet-gpu/shader/coarse.comp +++ b/piet-gpu/shader/coarse.comp @@ -109,8 +109,8 @@ void main() { sh_first_el[th_ix] = chunk.n > 0 ? BinInstance_read(BinInstanceRef(start_chunk + BinChunk_size)).element_ix : ~0; } - uint probe = 0; // for debugging - do { + uint count = 0; + while (true) { for (uint i = 0; i < N_SLICE; i++) { sh_bitmaps[i][th_ix] = 0; } @@ -121,18 +121,18 @@ void main() { if (th_ix < N_WG) { if (th_ix == 0) { sh_selected_n = 0; - sh_min_buf = ~1; + sh_min_buf = ~0; } } barrier(); // Tempting to do this with subgroups, but atomic should be good enough. - my_min = sh_first_el[th_ix]; if (th_ix < N_WG) { + my_min = sh_first_el[th_ix]; atomicMin(sh_min_buf, my_min); } barrier(); if (th_ix < N_WG) { - if (sh_first_el[th_ix] == sh_min_buf) { + if (my_min == sh_min_buf && my_min != ~0) { sh_elements_ref = sh_chunk[th_ix] + BinChunk_size; uint selected_n = sh_chunk_n[th_ix]; sh_selected_n = selected_n; @@ -162,6 +162,7 @@ void main() { } wr_ix += chunk_n; } + barrier(); // We've done the merge and filled the buffer. @@ -272,8 +273,11 @@ void main() { // clear LSB bitmap &= bitmap - 1; } + barrier(); rd_ix += N_TILE; - break; - } while (wr_ix > rd_ix); + // The second disjunct is there as a strange workaround on Nvidia. If it is + // removed, then the kernel fails with ERROR_DEVICE_LOST. + if (rd_ix >= wr_ix || bin_ix == ~0) break; + } } diff --git a/piet-gpu/shader/coarse.spv b/piet-gpu/shader/coarse.spv index 92ecbaeaacb77cb54ebebc5636530de4b14dbc82..b0bec3f996366f3fc5f8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@K1XwL| z@CaBf&&Zv@pQMMHm|ChmK|Bu4e>T|dL?>~G6ZvUS7<@g^%*Ovaj z3RX-1UjwIqc$L|uS+>hUb+os%)-$zr=e*6JgE&I_JYMGB8 zg4MDge*{*m_hWq){upjPWj{YbQ_t9c3eMP#;n>ymOJ6?&mwo*lu9m&$x63c!_T}1_ z{rwVMTl)JIIQ<#N{?znqpX+7B@>)vC*?Cce?ek)abA1VQ=K7DsajxZ_oqsF1&#r$K zT>HNop0na{xP6pk_%)h(=HoYD`_A7?{0^><`ac-YAE>?jn+a{dr>L2$*uHMT{ul5Q z6#M!uS$9)E30HS+UCY0Mog>GkEjj!htmgB}Gxi@~HGLhkT;J2NJq315+8n=Jo9+G$ z)?b@*AkQ;pcTJ#r@%)xU9k6mzNj#iU#X*CB?N^PMv)-jsCK4Y&*T+-q*V| zJmczs+gJXEu@kQ5nz;wM!CvkGZC#X2DE2GPep?l6p5=a94NX0B_B^nf^OOEp2Rn}J z!8PFesoVdW)L!9mYYk}MM;5umP*@O8TKj&^;^yKSW$@R~8)+_AEb$vAT zjAsL|nsKuSHUg{rH#x?2Y-;X-7~x?-6gBe}XKl6t zx3A5%XzJzKI0x=uZOLIfuv+rm9;{Z*`3`XPa?aHfV@I:nxHOwSzGU}vye{%&g* zux-?BqtCA3tkZO`+uKV diff --git a/piet-gpu/src/lib.rs b/piet-gpu/src/lib.rs index bf7a7c7..2dca39d 100644 --- a/piet-gpu/src/lib.rs +++ b/piet-gpu/src/lib.rs @@ -65,7 +65,7 @@ pub fn render_scene(rc: &mut impl RenderContext) { #[allow(unused)] fn render_cardioid(rc: &mut impl RenderContext) { - let n = 91; + let n = 601; let dth = std::f64::consts::PI * 2.0 / (n as f64); let center = Point::new(1024.0, 768.0); let r = 750.0; @@ -73,7 +73,7 @@ fn render_cardioid(rc: &mut impl RenderContext) { for i in 1..n { let p0 = center + Vec2::from_angle(i as f64 * dth) * r; let p1 = center + Vec2::from_angle(((i * 2) % n) as f64 * dth) * r; - rc.fill(&Circle::new(p0, 8.0), &Color::WHITE); + //rc.fill(&Circle::new(p0, 8.0), &Color::WHITE); path.move_to(p0); path.line_to(p1); //rc.stroke(Line::new(p0, p1), &Color::BLACK, 2.0); diff --git a/piet-gpu/src/pico_svg.rs b/piet-gpu/src/pico_svg.rs index a630f70..9cf5cc3 100644 --- a/piet-gpu/src/pico_svg.rs +++ b/piet-gpu/src/pico_svg.rs @@ -48,7 +48,7 @@ impl PicoSvg { } if let Some(stroke_color) = el.attribute("stroke") { let width = - f64::from_str(el.attribute("stroke-width").ok_or("missing width")?)?; + scale * f64::from_str(el.attribute("stroke-width").ok_or("missing width")?)?; let color = parse_color(stroke_color); items.push(Item::Stroke(StrokeItem { width, color, path })); }