Implement d3d12_device_CreateQueryHeap().

This commit is contained in:
Henri Verbeet 2017-07-23 15:02:41 +02:00
parent e9046a81cc
commit 1acd3d44b1
4 changed files with 159 additions and 7 deletions

View File

@ -3431,13 +3431,13 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_signature_SetName(ID3D12CommandSi
} }
static HRESULT STDMETHODCALLTYPE d3d12_command_signature_GetDevice(ID3D12CommandSignature *iface, static HRESULT STDMETHODCALLTYPE d3d12_command_signature_GetDevice(ID3D12CommandSignature *iface,
REFIID riid, void **device) REFIID iid, void **device)
{ {
struct d3d12_command_signature *signature = impl_from_ID3D12CommandSignature(iface); struct d3d12_command_signature *signature = impl_from_ID3D12CommandSignature(iface);
TRACE("iface %p, riid %s, device %p.\n", iface, debugstr_guid(riid), device); TRACE("iface %p, iid %s, device %p.\n", iface, debugstr_guid(iid), device);
return ID3D12Device_QueryInterface(&signature->device->ID3D12Device_iface, riid, device); return ID3D12Device_QueryInterface(&signature->device->ID3D12Device_iface, iid, device);
} }
static const struct ID3D12CommandSignatureVtbl d3d12_command_signature_vtbl = static const struct ID3D12CommandSignatureVtbl d3d12_command_signature_vtbl =

View File

@ -1122,12 +1122,20 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device *i
} }
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateQueryHeap(ID3D12Device *iface, static HRESULT STDMETHODCALLTYPE d3d12_device_CreateQueryHeap(ID3D12Device *iface,
const D3D12_QUERY_HEAP_DESC *desc, REFIID riid, void **heap) const D3D12_QUERY_HEAP_DESC *desc, REFIID iid, void **heap)
{ {
FIXME("iface %p, desc %p, riid %s, heap %p stub!\n", struct d3d12_device *device = impl_from_ID3D12Device(iface);
iface, desc, debugstr_guid(riid), heap); struct d3d12_query_heap *object;
HRESULT hr;
return E_NOTIMPL; TRACE("iface %p, desc %p, iid %s, heap %p.\n",
iface, desc, debugstr_guid(iid), heap);
if (FAILED(hr = d3d12_query_heap_create(device, &object)))
return hr;
return return_interface((IUnknown *)&object->ID3D12QueryHeap_iface,
&IID_ID3D12QueryHeap, iid, heap);
} }
static HRESULT STDMETHODCALLTYPE d3d12_device_SetStablePowerState(ID3D12Device *iface, BOOL enable) static HRESULT STDMETHODCALLTYPE d3d12_device_SetStablePowerState(ID3D12Device *iface, BOOL enable)

View File

@ -1436,3 +1436,135 @@ HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device,
return S_OK; return S_OK;
} }
/* ID3D12QueryHeap */
static inline struct d3d12_query_heap *impl_from_ID3D12QueryHeap(ID3D12QueryHeap *iface)
{
return CONTAINING_RECORD(iface, struct d3d12_query_heap, ID3D12QueryHeap_iface);
}
static HRESULT STDMETHODCALLTYPE d3d12_query_heap_QueryInterface(ID3D12QueryHeap *iface,
REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_ID3D12QueryHeap)
|| IsEqualGUID(iid, &IID_ID3D12Pageable)
|| IsEqualGUID(iid, &IID_ID3D12DeviceChild)
|| IsEqualGUID(iid, &IID_ID3D12Object)
|| IsEqualGUID(iid, &IID_IUnknown))
{
ID3D12QueryHeap_AddRef(iface);
*out = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
*out = NULL;
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE d3d12_query_heap_AddRef(ID3D12QueryHeap *iface)
{
struct d3d12_query_heap *heap = impl_from_ID3D12QueryHeap(iface);
ULONG refcount = InterlockedIncrement(&heap->refcount);
TRACE("%p increasing refcount to %u.\n", heap, refcount);
return refcount;
}
static ULONG STDMETHODCALLTYPE d3d12_query_heap_Release(ID3D12QueryHeap *iface)
{
struct d3d12_query_heap *heap = impl_from_ID3D12QueryHeap(iface);
ULONG refcount = InterlockedDecrement(&heap->refcount);
TRACE("%p decreasing refcount to %u.\n", heap, refcount);
if (!refcount)
{
struct d3d12_device *device = heap->device;
vkd3d_free(heap);
ID3D12Device_Release(&device->ID3D12Device_iface);
}
return refcount;
}
static HRESULT STDMETHODCALLTYPE d3d12_query_heap_GetPrivateData(ID3D12QueryHeap *iface,
REFGUID guid, UINT *data_size, void *data)
{
FIXME("iface %p, guid %s, data_size %p, data %p stub!", iface, debugstr_guid(guid), data_size, data);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d12_query_heap_SetPrivateData(ID3D12QueryHeap *iface,
REFGUID guid, UINT data_size, const void *data)
{
FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d12_query_heap_SetPrivateDataInterface(ID3D12QueryHeap *iface,
REFGUID guid, const IUnknown *data)
{
FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d12_query_heap_SetName(ID3D12QueryHeap *iface, const WCHAR *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_w(name));
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d12_query_heap_GetDevice(ID3D12QueryHeap *iface,
REFIID iid, void **device)
{
struct d3d12_query_heap *heap = impl_from_ID3D12QueryHeap(iface);
TRACE("iface %p, iid %s, device %p.\n", iface, debugstr_guid(iid), device);
return ID3D12Device_QueryInterface(&heap->device->ID3D12Device_iface, iid, device);
}
static const struct ID3D12QueryHeapVtbl d3d12_query_heap_vtbl =
{
/* IUnknown methods */
d3d12_query_heap_QueryInterface,
d3d12_query_heap_AddRef,
d3d12_query_heap_Release,
/* ID3D12Object methods */
d3d12_query_heap_GetPrivateData,
d3d12_query_heap_SetPrivateData,
d3d12_query_heap_SetPrivateDataInterface,
d3d12_query_heap_SetName,
/* ID3D12DeviceChild methods */
d3d12_query_heap_GetDevice,
};
HRESULT d3d12_query_heap_create(struct d3d12_device *device, struct d3d12_query_heap **heap)
{
struct d3d12_query_heap *object;
if (!(object = vkd3d_malloc(sizeof(*object))))
return E_OUTOFMEMORY;
object->ID3D12QueryHeap_iface.lpVtbl = &d3d12_query_heap_vtbl;
object->refcount = 1;
object->device = device;
ID3D12Device_AddRef(&device->ID3D12Device_iface);
TRACE("Created query heap %p.\n", object);
*heap = object;
return S_OK;
}

View File

@ -227,6 +227,18 @@ struct d3d12_descriptor_heap
HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device, HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device,
const D3D12_DESCRIPTOR_HEAP_DESC *desc, struct d3d12_descriptor_heap **descriptor_heap) DECLSPEC_HIDDEN; const D3D12_DESCRIPTOR_HEAP_DESC *desc, struct d3d12_descriptor_heap **descriptor_heap) DECLSPEC_HIDDEN;
/* ID3D12QueryHeap */
struct d3d12_query_heap
{
ID3D12QueryHeap ID3D12QueryHeap_iface;
LONG refcount;
struct d3d12_device *device;
};
HRESULT d3d12_query_heap_create(struct d3d12_device *device,
struct d3d12_query_heap **heap) DECLSPEC_HIDDEN;
/* ID3D12RootSignature */ /* ID3D12RootSignature */
struct d3d12_root_signature struct d3d12_root_signature
{ {