From ee6694729bdf83aaf64023eb718a8a321a30c602 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Thu, 19 May 2022 14:31:00 -0700 Subject: [PATCH 1/3] Fix query pool size This was causing harmless warnings on mac but causing rendering to fail on Pixel 6. --- piet-gpu/bin/android.rs | 2 +- piet-gpu/bin/cli.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/piet-gpu/bin/android.rs b/piet-gpu/bin/android.rs index 8254cc0..25fcaed 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(12)) .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 abe6ae1..6d7dcda 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(12)?; let mut ctx = PietGpuRenderContext::new(); if let Some(input) = matches.value_of("INPUT") { From 693ecd69e1ccbcd28cfa5847ddaaebb6879a6a93 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Thu, 19 May 2022 15:28:46 -0700 Subject: [PATCH 2/3] Make query pool size an associated constant --- piet-gpu/bin/android.rs | 2 +- piet-gpu/bin/winit.rs | 2 +- piet-gpu/src/lib.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/piet-gpu/bin/android.rs b/piet-gpu/bin/android.rs index 25fcaed..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(12)) + .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/winit.rs b/piet-gpu/bin/winit.rs index 1642026..3341d3a 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 d32a9c5..f5e91d5 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, From d62a40ea34a2942a849dffef188c02d5930d3d1b Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Thu, 19 May 2022 15:35:15 -0700 Subject: [PATCH 3/3] Update piet-gpu/bin/cli.rs Co-authored-by: Chad Brokaw --- piet-gpu/bin/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piet-gpu/bin/cli.rs b/piet-gpu/bin/cli.rs index 6d7dcda..4c785eb 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(12)?; + let query_pool = session.create_query_pool(Renderer::QUERY_POOL_SIZE)?; let mut ctx = PietGpuRenderContext::new(); if let Some(input) = matches.value_of("INPUT") {