Fix bbox bug

Bounding boxes were being calculated as way too large in the element
processing.

Also wire up counters so winit binary is happy.
This commit is contained in:
Raph Levien 2020-05-16 21:20:25 -07:00
parent 9bb06ec340
commit fe1790e724
3 changed files with 3 additions and 3 deletions

View file

@ -37,7 +37,7 @@ fn main() -> Result<(), Error> {
.map(|_| device.create_cmd_buf()) .map(|_| device.create_cmd_buf())
.collect::<Result<Vec<_>, Error>>()?; .collect::<Result<Vec<_>, Error>>()?;
let query_pools = (0..NUM_FRAMES) let query_pools = (0..NUM_FRAMES)
.map(|_| device.create_query_pool(6)) .map(|_| device.create_query_pool(5))
.collect::<Result<Vec<_>, Error>>()?; .collect::<Result<Vec<_>, Error>>()?;
let mut ctx = PietGpuRenderContext::new(); let mut ctx = PietGpuRenderContext::new();
@ -70,12 +70,11 @@ fn main() -> Result<(), Error> {
let timestamps = device.reap_query_pool(query_pool).unwrap(); let timestamps = device.reap_query_pool(query_pool).unwrap();
window.set_title(&format!( window.set_title(&format!(
"k1: {:.3}ms, k2s: {:.3}ms, k2f: {:.3}ms, k3: {:.3}ms, k4: {:.3}ms", "e: {:.3}ms, b: {:.3}ms, c: {:.3}ms, f: {:.3}ms",
timestamps[0] * 1e3, timestamps[0] * 1e3,
(timestamps[1] - timestamps[0]) * 1e3, (timestamps[1] - timestamps[0]) * 1e3,
(timestamps[2] - timestamps[1]) * 1e3, (timestamps[2] - timestamps[1]) * 1e3,
(timestamps[3] - timestamps[2]) * 1e3, (timestamps[3] - timestamps[2]) * 1e3,
(timestamps[4] - timestamps[3]) * 1e3,
)); ));
} }

View file

@ -82,6 +82,7 @@ State combine_state(State a, State b) {
c.translate.y = a.mat.y * b.translate.x + a.mat.w * b.translate.y + a.translate.y; c.translate.y = a.mat.y * b.translate.x + a.mat.w * b.translate.y + a.translate.y;
c.linewidth = (b.flags & FLAG_SET_LINEWIDTH) == 0 ? a.linewidth : b.linewidth; c.linewidth = (b.flags & FLAG_SET_LINEWIDTH) == 0 ? a.linewidth : b.linewidth;
c.flags = (a.flags & (FLAG_SET_LINEWIDTH | FLAG_SET_BBOX)) | b.flags; c.flags = (a.flags & (FLAG_SET_LINEWIDTH | FLAG_SET_BBOX)) | b.flags;
c.flags |= (a.flags & FLAG_RESET_BBOX) >> 1;
return c; return c;
} }

Binary file not shown.