if (!refcount)
{
IDXGIOutput_Release(adapter->output);
+ wined3d_private_store_cleanup(&adapter->private_store);
HeapFree(GetProcessHeap(), 0, adapter);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IDXGIAdapter1 *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);
+ struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_set_private_data(&adapter->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IDXGIAdapter1 *iface,
REFGUID guid, const IUnknown *object)
{
- FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
+ struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
+
+ return dxgi_set_private_data_interface(&adapter->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IDXGIAdapter1 *iface,
REFGUID guid, UINT *data_size, void *data)
{
- FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+ struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_get_private_data(&adapter->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IDXGIAdapter1 *iface, REFIID iid, void **parent)
adapter->IDXGIAdapter1_iface.lpVtbl = &dxgi_adapter_vtbl;
adapter->parent = parent;
adapter->refcount = 1;
+ wined3d_private_store_init(&adapter->private_store);
adapter->ordinal = ordinal;
- output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*output));
- if (!output)
+ if (!(output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*output))))
{
+ wined3d_private_store_cleanup(&adapter->private_store);
return E_OUTOFMEMORY;
}
dxgi_output_init(output, adapter);
wined3d_device_decref(This->wined3d_device);
LeaveCriticalSection(&dxgi_cs);
IDXGIFactory1_Release(This->factory);
+ wined3d_private_store_cleanup(&This->private_store);
HeapFree(GetProcessHeap(), 0, This);
}
static HRESULT STDMETHODCALLTYPE dxgi_device_SetPrivateData(IWineDXGIDevice *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);
+ struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_set_private_data(&device->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_device_SetPrivateDataInterface(IWineDXGIDevice *iface,
REFGUID guid, const IUnknown *object)
{
- FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
+ struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
+
+ return dxgi_set_private_data_interface(&device->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_device_GetPrivateData(IWineDXGIDevice *iface,
REFGUID guid, UINT *data_size, void *data)
{
- FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+ struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_get_private_data(&device->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_device_GetParent(IWineDXGIDevice *iface, REFIID riid, void **parent)
dxgi_device_QueryResourceResidency,
dxgi_device_SetGPUThreadPriority,
dxgi_device_GetGPUThreadPriority,
- /* IWineDXGIAdapter methods */
+ /* IWineDXGIDevice methods */
dxgi_device_create_surface,
dxgi_device_create_swapchain,
};
device->IWineDXGIDevice_iface.lpVtbl = &dxgi_device_vtbl;
device->refcount = 1;
+ wined3d_private_store_init(&device->private_store);
layer_base = device + 1;
device, &IID_IUnknown, (void **)&device->child_layer)))
{
WARN("Failed to create device, returning %#x.\n", hr);
+ wined3d_private_store_cleanup(&device->private_store);
return hr;
}
{
ERR("DXGI device should implement IWineD3DDeviceParent.\n");
IUnknown_Release(device->child_layer);
+ wined3d_private_store_cleanup(&device->private_store);
return hr;
}
wined3d_device_parent = IWineDXGIDeviceParent_get_wined3d_device_parent(dxgi_device_parent);
if (SUCCEEDED(hr))
hr = E_FAIL;
IUnknown_Release(device->child_layer);
+ wined3d_private_store_cleanup(&device->private_store);
return hr;
}
{
WARN("Failed to create a wined3d device, returning %#x.\n", hr);
IUnknown_Release(device->child_layer);
+ wined3d_private_store_cleanup(&device->private_store);
return hr;
}
ERR("Failed to initialize 3D, hr %#x.\n", hr);
wined3d_device_decref(device->wined3d_device);
IUnknown_Release(device->child_layer);
+ wined3d_private_store_cleanup(&device->private_store);
return hr;
}
DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
+HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
+ REFGUID guid, UINT *data_size, void *data) DECLSPEC_HIDDEN;
+HRESULT dxgi_set_private_data(struct wined3d_private_store *store,
+ REFGUID guid, UINT data_size, const void *data) DECLSPEC_HIDDEN;
+HRESULT dxgi_set_private_data_interface(struct wined3d_private_store *store,
+ REFGUID guid, const IUnknown *object) DECLSPEC_HIDDEN;
/* IDXGIFactory */
struct dxgi_factory
{
IDXGIFactory1 IDXGIFactory1_iface;
LONG refcount;
+ struct wined3d_private_store private_store;
struct wined3d *wined3d;
UINT adapter_count;
IDXGIAdapter1 **adapters;
IWineDXGIDevice IWineDXGIDevice_iface;
IUnknown *child_layer;
LONG refcount;
+ struct wined3d_private_store private_store;
struct wined3d_device *wined3d_device;
IDXGIFactory1 *factory;
};
{
IDXGIOutput IDXGIOutput_iface;
LONG refcount;
+ struct wined3d_private_store private_store;
struct dxgi_adapter *adapter;
};
IDXGIAdapter1 IDXGIAdapter1_iface;
struct dxgi_factory *parent;
LONG refcount;
+ struct wined3d_private_store private_store;
UINT ordinal;
IDXGIOutput *output;
};
{
IDXGISwapChain IDXGISwapChain_iface;
LONG refcount;
+ struct wined3d_private_store private_store;
struct wined3d_swapchain *wined3d_swapchain;
};
IUnknown IUnknown_iface;
IUnknown *outer_unknown;
LONG refcount;
+ struct wined3d_private_store private_store;
IDXGIDevice *device;
DXGI_SURFACE_DESC desc;
EnterCriticalSection(&dxgi_cs);
wined3d_decref(factory->wined3d);
LeaveCriticalSection(&dxgi_cs);
+ wined3d_private_store_cleanup(&factory->private_store);
HeapFree(GetProcessHeap(), 0, factory);
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IDXGIFactory1 *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);
+ struct dxgi_factory *factory = impl_from_IDXGIFactory1(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_set_private_data(&factory->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IDXGIFactory1 *iface,
REFGUID guid, const IUnknown *object)
{
- FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
+ struct dxgi_factory *factory = impl_from_IDXGIFactory1(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
+
+ return dxgi_set_private_data_interface(&factory->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IDXGIFactory1 *iface,
REFGUID guid, UINT *data_size, void *data)
{
- FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+ struct dxgi_factory *factory = impl_from_IDXGIFactory1(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_get_private_data(&factory->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IDXGIFactory1 *iface, REFIID iid, void **parent)
factory->IDXGIFactory1_iface.lpVtbl = &dxgi_factory_vtbl;
factory->refcount = 1;
+ wined3d_private_store_init(&factory->private_store);
EnterCriticalSection(&dxgi_cs);
factory->wined3d = wined3d_create(0);
if (!factory->wined3d)
{
LeaveCriticalSection(&dxgi_cs);
+ wined3d_private_store_cleanup(&factory->private_store);
return DXGI_ERROR_UNSUPPORTED;
}
EnterCriticalSection(&dxgi_cs);
wined3d_decref(factory->wined3d);
LeaveCriticalSection(&dxgi_cs);
+ wined3d_private_store_cleanup(&factory->private_store);
return hr;
}
if (!(factory->device_window = CreateWindowA("static", "DXGI device window",
WS_DISABLED, 0, 0, 0, 0, NULL, NULL, NULL, NULL)))
{
+ LeaveCriticalSection(&dxgi_cs);
ERR("Failed to create a window.\n");
return NULL;
}
if (!refcount)
{
+ wined3d_private_store_cleanup(&This->private_store);
HeapFree(GetProcessHeap(), 0, This);
}
static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateData(IDXGIOutput *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);
+ struct dxgi_output *output = impl_from_IDXGIOutput(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_set_private_data(&output->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateDataInterface(IDXGIOutput *iface,
REFGUID guid, const IUnknown *object)
{
- FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
+ struct dxgi_output *output = impl_from_IDXGIOutput(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
+
+ return dxgi_set_private_data_interface(&output->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_output_GetPrivateData(IDXGIOutput *iface,
REFGUID guid, UINT *data_size, void *data)
{
- FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+ struct dxgi_output *output = impl_from_IDXGIOutput(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_get_private_data(&output->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput *iface,
static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput *iface, DXGI_OUTPUT_DESC *desc)
{
- FIXME("iface %p, desc %p stub!\n", iface, desc);
+ struct dxgi_output *This = impl_from_IDXGIOutput(iface);
+ struct wined3d *wined3d;
+ MONITORINFOEXW monitor_info;
- return E_NOTIMPL;
+ FIXME("iface %p, desc %p semi-stub!\n", iface, desc);
+
+ if (!desc)
+ return DXGI_ERROR_INVALID_CALL;
+
+ wined3d = This->adapter->parent->wined3d;
+
+ EnterCriticalSection(&dxgi_cs);
+ desc->Monitor = wined3d_get_adapter_monitor(wined3d, This->adapter->ordinal);
+ LeaveCriticalSection(&dxgi_cs);
+
+ if (!desc->Monitor)
+ return DXGI_ERROR_INVALID_CALL;
+
+ monitor_info.cbSize = sizeof(monitor_info);
+ if (!GetMonitorInfoW(desc->Monitor, (MONITORINFO *)&monitor_info))
+ return DXGI_ERROR_INVALID_CALL;
+
+ memcpy(&desc->DeviceName, &monitor_info.szDevice, sizeof(desc->DeviceName));
+ memcpy(&desc->DesktopCoordinates, &monitor_info.rcMonitor, sizeof(RECT));
+ desc->AttachedToDesktop = TRUE;
+ desc->Rotation = DXGI_MODE_ROTATION_IDENTITY;
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *iface,
{
output->IDXGIOutput_iface.lpVtbl = &dxgi_output_vtbl;
output->refcount = 1;
+ wined3d_private_store_init(&output->private_store);
output->adapter = adapter;
}
TRACE("%p decreasing refcount to %u.\n", surface, refcount);
if (!refcount)
+ {
+ wined3d_private_store_cleanup(&surface->private_store);
HeapFree(GetProcessHeap(), 0, surface);
+ }
return refcount;
}
static HRESULT STDMETHODCALLTYPE dxgi_surface_SetPrivateData(IDXGISurface *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);
+ struct dxgi_surface *surface = impl_from_IDXGISurface(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_set_private_data(&surface->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_surface_SetPrivateDataInterface(IDXGISurface *iface,
REFGUID guid, const IUnknown *object)
{
- FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
+ struct dxgi_surface *surface = impl_from_IDXGISurface(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
+
+ return dxgi_set_private_data_interface(&surface->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetPrivateData(IDXGISurface *iface,
REFGUID guid, UINT *data_size, void *data)
{
- FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+ struct dxgi_surface *surface = impl_from_IDXGISurface(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_get_private_data(&surface->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetParent(IDXGISurface *iface, REFIID riid, void **parent)
surface->IDXGISurface_iface.lpVtbl = &dxgi_surface_vtbl;
surface->IUnknown_iface.lpVtbl = &dxgi_surface_inner_unknown_vtbl;
surface->refcount = 1;
+ wined3d_private_store_init(&surface->private_store);
surface->outer_unknown = outer ? outer : &surface->IUnknown_iface;
surface->device = device;
surface->desc = *desc;
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_SetPrivateData(IDXGISwapChain *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);
+ struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_set_private_data(&swapchain->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_SetPrivateDataInterface(IDXGISwapChain *iface,
REFGUID guid, const IUnknown *object)
{
- FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
+ struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
+
+ return dxgi_set_private_data_interface(&swapchain->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetPrivateData(IDXGISwapChain *iface,
REFGUID guid, UINT *data_size, void *data)
{
- FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+ struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
+
+ return dxgi_get_private_data(&swapchain->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetParent(IDXGISwapChain *iface, REFIID riid, void **parent)
static void STDMETHODCALLTYPE dxgi_swapchain_wined3d_object_released(void *parent)
{
+ struct dxgi_swapchain *swapchain = parent;
+
+ wined3d_private_store_cleanup(&swapchain->private_store);
HeapFree(GetProcessHeap(), 0, parent);
}
swapchain->IDXGISwapChain_iface.lpVtbl = &dxgi_swapchain_vtbl;
swapchain->refcount = 1;
+ wined3d_private_store_init(&swapchain->private_store);
if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,
&dxgi_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain)))
{
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
+ wined3d_private_store_cleanup(&swapchain->private_store);
return hr;
}
return WINED3DFMT_UNKNOWN;
}
}
+
+HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
+ REFGUID guid, UINT *data_size, void *data)
+{
+ const struct wined3d_private_data *stored_data;
+ DWORD size_in;
+ HRESULT hr;
+
+ if (!data_size)
+ return E_INVALIDARG;
+
+ EnterCriticalSection(&dxgi_cs);
+ if (!(stored_data = wined3d_private_store_get_private_data(store, guid)))
+ {
+ hr = DXGI_ERROR_NOT_FOUND;
+ *data_size = 0;
+ goto done;
+ }
+
+ size_in = *data_size;
+ *data_size = stored_data->size;
+ if (!data)
+ {
+ hr = S_OK;
+ goto done;
+ }
+ if (size_in < stored_data->size)
+ {
+ hr = DXGI_ERROR_MORE_DATA;
+ goto done;
+ }
+
+ if (stored_data->flags & WINED3DSPD_IUNKNOWN)
+ IUnknown_AddRef(stored_data->content.object);
+ memcpy(data, stored_data->content.data, stored_data->size);
+ hr = S_OK;
+
+done:
+ LeaveCriticalSection(&dxgi_cs);
+
+ return hr;
+}
+
+HRESULT dxgi_set_private_data(struct wined3d_private_store *store,
+ REFGUID guid, UINT data_size, const void *data)
+{
+ struct wined3d_private_data *entry;
+ HRESULT hr;
+
+ if (!data)
+ {
+ EnterCriticalSection(&dxgi_cs);
+ if (!(entry = wined3d_private_store_get_private_data(store, guid)))
+ {
+ LeaveCriticalSection(&dxgi_cs);
+ return S_FALSE;
+ }
+
+ wined3d_private_store_free_private_data(store, entry);
+ LeaveCriticalSection(&dxgi_cs);
+
+ return S_OK;
+ }
+
+ EnterCriticalSection(&dxgi_cs);
+ hr = wined3d_private_store_set_private_data(store, guid, data, data_size, 0);
+ LeaveCriticalSection(&dxgi_cs);
+
+ return hr;
+}
+
+HRESULT dxgi_set_private_data_interface(struct wined3d_private_store *store,
+ REFGUID guid, const IUnknown *object)
+{
+ HRESULT hr;
+
+ if (!object)
+ return dxgi_set_private_data(store, guid, sizeof(object), &object);
+
+ EnterCriticalSection(&dxgi_cs);
+ hr = wined3d_private_store_set_private_data(store,
+ guid, object, sizeof(object), WINED3DSPD_IUNKNOWN);
+ LeaveCriticalSection(&dxgi_cs);
+
+ return hr;
+}
reactos/dll/directx/wine/dplayx # Synced to WineStaging-1.7.37
reactos/dll/directx/wine/dsound # Synced to Wine-1.3.29
reactos/dll/directx/wine/dxdiagn # Synced to Wine-1.7.27
-reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.27
+reactos/dll/directx/wine/dxgi # Synced to WineStaging-1.7.37
reactos/dll/directx/wine/msdmo # Synced to Wine-1.7.27
reactos/dll/directx/wine/qedit # Synced to Wine-1.7.27
reactos/dll/directx/wine/quartz # Synced to Wine-1.7.27