diff --git a/piet-gpu/bin/android.rs b/piet-gpu/bin/android.rs index 8254cc0..968405e 100644 --- a/piet-gpu/bin/android.rs +++ b/piet-gpu/bin/android.rs @@ -110,7 +110,7 @@ impl GfxState { .map(|_| session.create_semaphore()) .collect::, Error>>()?; let query_pools = (0..NUM_FRAMES) - .map(|_| session.create_query_pool(8)) + .map(|_| session.create_query_pool(Renderer::QUERY_POOL_SIZE)) .collect::, Error>>()?; let submitted = Default::default(); let cmd_bufs = Default::default(); diff --git a/piet-gpu/bin/cli.rs b/piet-gpu/bin/cli.rs index 7d577d3..79914bf 100644 --- a/piet-gpu/bin/cli.rs +++ b/piet-gpu/bin/cli.rs @@ -232,7 +232,7 @@ fn main() -> Result<(), Error> { let session = Session::new(device); let mut cmd_buf = session.cmd_buf()?; - let query_pool = session.create_query_pool(8)?; + let query_pool = session.create_query_pool(Renderer::QUERY_POOL_SIZE)?; let mut ctx = PietGpuRenderContext::new(); if let Some(input) = matches.value_of("INPUT") { diff --git a/piet-gpu/bin/winit.rs b/piet-gpu/bin/winit.rs index 78867f5..8f84da4 100644 --- a/piet-gpu/bin/winit.rs +++ b/piet-gpu/bin/winit.rs @@ -70,7 +70,7 @@ fn main() -> Result<(), Error> { .map(|_| session.create_semaphore()) .collect::, Error>>()?; let query_pools = (0..NUM_FRAMES) - .map(|_| session.create_query_pool(12)) + .map(|_| session.create_query_pool(Renderer::QUERY_POOL_SIZE)) .collect::, Error>>()?; let mut cmd_bufs: [Option; NUM_FRAMES] = Default::default(); let mut submitted: [Option; NUM_FRAMES] = Default::default(); diff --git a/piet-gpu/src/lib.rs b/piet-gpu/src/lib.rs index ba06e71..c75f41f 100644 --- a/piet-gpu/src/lib.rs +++ b/piet-gpu/src/lib.rs @@ -143,6 +143,9 @@ impl RenderConfig { } impl Renderer { + /// The number of query pool entries needed to run the renderer. + pub const QUERY_POOL_SIZE: u32 = 12; + pub unsafe fn new( session: &Session, width: usize,