mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-12-04 13:54:48 +00:00
d3d12: Don't accumulate timestamp queries
If an app re-issues a timestamp query a lot, but doesn't ever ask for the results, we could end up running off the end of our query heap. But we don't actually need to advance/accumulate, so just use a single entry in the heap. Reviewed By: Bill Kristiansen <billkris@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12920>
This commit is contained in:
parent
34739cb6e2
commit
2d1f5e3dcb
@ -117,9 +117,12 @@ d3d12_create_query(struct pipe_context *pctx,
|
|||||||
query->num_queries = 16;
|
query->num_queries = 16;
|
||||||
|
|
||||||
/* With timer queries we want a few more queries, especially since we need two slots
|
/* With timer queries we want a few more queries, especially since we need two slots
|
||||||
* per query for TIME_ELAPSED queries */
|
* per query for TIME_ELAPSED queries
|
||||||
if (unlikely(query->d3d12qtype == D3D12_QUERY_TYPE_TIMESTAMP))
|
* For TIMESTAMP, we don't need more than one slot, since there's nothing to accumulate */
|
||||||
|
if (unlikely(query_type == PIPE_QUERY_TIME_ELAPSED))
|
||||||
query->num_queries = 64;
|
query->num_queries = 64;
|
||||||
|
else if (query_type == PIPE_QUERY_TIMESTAMP)
|
||||||
|
query->num_queries = 1;
|
||||||
|
|
||||||
query->curr_query = 0;
|
query->curr_query = 0;
|
||||||
|
|
||||||
@ -357,6 +360,10 @@ end_query(struct d3d12_context *ctx, struct d3d12_query *q)
|
|||||||
if (q->subquery)
|
if (q->subquery)
|
||||||
end_query(ctx, q->subquery);
|
end_query(ctx, q->subquery);
|
||||||
|
|
||||||
|
/* For TIMESTAMP, there's only one slot */
|
||||||
|
if (q->type == PIPE_QUERY_TIMESTAMP)
|
||||||
|
q->curr_query = 0;
|
||||||
|
|
||||||
/* With QUERY_TIME_ELAPSED we have recorded one value at
|
/* With QUERY_TIME_ELAPSED we have recorded one value at
|
||||||
* (2 * q->curr_query), and now we record a value at (2 * q->curr_query + 1)
|
* (2 * q->curr_query), and now we record a value at (2 * q->curr_query + 1)
|
||||||
* and when resolving the query we subtract the latter from the former */
|
* and when resolving the query we subtract the latter from the former */
|
||||||
|
Loading…
Reference in New Issue
Block a user