mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d: Try to call vkCmdCopyQueryPoolResults() for multiple queries.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
71e633cb1b
commit
4cfd3a425f
@ -3885,8 +3885,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(ID3D12Graphics
|
|||||||
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
|
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
|
||||||
struct d3d12_resource *buffer = unsafe_impl_from_ID3D12Resource(dst_buffer);
|
struct d3d12_resource *buffer = unsafe_impl_from_ID3D12Resource(dst_buffer);
|
||||||
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
|
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
|
||||||
VkDeviceSize stride = sizeof(uint64_t);
|
VkDeviceSize offset, stride = sizeof(uint64_t);
|
||||||
unsigned int i;
|
unsigned int i, first, count;
|
||||||
|
|
||||||
TRACE("iface %p, heap %p, type %#x, start_index %u, query_count %u, "
|
TRACE("iface %p, heap %p, type %#x, start_index %u, query_count %u, "
|
||||||
"dst_buffer %p, aligned_dst_buffer_offset %#"PRIx64".\n",
|
"dst_buffer %p, aligned_dst_buffer_offset %#"PRIx64".\n",
|
||||||
@ -3914,26 +3914,45 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(ID3D12Graphics
|
|||||||
if (type == D3D12_QUERY_TYPE_PIPELINE_STATISTICS)
|
if (type == D3D12_QUERY_TYPE_PIPELINE_STATISTICS)
|
||||||
stride = sizeof(struct D3D12_QUERY_DATA_PIPELINE_STATISTICS);
|
stride = sizeof(struct D3D12_QUERY_DATA_PIPELINE_STATISTICS);
|
||||||
|
|
||||||
/* We cannot copy query results if a query was not issued:
|
count = 0;
|
||||||
*
|
first = start_index;
|
||||||
* "If the query does not become available in a finite amount of time
|
offset = aligned_dst_buffer_offset;
|
||||||
* (e.g. due to not issuing a query since the last reset),
|
|
||||||
* a VK_ERROR_DEVICE_LOST error may occur."
|
|
||||||
*/
|
|
||||||
for (i = 0; i < query_count; ++i)
|
for (i = 0; i < query_count; ++i)
|
||||||
{
|
{
|
||||||
const UINT64 offset = aligned_dst_buffer_offset + i * stride;
|
if (d3d12_query_heap_is_result_available(query_heap, start_index + i))
|
||||||
const unsigned int query_index = start_index + i;
|
|
||||||
|
|
||||||
if (!d3d12_query_heap_is_result_available(query_heap, query_index))
|
|
||||||
{
|
{
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
|
VK_CALL(vkCmdCopyQueryPoolResults(list->vk_command_buffer,
|
||||||
|
query_heap->vk_query_pool, first, count, buffer->u.vk_buffer,
|
||||||
|
offset, stride, VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT));
|
||||||
|
}
|
||||||
|
count = 0;
|
||||||
|
first = start_index + i;
|
||||||
|
offset = aligned_dst_buffer_offset + i * stride;
|
||||||
|
|
||||||
|
/* We cannot copy query results if a query was not issued:
|
||||||
|
*
|
||||||
|
* "If the query does not become available in a finite amount of
|
||||||
|
* time (e.g. due to not issuing a query since the last reset),
|
||||||
|
* a VK_ERROR_DEVICE_LOST error may occur."
|
||||||
|
*/
|
||||||
VK_CALL(vkCmdFillBuffer(list->vk_command_buffer,
|
VK_CALL(vkCmdFillBuffer(list->vk_command_buffer,
|
||||||
buffer->u.vk_buffer, offset, stride, 0x00000000));
|
buffer->u.vk_buffer, offset, stride, 0x00000000));
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
++first;
|
||||||
|
offset += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
VK_CALL(vkCmdCopyQueryPoolResults(list->vk_command_buffer,
|
VK_CALL(vkCmdCopyQueryPoolResults(list->vk_command_buffer,
|
||||||
query_heap->vk_query_pool, query_index, 1, buffer->u.vk_buffer,
|
query_heap->vk_query_pool, first, count, buffer->u.vk_buffer,
|
||||||
offset, stride, VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT));
|
offset, stride, VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user