mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-09 20:31:29 +11:00
Merge pull request #4 from linebender/reset_query_pool
Reset query pool before use
This commit is contained in:
commit
d22c68b609
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -114,6 +114,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b"
|
||||
|
||||
[[package]]
|
||||
name = "piet"
|
||||
version = "0.0.12"
|
||||
|
@ -149,6 +155,7 @@ name = "piet-gpu-hal"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -17,6 +17,7 @@ fn main() {
|
|||
let query_pool = device.create_query_pool(2).unwrap();
|
||||
let mut cmd_buf = device.create_cmd_buf().unwrap();
|
||||
cmd_buf.begin();
|
||||
cmd_buf.reset_query_pool(&query_pool);
|
||||
cmd_buf.write_timestamp(&query_pool, 0);
|
||||
cmd_buf.dispatch(&pipeline, &descriptor_set, (256, 1, 1));
|
||||
cmd_buf.write_timestamp(&query_pool, 1);
|
||||
|
|
|
@ -80,6 +80,13 @@ pub trait CmdBuf<D: Device> {
|
|||
|
||||
unsafe fn copy_buffer(&self, src: &D::Buffer, dst: &D::Buffer);
|
||||
|
||||
/// Reset the query pool.
|
||||
///
|
||||
/// The query pool must be reset before each use, to avoid validation errors.
|
||||
/// This is annoying, and we could tweak the API to make it implicit, doing
|
||||
/// the reset before the first timestamp write.
|
||||
unsafe fn reset_query_pool(&mut self, pool: &D::QueryPool);
|
||||
|
||||
unsafe fn write_timestamp(&mut self, pool: &D::QueryPool, query: u32);
|
||||
}
|
||||
|
||||
|
|
|
@ -573,6 +573,16 @@ impl crate::CmdBuf<VkDevice> for CmdBuf {
|
|||
);
|
||||
}
|
||||
|
||||
unsafe fn reset_query_pool(&mut self, pool: &QueryPool) {
|
||||
let device = &self.device.device;
|
||||
device.cmd_reset_query_pool(
|
||||
self.cmd_buf,
|
||||
pool.pool,
|
||||
0,
|
||||
pool.n_queries,
|
||||
);
|
||||
}
|
||||
|
||||
unsafe fn write_timestamp(&mut self, pool: &QueryPool, query: u32) {
|
||||
let device = &self.device.device;
|
||||
device.cmd_write_timestamp(
|
||||
|
|
|
@ -181,6 +181,7 @@ fn main() {
|
|||
cmd_buf.clear_buffer(&tilegroup_buf);
|
||||
cmd_buf.clear_buffer(&ptcl_buf);
|
||||
cmd_buf.memory_barrier();
|
||||
cmd_buf.reset_query_pool(&query_pool);
|
||||
cmd_buf.write_timestamp(&query_pool, 0);
|
||||
cmd_buf.dispatch(
|
||||
&k1_pipeline,
|
||||
|
|
Loading…
Reference in a new issue