d3d: d3d9ex does not do video memory accounting for D3DPOOL_DEFAULT resources.
This commit is contained in:
parent
124d5a879d
commit
9287bb80dc
|
@ -404,11 +404,13 @@ static const struct IDirect3D8Vtbl d3d8_vtbl =
|
||||||
|
|
||||||
BOOL d3d8_init(struct d3d8 *d3d8)
|
BOOL d3d8_init(struct d3d8 *d3d8)
|
||||||
{
|
{
|
||||||
|
DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING;
|
||||||
|
|
||||||
d3d8->IDirect3D8_iface.lpVtbl = &d3d8_vtbl;
|
d3d8->IDirect3D8_iface.lpVtbl = &d3d8_vtbl;
|
||||||
d3d8->refcount = 1;
|
d3d8->refcount = 1;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
d3d8->wined3d = wined3d_create(8, WINED3D_LEGACY_DEPTH_BIAS);
|
d3d8->wined3d = wined3d_create(8, flags);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
if (!d3d8->wined3d)
|
if (!d3d8->wined3d)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -632,11 +632,12 @@ static const struct IDirect3D9ExVtbl d3d9_vtbl =
|
||||||
|
|
||||||
BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
|
BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
|
||||||
{
|
{
|
||||||
|
DWORD flags = extended ? 0 : WINED3D_VIDMEM_ACCOUNTING;
|
||||||
d3d9->IDirect3D9Ex_iface.lpVtbl = &d3d9_vtbl;
|
d3d9->IDirect3D9Ex_iface.lpVtbl = &d3d9_vtbl;
|
||||||
d3d9->refcount = 1;
|
d3d9->refcount = 1;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
d3d9->wined3d = wined3d_create(9, 0);
|
d3d9->wined3d = wined3d_create(9, flags);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
if (!d3d9->wined3d)
|
if (!d3d9->wined3d)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -5234,7 +5234,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
|
||||||
ddraw->numIfaces = 1;
|
ddraw->numIfaces = 1;
|
||||||
ddraw->ref7 = 1;
|
ddraw->ref7 = 1;
|
||||||
|
|
||||||
flags = WINED3D_LEGACY_DEPTH_BIAS;
|
flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING;
|
||||||
if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL)
|
if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL)
|
||||||
flags |= WINED3D_NO3D;
|
flags |= WINED3D_NO3D;
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
||||||
void *parent, const struct wined3d_parent_ops *parent_ops,
|
void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||||
const struct wined3d_resource_ops *resource_ops)
|
const struct wined3d_resource_ops *resource_ops)
|
||||||
{
|
{
|
||||||
|
const struct wined3d *d3d = device->wined3d;
|
||||||
|
|
||||||
resource->ref = 1;
|
resource->ref = 1;
|
||||||
resource->device = device;
|
resource->device = device;
|
||||||
resource->type = type;
|
resource->type = type;
|
||||||
|
@ -124,7 +126,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
||||||
+ (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
|
+ (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
|
||||||
|
|
||||||
/* Check that we have enough video ram left */
|
/* 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))
|
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)
|
void resource_cleanup(struct wined3d_resource *resource)
|
||||||
{
|
{
|
||||||
|
const struct wined3d *d3d = resource->device->wined3d;
|
||||||
struct private_data *data;
|
struct private_data *data;
|
||||||
struct list *e1, *e2;
|
struct list *e1, *e2;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("Cleaning up resource %p.\n", resource);
|
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);
|
TRACE("Decrementing device memory pool by %u.\n", resource->size);
|
||||||
adapter_adjust_memory(resource->device->adapter, 0 - resource->size);
|
adapter_adjust_memory(resource->device->adapter, 0 - resource->size);
|
||||||
|
|
|
@ -1216,6 +1216,7 @@ enum wined3d_display_rotation
|
||||||
|
|
||||||
#define WINED3D_LEGACY_DEPTH_BIAS 0x00000001
|
#define WINED3D_LEGACY_DEPTH_BIAS 0x00000001
|
||||||
#define WINED3D_NO3D 0x00000002
|
#define WINED3D_NO3D 0x00000002
|
||||||
|
#define WINED3D_VIDMEM_ACCOUNTING 0x00000004
|
||||||
|
|
||||||
#define WINED3D_RESZ_CODE 0x7fa05000
|
#define WINED3D_RESZ_CODE 0x7fa05000
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue