From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/d3dcompiler_43/compiler.c | 99 +++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c index 58f3e3a4358..81d1b7b93a0 100644 --- a/dlls/d3dcompiler_43/compiler.c +++ b/dlls/d3dcompiler_43/compiler.c @@ -21,6 +21,7 @@ #define COBJMACROS #include <stdarg.h> #include <time.h> +#include <d3d11shader.h> #include "wine/debug.h"
#include "d3dcompiler_private.h" @@ -489,12 +490,106 @@ end: return hr; }
-HRESULT WINAPI D3DCreateLinker(ID3D11Linker **linker) +struct d3d11_linker +{ + ID3D11Linker ID3D11Linker_iface; + LONG refcount; +}; + +static inline struct d3d11_linker *impl_from_ID3D11Linker(ID3D11Linker *iface) +{ + return CONTAINING_RECORD(iface, struct d3d11_linker, ID3D11Linker_iface); +} + +static HRESULT WINAPI d3d11_linker_QueryInterface(ID3D11Linker *iface, REFIID riid, void **object) +{ + struct d3d11_linker *linker = impl_from_ID3D11Linker(iface); + + TRACE("linker %p, riid %s, object %p.\n", linker, debugstr_guid(riid), object); + + if (IsEqualGUID(riid, &IID_ID3D11Linker) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IUnknown_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 WINAPI d3d11_linker_AddRef(ID3D11Linker *iface) +{ + struct d3d11_linker *linker = impl_from_ID3D11Linker(iface); + ULONG refcount = InterlockedIncrement(&linker->refcount); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3d11_linker_Release(ID3D11Linker *iface) { - FIXME("linker %p stub!\n", linker); + struct d3d11_linker *linker = impl_from_ID3D11Linker(iface); + ULONG refcount = InterlockedDecrement(&linker->refcount); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + free(linker); + + return refcount; +} + +static HRESULT WINAPI d3d11_linker_Link(ID3D11Linker *iface, ID3D11ModuleInstance *instance, + LPCSTR instance_name, LPCSTR target_name, UINT flags, ID3DBlob **shader, ID3DBlob **error) +{ + FIXME("iface %p, instance %p, instance_name %s, target_name %s, flags %#x, shader %p, error %p stub!\n", + iface, instance, debugstr_a(instance_name), debugstr_a(target_name), flags, shader, error); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_linker_UseLibrary(ID3D11Linker *iface, ID3D11ModuleInstance *instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); return E_NOTIMPL; }
+static HRESULT WINAPI d3d11_linker_AddClipPlaneFromCBuffer(ID3D11Linker *iface, UINT buffer_slot, + UINT buffer_entry) +{ + FIXME("iface %p, buffer_slot %u, buffer_entry %u stub!\n", iface, buffer_slot, buffer_entry); + return E_NOTIMPL; +} + +static const struct ID3D11LinkerVtbl d3d11_linker_vtbl = +{ + d3d11_linker_QueryInterface, + d3d11_linker_AddRef, + d3d11_linker_Release, + d3d11_linker_Link, + d3d11_linker_UseLibrary, + d3d11_linker_AddClipPlaneFromCBuffer, +}; + +HRESULT WINAPI D3DCreateLinker(ID3D11Linker **linker) +{ + struct d3d11_linker *object; + + TRACE("linker %p.\n", linker); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->ID3D11Linker_iface.lpVtbl = &d3d11_linker_vtbl; + object->refcount = 1; + + *linker = &object->ID3D11Linker_iface; + return S_OK; +} + HRESULT WINAPI D3DLoadModule(const void *data, SIZE_T size, ID3D11Module **module) { FIXME("data %p, size %Iu, module %p stub!\n", data, size, module);