Henri Verbeet : dxgi: Implement DXGID3D10RegisterLayers().
Alexandre Julliard
julliard at winehq.org
Fri Nov 14 07:55:08 CST 2008
Module: wine
Branch: master
Commit: 800fedc2581c3e5ae61ee3e2595b2c9fc8c1a2b7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=800fedc2581c3e5ae61ee3e2595b2c9fc8c1a2b7
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Fri Nov 14 13:57:06 2008 +0100
dxgi: Implement DXGID3D10RegisterLayers().
---
dlls/dxgi/dxgi_main.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/dlls/dxgi/dxgi_main.c b/dlls/dxgi/dxgi_main.c
index 62e6f92..507eb04 100644
--- a/dlls/dxgi/dxgi_main.c
+++ b/dlls/dxgi/dxgi_main.c
@@ -24,6 +24,35 @@
WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
+static CRITICAL_SECTION dxgi_cs;
+static CRITICAL_SECTION_DEBUG dxgi_cs_debug =
+{
+ 0, 0, &dxgi_cs,
+ {&dxgi_cs_debug.ProcessLocksList,
+ &dxgi_cs_debug.ProcessLocksList},
+ 0, 0, {(DWORD_PTR)(__FILE__ ": dxgi_cs")}
+};
+static CRITICAL_SECTION dxgi_cs = {&dxgi_cs_debug, -1, 0, 0, 0, 0};
+
+struct dxgi_main
+{
+ struct dxgi_device_layer *device_layers;
+ UINT layer_count;
+ LONG refcount;
+};
+static struct dxgi_main dxgi_main;
+
+static void dxgi_main_cleanup(void)
+{
+ EnterCriticalSection(&dxgi_cs);
+
+ HeapFree(GetProcessHeap(), 0, dxgi_main.device_layers);
+ dxgi_main.device_layers = NULL;
+ dxgi_main.layer_count = 0;
+
+ LeaveCriticalSection(&dxgi_cs);
+}
+
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
TRACE("fdwReason %u\n", fdwReason);
@@ -32,6 +61,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDLL);
+ ++dxgi_main.refcount;
+ break;
+
+ case DLL_PROCESS_DETACH:
+ if (!--dxgi_main.refcount) dxgi_main_cleanup();
break;
}
@@ -65,7 +99,40 @@ HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
HRESULT WINAPI DXGID3D10RegisterLayers(const struct dxgi_device_layer *layers, UINT layer_count)
{
- FIXME("layers %p, layer_count %u stub!\n", layers, layer_count);
+ UINT i;
+ struct dxgi_device_layer *new_layers;
+
+ TRACE("layers %p, layer_count %u\n", layers, layer_count);
+
+ EnterCriticalSection(&dxgi_cs);
+
+ if (!dxgi_main.layer_count)
+ new_layers = HeapAlloc(GetProcessHeap(), 0, layer_count * sizeof(*new_layers));
+ else
+ new_layers = HeapReAlloc(GetProcessHeap(), 0, dxgi_main.device_layers,
+ (dxgi_main.layer_count + layer_count) * sizeof(*new_layers));
+
+ if (!new_layers)
+ {
+ LeaveCriticalSection(&dxgi_cs);
+ ERR("Failed to allocate layer memory\n");
+ return E_OUTOFMEMORY;
+ }
+
+ for (i = 0; i < layer_count; ++i)
+ {
+ const struct dxgi_device_layer *layer = &layers[i];
+
+ TRACE("layer %d: id %#x, init %p, get_size %p, create %p\n",
+ i, layer->id, layer->init, layer->get_size, layer->create);
+
+ new_layers[dxgi_main.layer_count + i] = *layer;
+ }
+
+ dxgi_main.device_layers = new_layers;
+ dxgi_main.layer_count += layer_count;
+
+ LeaveCriticalSection(&dxgi_cs);
- return E_NOTIMPL;
+ return S_OK;
}
More information about the wine-cvs
mailing list