mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
libs/vkd3d: Implement ResolveQueryData() for QUERY_TYPE_PIPELINE_STATISTICS.
This commit is contained in:
@@ -3101,6 +3101,28 @@ static D3D12_QUERY_HEAP_TYPE vkd3d_query_heap_type_from_query_type(D3D12_QUERY_T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UINT64 vkd3d_query_type_result_size(D3D12_QUERY_TYPE type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case D3D12_QUERY_TYPE_OCCLUSION:
|
||||||
|
case D3D12_QUERY_TYPE_BINARY_OCCLUSION:
|
||||||
|
case D3D12_QUERY_TYPE_TIMESTAMP:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM1:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM2:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3:
|
||||||
|
return 8;
|
||||||
|
|
||||||
|
case D3D12_QUERY_TYPE_PIPELINE_STATISTICS:
|
||||||
|
return sizeof(struct D3D12_QUERY_DATA_PIPELINE_STATISTICS);
|
||||||
|
|
||||||
|
default:
|
||||||
|
WARN("Invalid query type %#x.\n", type);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d12_command_list_BeginQuery(ID3D12GraphicsCommandList *iface,
|
static void STDMETHODCALLTYPE d3d12_command_list_BeginQuery(ID3D12GraphicsCommandList *iface,
|
||||||
ID3D12QueryHeap *heap, D3D12_QUERY_TYPE type, UINT index)
|
ID3D12QueryHeap *heap, D3D12_QUERY_TYPE type, UINT index)
|
||||||
{
|
{
|
||||||
@@ -3208,22 +3230,31 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(ID3D12Graphics
|
|||||||
WARN("Destination resource is not a buffer.\n");
|
WARN("Destination resource is not a buffer.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((aligned_dst_buffer_offset + 8) > buffer->desc.Width)
|
if ((aligned_dst_buffer_offset + vkd3d_query_type_result_size(type)) > buffer->desc.Width)
|
||||||
{
|
{
|
||||||
WARN("Would overflow destination buffer (%"PRIu64" + 8 > %"PRIu64").\n",
|
WARN("Would overflow destination buffer (%"PRIu64" + %"PRIu64" > %"PRIu64").\n",
|
||||||
aligned_dst_buffer_offset, buffer->desc.Width);
|
aligned_dst_buffer_offset, vkd3d_query_type_result_size(type), buffer->desc.Width);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != D3D12_QUERY_TYPE_TIMESTAMP)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
case D3D12_QUERY_TYPE_TIMESTAMP:
|
||||||
|
case D3D12_QUERY_TYPE_PIPELINE_STATISTICS:
|
||||||
|
VK_CALL(vkCmdCopyQueryPoolResults(list->vk_command_buffer, query_heap->vk_query_pool,
|
||||||
|
start_index, query_count, buffer->u.vk_buffer, aligned_dst_buffer_offset,
|
||||||
|
vkd3d_query_type_result_size(type), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT));
|
||||||
|
return;
|
||||||
|
|
||||||
|
case D3D12_QUERY_TYPE_OCCLUSION:
|
||||||
|
case D3D12_QUERY_TYPE_BINARY_OCCLUSION:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM1:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM2:
|
||||||
|
case D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3:
|
||||||
FIXME("Unhandled query type %#x.\n", type);
|
FIXME("Unhandled query type %#x.\n", type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VK_CALL(vkCmdCopyQueryPoolResults(list->vk_command_buffer, query_heap->vk_query_pool, start_index,
|
|
||||||
query_count, buffer->u.vk_buffer, aligned_dst_buffer_offset, 8,
|
|
||||||
VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d12_command_list_SetPredication(ID3D12GraphicsCommandList *iface,
|
static void STDMETHODCALLTYPE d3d12_command_list_SetPredication(ID3D12GraphicsCommandList *iface,
|
||||||
|
Reference in New Issue
Block a user