libs/vkd3d: Avoid vkCmdCopyQueryPoolResults() for not issued queries.

The Vulkan spec states:

  * "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."

  * "If queries will never finish (e.g. due to being reset but not
    issued), then vkGetQueryPoolResults may not return in finite time."
This commit is contained in:
Józef Kucia
2017-09-14 14:57:09 +02:00
parent 334c532401
commit 2ea8ffb554
4 changed files with 54 additions and 5 deletions

View File

@@ -1871,14 +1871,17 @@ HRESULT d3d12_query_heap_create(struct d3d12_device *device, const D3D12_QUERY_H
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
struct d3d12_query_heap *object;
VkQueryPoolCreateInfo pool_info;
unsigned int element_count;
VkResult vr;
if (!(object = vkd3d_malloc(sizeof(*object))))
element_count = DIV_ROUND_UP(desc->Count, sizeof(*object->availability_mask) * CHAR_BIT);
if (!(object = vkd3d_malloc(offsetof(struct d3d12_query_heap, availability_mask[element_count]))))
return E_OUTOFMEMORY;
object->ID3D12QueryHeap_iface.lpVtbl = &d3d12_query_heap_vtbl;
object->refcount = 1;
object->device = device;
memset(object->availability_mask, 0, element_count * sizeof(*object->availability_mask));
pool_info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
pool_info.pNext = NULL;