From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/d3dcompiler_43/linker.c | 151 ++++++++++++++++++++++++ dlls/d3dcompiler_43/tests/hlsl_d3d11.c | 17 +++ dlls/d3dcompiler_47/d3dcompiler_47.spec | 2 +- include/d3dcompiler.h | 1 + 4 files changed, 170 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dcompiler_43/linker.c b/dlls/d3dcompiler_43/linker.c index 685a5fb286a..ddc953b0017 100644 --- a/dlls/d3dcompiler_43/linker.c +++ b/dlls/d3dcompiler_43/linker.c @@ -21,6 +21,157 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
+struct d3d11_function_linking_graph +{ + ID3D11FunctionLinkingGraph ID3D11FunctionLinkingGraph_iface; + LONG refcount; +}; + +static inline struct d3d11_function_linking_graph *impl_from_ID3D11FunctionLinkingGraph(ID3D11FunctionLinkingGraph *iface) +{ + return CONTAINING_RECORD(iface, struct d3d11_function_linking_graph, ID3D11FunctionLinkingGraph_iface); +} + +static HRESULT WINAPI d3d11_function_linking_graph_QueryInterface(ID3D11FunctionLinkingGraph *iface, REFIID riid, void **object) +{ + struct d3d11_function_linking_graph *graph = impl_from_ID3D11FunctionLinkingGraph(iface); + + TRACE("graph %p, riid %s, object %p.\n", graph, debugstr_guid(riid), object); + + if (IsEqualGUID(riid, &IID_ID3D11FunctionLinkingGraph) + || 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_function_linking_graph_AddRef(ID3D11FunctionLinkingGraph *iface) +{ + struct d3d11_function_linking_graph *graph = impl_from_ID3D11FunctionLinkingGraph(iface); + ULONG refcount = InterlockedIncrement(&graph->refcount); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI d3d11_function_linking_graph_Release(ID3D11FunctionLinkingGraph *iface) +{ + struct d3d11_function_linking_graph *graph = impl_from_ID3D11FunctionLinkingGraph(iface); + ULONG refcount = InterlockedDecrement(&graph->refcount); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + free(graph); + + return refcount; +} + +static HRESULT WINAPI d3d11_function_linking_graph_CreateModuleInstance(ID3D11FunctionLinkingGraph *iface, + ID3D11ModuleInstance **instance, ID3DBlob **error) +{ + FIXME("iface %p, instance %p, error %p stub!\n", iface, instance, error); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_function_linking_graph_SetInputSignature(ID3D11FunctionLinkingGraph *iface, + const D3D11_PARAMETER_DESC *parameter_desc, UINT parameter_count, ID3D11LinkingNode **input_node) +{ + FIXME("iface %p, parameter_desc %p, parameter_count %u, input_node %p stub!\n", iface, + parameter_desc, parameter_count, input_node); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_function_linking_graph_SetOutputSignature(ID3D11FunctionLinkingGraph *iface, + const D3D11_PARAMETER_DESC *parameter_desc, UINT parameter_count, ID3D11LinkingNode **output_node) +{ + FIXME("iface %p, parameter_desc %p, parameter_count %u, output_node %p stub!\n", iface, + parameter_desc, parameter_count, output_node); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_function_linking_graph_CallFunction(ID3D11FunctionLinkingGraph *iface, + LPCSTR namespace, ID3D11Module *module, LPCSTR function_name, ID3D11LinkingNode **call_node) +{ + FIXME("iface %p, namespace %s, module %p, function_name %s, call_node %p stub!\n", iface, + wine_dbgstr_a(namespace), module, wine_dbgstr_a(function_name), call_node); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_function_linking_graph_PassValue(ID3D11FunctionLinkingGraph *iface, + ID3D11LinkingNode *src_node, INT src_parameter_index, ID3D11LinkingNode *dst_node, + INT dst_parameter_index) +{ + FIXME("iface %p, src_node %p, src_parameter_index %d, dst_node %p, dst_parameter_index %d stub!\n", + iface, src_node, src_parameter_index, dst_node, dst_parameter_index); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_function_linking_graph_PassValueWithSwizzle(ID3D11FunctionLinkingGraph *iface, + ID3D11LinkingNode *src_node, INT src_parameter_index, LPCSTR src_swizzle, + ID3D11LinkingNode *dst_node, INT dst_parameter_index, LPCSTR dst_swizzle) +{ + FIXME("iface %p, src_node %p, src_parameter_index %d, src_swizzle %s, dst_node %p, " + "dst_parameter_index %d, dst_swizzle %s stub!\n", iface, src_node, src_parameter_index, + wine_dbgstr_a(src_swizzle), dst_node, dst_parameter_index, wine_dbgstr_a(dst_swizzle)); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_function_linking_graph_GetLastError(ID3D11FunctionLinkingGraph *iface, + ID3DBlob **error) +{ + FIXME("iface %p, error %p stub!\n", iface, error); + return E_NOTIMPL; +} + +static HRESULT WINAPI d3d11_function_linking_graph_GenerateHlsl(ID3D11FunctionLinkingGraph *iface, + UINT flags, ID3DBlob **buffer) +{ + FIXME("iface %p, flags %#x, buffer %p stub!\n", iface, flags, buffer); + return E_NOTIMPL; +} + +static const struct ID3D11FunctionLinkingGraphVtbl d3d11_function_linking_graph_vtbl = +{ + d3d11_function_linking_graph_QueryInterface, + d3d11_function_linking_graph_AddRef, + d3d11_function_linking_graph_Release, + d3d11_function_linking_graph_CreateModuleInstance, + d3d11_function_linking_graph_SetInputSignature, + d3d11_function_linking_graph_SetOutputSignature, + d3d11_function_linking_graph_CallFunction, + d3d11_function_linking_graph_PassValue, + d3d11_function_linking_graph_PassValueWithSwizzle, + d3d11_function_linking_graph_GetLastError, + d3d11_function_linking_graph_GenerateHlsl, +}; + +HRESULT WINAPI D3DCreateFunctionLinkingGraph(UINT flags, ID3D11FunctionLinkingGraph **graph) +{ + struct d3d11_function_linking_graph *object; + + TRACE("flags %#x, graph %p.\n", flags, graph); + + if (flags != 0 || !graph) + return E_INVALIDARG; + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->ID3D11FunctionLinkingGraph_iface.lpVtbl = &d3d11_function_linking_graph_vtbl; + object->refcount = 1; + + *graph = &object->ID3D11FunctionLinkingGraph_iface; + return S_OK; +} + struct d3d11_linker { ID3D11Linker ID3D11Linker_iface; diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c index 8f1ce3af37d..087bcc22da2 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c @@ -1179,6 +1179,22 @@ static void test_D3DCreateLinker(void) linker->lpVtbl->Release(linker); }
+static void test_D3DCreateFunctionLinkingGraph(void) +{ + ID3D11FunctionLinkingGraph *graph; + HRESULT hr; + + hr = D3DCreateFunctionLinkingGraph(0, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + hr = D3DCreateFunctionLinkingGraph(1, &graph); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + hr = D3DCreateFunctionLinkingGraph(0, &graph); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + graph->lpVtbl->Release(graph); +} + #endif /* D3D_COMPILER_VERSION >= 47 */
START_TEST(hlsl_d3d11) @@ -1189,6 +1205,7 @@ START_TEST(hlsl_d3d11) test_semantic_reflection(); #if D3D_COMPILER_VERSION >= 47 test_D3DCreateLinker(); + test_D3DCreateFunctionLinkingGraph(); #endif
if (!(mod = LoadLibraryA("d3d11.dll"))) diff --git a/dlls/d3dcompiler_47/d3dcompiler_47.spec b/dlls/d3dcompiler_47/d3dcompiler_47.spec index 3ed049e6ab8..333dde2979c 100644 --- a/dlls/d3dcompiler_47/d3dcompiler_47.spec +++ b/dlls/d3dcompiler_47/d3dcompiler_47.spec @@ -4,7 +4,7 @@ @ stdcall D3DCompileFromFile(wstr ptr ptr str str long long ptr ptr) @ stub D3DCompressShaders @ stdcall D3DCreateBlob(long ptr) -@ stub D3DCreateFunctionLinkingGraph +@ stdcall D3DCreateFunctionLinkingGraph(long ptr) @ stdcall D3DCreateLinker(ptr) @ stub D3DDecompressShaders @ stdcall D3DDisassemble(ptr long long ptr ptr) diff --git a/include/d3dcompiler.h b/include/d3dcompiler.h index 87821a9031a..14e599081d8 100644 --- a/include/d3dcompiler.h +++ b/include/d3dcompiler.h @@ -153,6 +153,7 @@ typedef HRESULT (WINAPI *pD3DPreprocess)(const void *data, SIZE_T size, const ch const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages);
+HRESULT WINAPI D3DCreateFunctionLinkingGraph(UINT flags, ID3D11FunctionLinkingGraph **graph); HRESULT WINAPI D3DCreateLinker(ID3D11Linker **linker); HRESULT WINAPI D3DLoadModule(const void *data, SIZE_T size, ID3D11Module **module);