mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d: Implement SO statistics 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:
committed by
Alexandre Julliard
parent
7b84adec32
commit
2ce7b2305a
@@ -1749,6 +1749,12 @@ typedef struct D3D12_QUERY_DATA_PIPELINE_STATISTICS
|
|||||||
UINT64 CSInvocations;
|
UINT64 CSInvocations;
|
||||||
} D3D12_QUERY_DATA_PIPELINE_STATISTICS;
|
} D3D12_QUERY_DATA_PIPELINE_STATISTICS;
|
||||||
|
|
||||||
|
typedef struct D3D12_QUERY_DATA_SO_STATISTICS
|
||||||
|
{
|
||||||
|
UINT64 NumPrimitivesWritten;
|
||||||
|
UINT64 PrimitivesStorageNeeded;
|
||||||
|
} D3D12_QUERY_DATA_SO_STATISTICS;
|
||||||
|
|
||||||
typedef enum D3D12_PREDICATION_OP
|
typedef enum D3D12_PREDICATION_OP
|
||||||
{
|
{
|
||||||
D3D12_PREDICATION_OP_EQUAL_ZERO = 0,
|
D3D12_PREDICATION_OP_EQUAL_ZERO = 0,
|
||||||
|
@@ -4080,10 +4080,19 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginQuery(ID3D12GraphicsComman
|
|||||||
|
|
||||||
d3d12_command_list_end_current_render_pass(list);
|
d3d12_command_list_end_current_render_pass(list);
|
||||||
|
|
||||||
|
VK_CALL(vkCmdResetQueryPool(list->vk_command_buffer, query_heap->vk_query_pool, index, 1));
|
||||||
|
|
||||||
if (type == D3D12_QUERY_TYPE_OCCLUSION)
|
if (type == D3D12_QUERY_TYPE_OCCLUSION)
|
||||||
flags = VK_QUERY_CONTROL_PRECISE_BIT;
|
flags = VK_QUERY_CONTROL_PRECISE_BIT;
|
||||||
|
|
||||||
VK_CALL(vkCmdResetQueryPool(list->vk_command_buffer, query_heap->vk_query_pool, index, 1));
|
if (D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 <= type && type <= D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3)
|
||||||
|
{
|
||||||
|
unsigned int stream_index = type - D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0;
|
||||||
|
VK_CALL(vkCmdBeginQueryIndexedEXT(list->vk_command_buffer,
|
||||||
|
query_heap->vk_query_pool, index, flags, stream_index));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VK_CALL(vkCmdBeginQuery(list->vk_command_buffer, query_heap->vk_query_pool, index, flags));
|
VK_CALL(vkCmdBeginQuery(list->vk_command_buffer, query_heap->vk_query_pool, index, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4110,9 +4119,28 @@ static void STDMETHODCALLTYPE d3d12_command_list_EndQuery(ID3D12GraphicsCommandL
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 <= type && type <= D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3)
|
||||||
|
{
|
||||||
|
unsigned int stream_index = type - D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0;
|
||||||
|
VK_CALL(vkCmdEndQueryIndexedEXT(list->vk_command_buffer,
|
||||||
|
query_heap->vk_query_pool, index, stream_index));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VK_CALL(vkCmdEndQuery(list->vk_command_buffer, query_heap->vk_query_pool, index));
|
VK_CALL(vkCmdEndQuery(list->vk_command_buffer, query_heap->vk_query_pool, index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static size_t get_query_stride(D3D12_QUERY_TYPE type)
|
||||||
|
{
|
||||||
|
if (type == D3D12_QUERY_TYPE_PIPELINE_STATISTICS)
|
||||||
|
return sizeof(D3D12_QUERY_DATA_PIPELINE_STATISTICS);
|
||||||
|
|
||||||
|
if (D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 <= type && type <= D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3)
|
||||||
|
return sizeof(D3D12_QUERY_DATA_SO_STATISTICS);
|
||||||
|
|
||||||
|
return sizeof(uint64_t);
|
||||||
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(ID3D12GraphicsCommandList *iface,
|
static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(ID3D12GraphicsCommandList *iface,
|
||||||
ID3D12QueryHeap *heap, D3D12_QUERY_TYPE type, UINT start_index, UINT query_count,
|
ID3D12QueryHeap *heap, D3D12_QUERY_TYPE type, UINT start_index, UINT query_count,
|
||||||
ID3D12Resource *dst_buffer, UINT64 aligned_dst_buffer_offset)
|
ID3D12Resource *dst_buffer, UINT64 aligned_dst_buffer_offset)
|
||||||
@@ -4120,9 +4148,9 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(ID3D12Graphics
|
|||||||
const struct d3d12_query_heap *query_heap = unsafe_impl_from_ID3D12QueryHeap(heap);
|
const struct d3d12_query_heap *query_heap = unsafe_impl_from_ID3D12QueryHeap(heap);
|
||||||
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);
|
||||||
VkDeviceSize offset, stride = sizeof(uint64_t);
|
|
||||||
const struct vkd3d_vk_device_procs *vk_procs;
|
const struct vkd3d_vk_device_procs *vk_procs;
|
||||||
unsigned int i, first, count;
|
unsigned int i, first, count;
|
||||||
|
VkDeviceSize offset, stride;
|
||||||
|
|
||||||
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",
|
||||||
@@ -4149,8 +4177,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(ID3D12Graphics
|
|||||||
|
|
||||||
d3d12_command_list_end_current_render_pass(list);
|
d3d12_command_list_end_current_render_pass(list);
|
||||||
|
|
||||||
if (type == D3D12_QUERY_TYPE_PIPELINE_STATISTICS)
|
stride = get_query_stride(type);
|
||||||
stride = sizeof(struct D3D12_QUERY_DATA_PIPELINE_STATISTICS);
|
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
first = start_index;
|
first = start_index;
|
||||||
|
@@ -945,6 +945,7 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
|
|||||||
vulkan_info->device_limits = device_properties2.properties.limits;
|
vulkan_info->device_limits = device_properties2.properties.limits;
|
||||||
vulkan_info->sparse_properties = device_properties2.properties.sparseProperties;
|
vulkan_info->sparse_properties = device_properties2.properties.sparseProperties;
|
||||||
vulkan_info->rasterization_stream = xfb_properties.transformFeedbackRasterizationStreamSelect;
|
vulkan_info->rasterization_stream = xfb_properties.transformFeedbackRasterizationStreamSelect;
|
||||||
|
vulkan_info->transform_feedback_queries = xfb_properties.transformFeedbackQueries;
|
||||||
vulkan_info->max_vertex_attrib_divisor = max(vertex_divisor_properties.maxVertexAttribDivisor, 1);
|
vulkan_info->max_vertex_attrib_divisor = max(vertex_divisor_properties.maxVertexAttribDivisor, 1);
|
||||||
|
|
||||||
device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64;
|
device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64;
|
||||||
|
@@ -2835,9 +2835,16 @@ HRESULT d3d12_query_heap_create(struct d3d12_device *device, const D3D12_QUERY_H
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case D3D12_QUERY_HEAP_TYPE_SO_STATISTICS:
|
case D3D12_QUERY_HEAP_TYPE_SO_STATISTICS:
|
||||||
FIXME("Unsupported query heap type SO_STATISTICS.\n");
|
if (!device->vk_info.transform_feedback_queries)
|
||||||
vkd3d_free(object);
|
{
|
||||||
return E_NOTIMPL;
|
FIXME("Transform feedback queries are not supported by Vulkan implementation.\n");
|
||||||
|
vkd3d_free(object);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pool_info.queryType = VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT;
|
||||||
|
pool_info.pipelineStatistics = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WARN("Invalid query heap type %u.\n", desc->Type);
|
WARN("Invalid query heap type %u.\n", desc->Type);
|
||||||
|
@@ -93,6 +93,7 @@ struct vkd3d_vulkan_info
|
|||||||
bool EXT_vertex_attribute_divisor;
|
bool EXT_vertex_attribute_divisor;
|
||||||
|
|
||||||
bool rasterization_stream;
|
bool rasterization_stream;
|
||||||
|
bool transform_feedback_queries;
|
||||||
|
|
||||||
bool vertex_attrib_zero_divisor;
|
bool vertex_attrib_zero_divisor;
|
||||||
unsigned int max_vertex_attrib_divisor;
|
unsigned int max_vertex_attrib_divisor;
|
||||||
|
@@ -19007,10 +19007,15 @@ static void test_create_query_heap(void)
|
|||||||
heap_desc.NodeMask = 0;
|
heap_desc.NodeMask = 0;
|
||||||
|
|
||||||
hr = ID3D12Device_CreateQueryHeap(device, &heap_desc, &IID_ID3D12QueryHeap, (void **)&query_heap);
|
hr = ID3D12Device_CreateQueryHeap(device, &heap_desc, &IID_ID3D12QueryHeap, (void **)&query_heap);
|
||||||
todo ok(hr == S_OK, "Failed to create query heap, type %u, hr %#x.\n", heap_desc.Type, hr);
|
if (hr != E_NOTIMPL)
|
||||||
|
{
|
||||||
if (hr == S_OK)
|
ok(hr == S_OK, "Failed to create query heap, type %u, hr %#x.\n", heap_desc.Type, hr);
|
||||||
ID3D12QueryHeap_Release(query_heap);
|
ID3D12QueryHeap_Release(query_heap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skip("Stream output is not supported.\n");
|
||||||
|
}
|
||||||
|
|
||||||
refcount = ID3D12Device_Release(device);
|
refcount = ID3D12Device_Release(device);
|
||||||
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
||||||
|
Reference in New Issue
Block a user