d3d: d3d9ex does not do video memory accounting for D3DPOOL_DEFAULT resources.

This commit is contained in:
Stefan Dösinger 2013-05-19 23:13:30 +02:00 committed by Alexandre Julliard
parent 124d5a879d
commit 9287bb80dc
5 changed files with 12 additions and 5 deletions

View File

@ -404,11 +404,13 @@ static const struct IDirect3D8Vtbl d3d8_vtbl =
BOOL d3d8_init(struct d3d8 *d3d8)
{
DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING;
d3d8->IDirect3D8_iface.lpVtbl = &d3d8_vtbl;
d3d8->refcount = 1;
wined3d_mutex_lock();
d3d8->wined3d = wined3d_create(8, WINED3D_LEGACY_DEPTH_BIAS);
d3d8->wined3d = wined3d_create(8, flags);
wined3d_mutex_unlock();
if (!d3d8->wined3d)
return FALSE;

View File

@ -632,11 +632,12 @@ static const struct IDirect3D9ExVtbl d3d9_vtbl =
BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
{
DWORD flags = extended ? 0 : WINED3D_VIDMEM_ACCOUNTING;
d3d9->IDirect3D9Ex_iface.lpVtbl = &d3d9_vtbl;
d3d9->refcount = 1;
wined3d_mutex_lock();
d3d9->wined3d = wined3d_create(9, 0);
d3d9->wined3d = wined3d_create(9, flags);
wined3d_mutex_unlock();
if (!d3d9->wined3d)
return FALSE;

View File

@ -5234,7 +5234,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
ddraw->numIfaces = 1;
ddraw->ref7 = 1;
flags = WINED3D_LEGACY_DEPTH_BIAS;
flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING;
if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL)
flags |= WINED3D_NO3D;

View File

@ -84,6 +84,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_resource_ops *resource_ops)
{
const struct wined3d *d3d = device->wined3d;
resource->ref = 1;
resource->device = device;
resource->type = type;
@ -124,7 +126,7 @@ 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 && d3d->flags & WINED3D_VIDMEM_ACCOUNTING)
{
if (size > wined3d_device_get_available_texture_mem(device))
{
@ -142,13 +144,14 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
void resource_cleanup(struct wined3d_resource *resource)
{
const struct wined3d *d3d = resource->device->wined3d;
struct private_data *data;
struct list *e1, *e2;
HRESULT hr;
TRACE("Cleaning up resource %p.\n", resource);
if (resource->pool == WINED3D_POOL_DEFAULT)
if (resource->pool == WINED3D_POOL_DEFAULT && d3d->flags & WINED3D_VIDMEM_ACCOUNTING)
{
TRACE("Decrementing device memory pool by %u.\n", resource->size);
adapter_adjust_memory(resource->device->adapter, 0 - resource->size);

View File

@ -1216,6 +1216,7 @@ enum wined3d_display_rotation
#define WINED3D_LEGACY_DEPTH_BIAS 0x00000001
#define WINED3D_NO3D 0x00000002
#define WINED3D_VIDMEM_ACCOUNTING 0x00000004
#define WINED3D_RESZ_CODE 0x7fa05000