libs/vkd3d: Add ID3D12RootSignature interface stub.

This commit is contained in:
Józef Kucia 2016-09-26 11:13:30 +02:00
parent e18c2b58f1
commit aec10bd682
4 changed files with 194 additions and 1 deletions

View File

@ -24,6 +24,7 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/debug.c \
libs/vkd3d/device.c \
libs/vkd3d/resource.c \
libs/vkd3d/state.c \
libs/vkd3d/utils.c \
libs/vkd3d/vkd3d_main.c

View File

@ -662,11 +662,29 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature(ID3D12Device *
UINT node_mask, const void *bytecode, SIZE_T bytecode_length,
REFIID riid, void **root_signature)
{
struct d3d12_device *device = impl_from_ID3D12Device(iface);
struct d3d12_root_signature *object;
HRESULT hr;
FIXME("iface %p, node_mask 0x%08x, bytecode %p, bytecode_length %lu, "
"riid %s, root_signature %p stub!\n",
iface, node_mask, bytecode, bytecode_length, debugstr_guid(riid), root_signature);
return E_NOTIMPL;
if (node_mask && node_mask != 1)
FIXME("Ignoring node mask 0x%08x.\n", node_mask);
if (bytecode_length != ~0u)
{
FIXME("Root signature byte code not supported.\n");
return E_NOTIMPL;
}
if (FAILED(hr = d3d12_root_signature_create(device,
(const D3D12_ROOT_SIGNATURE_DESC *)bytecode, &object)))
return hr;
return return_interface((IUnknown *)&object->ID3D12RootSignature_iface,
&IID_ID3D12RootSignature, riid, root_signature);
}
static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView(ID3D12Device *iface,

162
libs/vkd3d/state.c Normal file
View File

@ -0,0 +1,162 @@
/*
* Copyright 2016 Józef Kucia for CodeWeavers
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "vkd3d_private.h"
/* ID3D12RootSignature */
static inline struct d3d12_root_signature *impl_from_ID3D12RootSignature(ID3D12RootSignature *iface)
{
return CONTAINING_RECORD(iface, struct d3d12_root_signature, ID3D12RootSignature_iface);
}
static HRESULT STDMETHODCALLTYPE d3d12_root_signature_QueryInterface(ID3D12RootSignature *iface,
REFIID riid, void **object)
{
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_ID3D12RootSignature)
|| IsEqualGUID(riid, &IID_ID3D12DeviceChild)
|| IsEqualGUID(riid, &IID_ID3D12Object)
|| IsEqualGUID(riid, &IID_IUnknown))
{
ID3D12RootSignature_AddRef(iface);
*object = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*object = NULL;
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE d3d12_root_signature_AddRef(ID3D12RootSignature *iface)
{
struct d3d12_root_signature *root_signature = impl_from_ID3D12RootSignature(iface);
ULONG refcount = InterlockedIncrement(&root_signature->refcount);
TRACE("%p increasing refcount to %u.\n", root_signature, refcount);
return refcount;
}
static ULONG STDMETHODCALLTYPE d3d12_root_signature_Release(ID3D12RootSignature *iface)
{
struct d3d12_root_signature *root_signature = impl_from_ID3D12RootSignature(iface);
ULONG refcount = InterlockedDecrement(&root_signature->refcount);
TRACE("%p decreasing refcount to %u.\n", root_signature, refcount);
if (!refcount)
{
struct d3d12_device *device = root_signature->device;
vkd3d_free(root_signature);
ID3D12Device_Release(&device->ID3D12Device_iface);
}
return refcount;
}
static HRESULT STDMETHODCALLTYPE d3d12_root_signature_GetPrivateData(ID3D12RootSignature *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_root_signature_SetPrivateData(ID3D12RootSignature *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_root_signature_SetPrivateDataInterface(ID3D12RootSignature *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_root_signature_SetName(ID3D12RootSignature *iface, const WCHAR *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_w(name));
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d12_root_signature_GetDevice(ID3D12RootSignature *iface,
REFIID riid, void **device)
{
struct d3d12_root_signature *root_signature = impl_from_ID3D12RootSignature(iface);
TRACE("iface %p, riid %s, device %p.\n", iface, debugstr_guid(riid), device);
return ID3D12Device_QueryInterface(&root_signature->device->ID3D12Device_iface, riid, device);
}
static const struct ID3D12RootSignatureVtbl d3d12_root_signature_vtbl =
{
/* IUnknown methods */
d3d12_root_signature_QueryInterface,
d3d12_root_signature_AddRef,
d3d12_root_signature_Release,
/* ID3D12Object methods */
d3d12_root_signature_GetPrivateData,
d3d12_root_signature_SetPrivateData,
d3d12_root_signature_SetPrivateDataInterface,
d3d12_root_signature_SetName,
/* ID3D12DeviceChild methods */
d3d12_root_signature_GetDevice,
};
static void d3d12_root_signature_init(struct d3d12_root_signature *root_signature,
struct d3d12_device *device, const D3D12_ROOT_SIGNATURE_DESC *desc)
{
root_signature->ID3D12RootSignature_iface.lpVtbl = &d3d12_root_signature_vtbl;
root_signature->refcount = 1;
root_signature->device = device;
ID3D12Device_AddRef(&device->ID3D12Device_iface);
}
HRESULT d3d12_root_signature_create(struct d3d12_device *device,
const D3D12_ROOT_SIGNATURE_DESC *desc, struct d3d12_root_signature **root_signature)
{
struct d3d12_root_signature *object;
if (!(object = vkd3d_malloc(sizeof(*object))))
return E_OUTOFMEMORY;
d3d12_root_signature_init(object, device, desc);
TRACE("Created root signature %p.\n", object);
*root_signature = object;
return S_OK;
}

View File

@ -70,6 +70,18 @@ struct d3d12_descriptor_heap
HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device,
const D3D12_DESCRIPTOR_HEAP_DESC *desc, struct d3d12_descriptor_heap **descriptor_heap) DECLSPEC_HIDDEN;
/* ID3D12RootSignature */
struct d3d12_root_signature
{
ID3D12RootSignature ID3D12RootSignature_iface;
ULONG refcount;
struct d3d12_device *device;
};
HRESULT d3d12_root_signature_create(struct d3d12_device *device,
const D3D12_ROOT_SIGNATURE_DESC *desc, struct d3d12_root_signature **root_signature) DECLSPEC_HIDDEN;
/* ID3D12CommandAllocator */
struct d3d12_command_allocator
{