[PATCH 5/5] d3d10_1: Implement D3D10CreateDevice1().
Henri Verbeet
hverbeet at codeweavers.com
Tue Feb 11 04:42:24 CST 2014
---
dlls/d3d10_1/Makefile.in | 8 ++
dlls/d3d10_1/d3d10_1.spec | 30 +++++++
dlls/d3d10_1/d3d10_1_main.c | 182 +++++++++++++++++++++++++++++++++++++++++++
dlls/d3d10_1/version.rc | 26 +++++++
4 files changed, 246 insertions(+)
create mode 100644 dlls/d3d10_1/Makefile.in
create mode 100644 dlls/d3d10_1/d3d10_1.spec
create mode 100644 dlls/d3d10_1/d3d10_1_main.c
create mode 100644 dlls/d3d10_1/version.rc
diff --git a/dlls/d3d10_1/Makefile.in b/dlls/d3d10_1/Makefile.in
new file mode 100644
index 0000000..50ae038
--- /dev/null
+++ b/dlls/d3d10_1/Makefile.in
@@ -0,0 +1,8 @@
+MODULE = d3d10_1.dll
+IMPORTLIB = d3d10_1
+IMPORTS = dxguid d3d10core dxgi
+
+C_SRCS = \
+ d3d10_1_main.c
+
+RC_SRCS = version.rc
diff --git a/dlls/d3d10_1/d3d10_1.spec b/dlls/d3d10_1/d3d10_1.spec
new file mode 100644
index 0000000..5ec86f8
--- /dev/null
+++ b/dlls/d3d10_1/d3d10_1.spec
@@ -0,0 +1,30 @@
+@ stub RevertToOldImplementation
+@ stub D3D10CompileEffectFromMemory
+@ stub D3D10CompileShader
+@ stub D3D10CreateBlob
+@ stdcall D3D10CreateDevice1(ptr long ptr long long long ptr)
+@ stub D3D10CreateDeviceAndSwapChain1
+@ stub D3D10CreateEffectFromMemory
+@ stub D3D10CreateEffectPoolFromMemory
+@ stub D3D10CreateStateBlock
+@ stub D3D10DisassembleEffect
+@ stub D3D10DisassembleShader
+@ stub D3D10GetGeometryShaderProfile
+@ stub D3D10GetInputAndOutputSignatureBlob
+@ stub D3D10GetInputSignatureBlob
+@ stub D3D10GetOutputSignatureBlob
+@ stub D3D10GetPixelShaderProfile
+@ stub D3D10GetShaderDebugInfo
+@ stub D3D10GetVersion
+@ stub D3D10GetVertexShaderProfile
+@ stub D3D10PreprocessShader
+@ stub D3D10ReflectShader
+@ stub D3D10RegisterLayers
+@ stub D3D10StateBlockMaskDifference
+@ stub D3D10StateBlockMaskDisableAll
+@ stub D3D10StateBlockMaskDisableCapture
+@ stub D3D10StateBlockMaskEnableAll
+@ stub D3D10StateBlockMaskEnableCapture
+@ stub D3D10StateBlockMaskGetSetting
+@ stub D3D10StateBlockMaskIntersect
+@ stub D3D10StateBlockMaskUnion
diff --git a/dlls/d3d10_1/d3d10_1_main.c b/dlls/d3d10_1/d3d10_1_main.c
new file mode 100644
index 0000000..c1aa5eb
--- /dev/null
+++ b/dlls/d3d10_1/d3d10_1_main.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2014 Henri Verbeet for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include "config.h"
+#include "wine/port.h"
+#include "wine/debug.h"
+
+#define COBJMACROS
+#include "d3d10_1.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
+
+HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter,
+ UINT flags, void *unknown0, ID3D10Device **device);
+
+#define WINE_D3D10_TO_STR(x) case x: return #x
+
+const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type)
+{
+ switch (driver_type)
+ {
+ WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_HARDWARE);
+ WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_REFERENCE);
+ WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_NULL);
+ WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_SOFTWARE);
+ WINE_D3D10_TO_STR(D3D10_DRIVER_TYPE_WARP);
+ default:
+ FIXME("Unrecognized D3D10_DRIVER_TYPE %#x.\n", driver_type);
+ return "unrecognized";
+ }
+}
+
+const char *debug_d3d10_feature_level(D3D10_FEATURE_LEVEL1 feature_level)
+{
+ switch (feature_level)
+ {
+ WINE_D3D10_TO_STR(D3D10_FEATURE_LEVEL_10_0);
+ WINE_D3D10_TO_STR(D3D10_FEATURE_LEVEL_10_1);
+ WINE_D3D10_TO_STR(D3D10_FEATURE_LEVEL_9_1);
+ WINE_D3D10_TO_STR(D3D10_FEATURE_LEVEL_9_2);
+ WINE_D3D10_TO_STR(D3D10_FEATURE_LEVEL_9_3);
+ default:
+ FIXME("Unrecognized D3D10_FEATURE_LEVEL1 %#x.\n", feature_level);
+ return "unrecognized";
+ }
+}
+
+#undef WINE_D3D10_TO_STR
+
+BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
+{
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(inst);
+ break;
+ }
+
+ return TRUE;
+}
+
+HRESULT WINAPI D3D10CreateDevice1(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast,
+ UINT flags, D3D10_FEATURE_LEVEL1 hw_level, UINT sdk_version, ID3D10Device1 **device)
+{
+ IDXGIFactory *factory;
+ HRESULT hr;
+
+ TRACE("adapter %p, driver_type %s, swrast %p, flags %#x, hw_level %s, sdk_version %d, device %p.\n",
+ adapter, debug_d3d10_driver_type(driver_type), swrast, flags,
+ debug_d3d10_feature_level(hw_level), sdk_version, device);
+
+ if (adapter)
+ {
+ IDXGIAdapter_AddRef(adapter);
+ if (FAILED(hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory)))
+ {
+ WARN("Failed to get dxgi factory, hr %#x.\n", hr);
+ return hr;
+ }
+ }
+ else
+ {
+ if (FAILED(hr = CreateDXGIFactory(&IID_IDXGIFactory, (void **)&factory)))
+ {
+ WARN("Failed to create dxgi factory, hr %#x.\n", hr);
+ return hr;
+ }
+
+ switch (driver_type)
+ {
+ case D3D10_DRIVER_TYPE_WARP:
+ FIXME("WARP driver not implemented, falling back to hardware.\n");
+ case D3D10_DRIVER_TYPE_HARDWARE:
+ {
+ if (FAILED(hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter)))
+ {
+ WARN("No adapters found, hr %#x.\n", hr);
+ IDXGIFactory_Release(factory);
+ return hr;
+ }
+ break;
+ }
+
+ case D3D10_DRIVER_TYPE_NULL:
+ FIXME("NULL device not implemented, falling back to refrast.\n");
+ /* Fall through, for now. */
+ case D3D10_DRIVER_TYPE_REFERENCE:
+ {
+ HMODULE refrast;
+
+ if (!(refrast = LoadLibraryA("d3d10ref.dll")))
+ {
+ WARN("Failed to load refrast, returning E_FAIL.\n");
+ IDXGIFactory_Release(factory);
+ return E_FAIL;
+ }
+ hr = IDXGIFactory_CreateSoftwareAdapter(factory, refrast, &adapter);
+ FreeLibrary(refrast);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create a software adapter, hr %#x.\n", hr);
+ IDXGIFactory_Release(factory);
+ return hr;
+ }
+ break;
+ }
+
+ case D3D10_DRIVER_TYPE_SOFTWARE:
+ {
+ if (!swrast)
+ {
+ WARN("Software device requested, but NULL swrast passed, returning E_FAIL.\n");
+ IDXGIFactory_Release(factory);
+ return E_FAIL;
+ }
+ if (FAILED(hr = IDXGIFactory_CreateSoftwareAdapter(factory, swrast, &adapter)))
+ {
+ WARN("Failed to create a software adapter, hr %#x.\n", hr);
+ IDXGIFactory_Release(factory);
+ return hr;
+ }
+ break;
+ }
+
+ default:
+ FIXME("Unhandled driver type %#x.\n", driver_type);
+ IDXGIFactory_Release(factory);
+ return E_FAIL;
+ }
+ }
+
+ FIXME("Ignoring feature level %s.\n", debug_d3d10_feature_level(hw_level));
+
+ hr = D3D10CoreCreateDevice(factory, adapter, flags, NULL, (ID3D10Device **)device);
+ IDXGIAdapter_Release(adapter);
+ IDXGIFactory_Release(factory);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create a device, hr %#x.\n", hr);
+ return hr;
+ }
+
+ TRACE("Created device %p.\n", *device);
+
+ return hr;
+}
diff --git a/dlls/d3d10_1/version.rc b/dlls/d3d10_1/version.rc
new file mode 100644
index 0000000..1e3039c
--- /dev/null
+++ b/dlls/d3d10_1/version.rc
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2014 Henri Verbeet for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define WINE_FILEDESCRIPTION_STR "Wine Direct3D"
+#define WINE_FILENAME_STR "d3d10_1.dll"
+#define WINE_FILEVERSION 6,2,9200,16492
+#define WINE_FILEVERSION_STR "6.2.9200.16492"
+#define WINE_PRODUCTVERSION 6,2,9200,16492
+#define WINE_PRODUCTVERSION_STR "6.2.9200.16492"
+
+#include "wine/wine_common_ver.rc"
--
1.7.10.4
More information about the wine-patches
mailing list