[PATCH 5/6] d3d: d3d9ex does not do video memory accounting for D3DPOOL_DEFAULT resources
Stefan Dösinger
stefan at codeweavers.com
Tue May 14 16:46:04 CDT 2013
---
dlls/d3d8/device.c | 1 +
dlls/d3d9/device.c | 5 +++++
dlls/wined3d/resource.c | 6 ++++--
include/wine/wined3d.h | 2 ++
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index a94d3bd..a913821 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -3056,6 +3056,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
device->handle_table.table_size = D3D8_INITIAL_HANDLE_TABLE_SIZE;
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
+ flags &= ~WINED3DCREATE_NO_VIDMEM_ACCOUNTING;
wined3d_mutex_lock();
hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags, 4,
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 7b53790..a9a0883 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3438,6 +3438,11 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
+ if (parent->extended)
+ flags |= WINED3DCREATE_NO_VIDMEM_ACCOUNTING;
+ else
+ flags &= ~WINED3DCREATE_NO_VIDMEM_ACCOUNTING;
+
wined3d_mutex_lock();
hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags, 4,
&device->device_parent, &device->wined3d_device);
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index d784622..4359b3a 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -124,7 +124,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
+ (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
/* Check that we have enough video ram left */
- if (pool == WINED3D_POOL_DEFAULT)
+ if (pool == WINED3D_POOL_DEFAULT &&
+ !(device->create_parms.flags & WINED3DCREATE_NO_VIDMEM_ACCOUNTING))
{
if (size > wined3d_device_get_available_texture_mem(device))
{
@@ -148,7 +149,8 @@ void resource_cleanup(struct wined3d_resource *resource)
TRACE("Cleaning up resource %p.\n", resource);
- if (resource->pool == WINED3D_POOL_DEFAULT)
+ if (resource->pool == WINED3D_POOL_DEFAULT &&
+ !(resource->device->create_parms.flags & WINED3DCREATE_NO_VIDMEM_ACCOUNTING))
{
TRACE("Decrementing device memory pool by %u.\n", resource->size);
adapter_adjust_memory(resource->device->adapter, 0 - resource->size);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 75cba55..f9a5f51 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -922,6 +922,8 @@ enum wined3d_display_rotation
#define WINED3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100
#define WINED3DCREATE_ADAPTERGROUP_DEVICE 0x00000200
+#define WINED3DCREATE_NO_VIDMEM_ACCOUNTING 0x10000000
+
/* VTF defines */
#define WINED3DDMAPSAMPLER 0x100
#define WINED3DVERTEXTEXTURESAMPLER0 (WINED3DDMAPSAMPLER + 1)
--
1.8.1.5
More information about the wine-patches
mailing list