-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Query resolve #1638
Labels
Milestone
Comments
bors bot
added a commit
that referenced
this issue
Nov 23, 2017
1640: Query operations r=kvark a=msiglreith First steps regarding full query support. This PR only contains query pool creation and recording. Resolve is still up to discussion #1638 . Implementation details: * D3D12 uses binary occlusion queries if `PRECISE` is not specified * D3D12 internally caches the currently used query to have access on the query type on end * Query operations are supported on compute and graphics command buffers. Therefore a new helper capability is introduced which is implemented for Compute, Graphics and General command buffers to circumvent this. ~~**WIP** as there are outstanding ash changes (and might include resolve operations)~~
Note: this is currently a blocker for Dolphin on Metal. Adding the tag. |
This was referenced Aug 18, 2018
bors bot
added a commit
that referenced
this issue
Aug 23, 2018
2334: Query API and basic support on Metal r=grovesNL a=kvark Fixes #1638 (for the most part) PR checklist: - [x] `make` succeeds (on *nix) - [x] `make reftests` succeeds - [ ] tested examples with the following backends: - [ ] `rustfmt` run on changed code Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
bors bot
added a commit
that referenced
this issue
Aug 23, 2018
2334: Query API and basic support on Metal r=grovesNL a=kvark Fixes #1638 (for the most part) PR checklist: - [x] `make` succeeds (on *nix) - [x] `make reftests` succeeds - [ ] tested examples with the following backends: - [ ] `rustfmt` run on changed code Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
bors bot
added a commit
that referenced
this issue
Aug 23, 2018
2334: Query API and basic support on Metal r=grovesNL a=kvark Fixes #1638 (for the most part) PR checklist: - [x] `make` succeeds (on *nix) - [x] `make reftests` succeeds - [ ] tested examples with the following backends: - [ ] `rustfmt` run on changed code Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Overview
We have 3 types of queries in Vulkan: Occlusion, PipelineStatistics and Timestamp.
The first two are handled via
vkCmdBeginQuery
/vkCmdEndQuery
and timestamps viavkCmdWriteTimestamp
. Queries are allocated in heaps and marked as 'unavailable' at the beginning.vkCmdBeginQuery
calls activate queries and once the results can be obtained (aftervkCmdEndQuery
) the state will switch toavailable
.vkResetQueryPool
will reset them tounavailable
.Mapping to Metal
Metal doesn't expose any significant kind of timestamp or pipeline statistics support (afaik) and only supports
Counting occlusion query
.Therefore,
pipelineStatisticsQuery
feature should be exposed asfalse
,timestampComputeAndGraphics
as false andtimestampValidBits
as 0 for all queues.Occlusion queries are configured at renderpass boundary. Binary occlusion support is required and counting optional. Results are directly written to a buffer.
Mapping to D3D12
D3D12 uses query heaps, similar to Vulkan's query pools. The begin/end/write commands can be mapped without significant overhead to D3D12. Reset command implementation depends on the further Vulkan Portability API.
Resolving query data in D3D12 is implemented as a command list function
ResolveQueryData
(https://msdn.microsoft.com/de-de/library/windows/desktop/dn903896(v=vs.85).aspx). It write the current query values contiguously to a buffer (upload/download/local) as 64bit integers.Vulkan exposes two functions to resolve queries:
vkGetQueryPoolResults
(device-side) andvkCmdCopyQueryPoolResults
(command buffer-side). Beside additional effort to submit a command buffer with a query resolve to emulate the device function, theVkQueryResultFlags
are difficult to handle:VK_QUERY_RESULT_64_BIT
denotes that values are written as u64 values (default: u32)VK_QUERY_RESULT_WITH_AVAILABILITY_BIT
adds an additional integer value indicating if the specific query is available to the buffer.VK_QUERY_RESULT_WAIT_BIT
waits on all queries to be available, else resulting in a possible device loss.Additionally, users can define which pipeline statistics can should be recorded and only marked statistics get written to the buffer. D3D12 will emit all statistics.
Issues
available/unavailable
) of each query in the query heap to correctly emit the availability flags if requested. As these happen async it needs to be done in the command buffer. For example, compute shader to write availability values into an hidden buffer on command buffer end if we have Begin/EndQuery commands.VK_QUERY_RESULT_64_BIT
is not set.VK_QUERY_RESULT_WAIT_BIT
is set.I think these are the main issues so far. Metal requires a bit further analysis but shouldn't cause major complications.
The text was updated successfully, but these errors were encountered: