Merge pull request #1658 from billhollings/fix-query-pool-wait-block

Fix query pool wait block when query is not encoded to be written to.
This commit is contained in:
Bill Hollings 2022-07-24 16:54:29 -04:00 committed by GitHub
commit ed1f1f4866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,7 @@ Released TBD
- Work around MTLCounterSet crash on additional Intel Iris Plus Graphics drivers.
- Check `MTLDevice` to enable support for `VK_KHR_fragment_shader_barycentric`
and `VK_NV_fragment_shader_barycentric` extensions.
- Fix query pool wait block when query is not encoded to be written to.
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to version `35`.

View File

@ -107,12 +107,16 @@ bool MVKQueryPool::areQueriesDeviceAvailable(uint32_t firstQuery, uint32_t endQu
return true;
}
// Returns whether all the queries between the start (inclusive) and end (exclusive) queries are available.
// Returns whether any queries between the start (inclusive) and end (exclusive) queries,
// that were encoded to be written to by an earlier EndQuery or Timestamp command, are now available.
// Queries that were not encoded to be written, will be in Initial state.
// Queries that were encoded to be written, and are available, will be in Available state.
// Queries that were encoded to be written, but are not available, will be in DeviceAvailable state.
bool MVKQueryPool::areQueriesHostAvailable(uint32_t firstQuery, uint32_t endQuery) {
// If we lost the device, stop waiting immediately.
if (_device->getConfigurationResult() != VK_SUCCESS) { return true; }
for (uint32_t query = firstQuery; query < endQuery; query++) {
if ( _availability[query] < Available ) { return false; }
if (_availability[query] == DeviceAvailable) { return false; }
}
return true;
}