Commit b7146d81 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Do not add wined3d internal resources to the device resource list.

parent ecbc1cb6
...@@ -57,6 +57,7 @@ static void resource_check_usage(DWORD usage) ...@@ -57,6 +57,7 @@ static void resource_check_usage(DWORD usage)
| WINED3DUSAGE_AUTOGENMIPMAP | WINED3DUSAGE_AUTOGENMIPMAP
| WINED3DUSAGE_STATICDECL | WINED3DUSAGE_STATICDECL
| WINED3DUSAGE_OVERLAY | WINED3DUSAGE_OVERLAY
| WINED3DUSAGE_PRIVATE
| WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_LEGACY_CUBEMAP
| WINED3DUSAGE_TEXTURE; | WINED3DUSAGE_TEXTURE;
...@@ -216,19 +217,22 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * ...@@ -216,19 +217,22 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource->heap_memory = NULL; resource->heap_memory = NULL;
} }
/* Check that we have enough video ram left */ if (!(usage & WINED3DUSAGE_PRIVATE))
if (pool == WINED3D_POOL_DEFAULT && device->wined3d->flags & WINED3D_VIDMEM_ACCOUNTING)
{ {
if (size > wined3d_device_get_available_texture_mem(device)) /* Check that we have enough video ram left */
if (pool == WINED3D_POOL_DEFAULT && device->wined3d->flags & WINED3D_VIDMEM_ACCOUNTING)
{ {
ERR("Out of adapter memory\n"); if (size > wined3d_device_get_available_texture_mem(device))
wined3d_resource_free_sysmem(resource); {
return WINED3DERR_OUTOFVIDEOMEMORY; ERR("Out of adapter memory\n");
wined3d_resource_free_sysmem(resource);
return WINED3DERR_OUTOFVIDEOMEMORY;
}
adapter_adjust_memory(device->adapter, size);
} }
adapter_adjust_memory(device->adapter, size);
}
device_resource_add(device, resource); device_resource_add(device, resource);
}
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -248,13 +252,16 @@ void resource_cleanup(struct wined3d_resource *resource) ...@@ -248,13 +252,16 @@ void resource_cleanup(struct wined3d_resource *resource)
TRACE("Cleaning up resource %p.\n", resource); TRACE("Cleaning up resource %p.\n", resource);
if (resource->pool == WINED3D_POOL_DEFAULT && d3d->flags & WINED3D_VIDMEM_ACCOUNTING) if (!(resource->usage & WINED3DUSAGE_PRIVATE))
{ {
TRACE("Decrementing device memory pool by %u.\n", resource->size); if (resource->pool == WINED3D_POOL_DEFAULT && d3d->flags & WINED3D_VIDMEM_ACCOUNTING)
adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size); {
} TRACE("Decrementing device memory pool by %u.\n", resource->size);
adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size);
}
device_resource_released(resource->device, resource); device_resource_released(resource->device, resource);
}
wined3d_resource_acquire(resource); wined3d_resource_acquire(resource);
wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource); wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource);
} }
......
...@@ -1271,7 +1271,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr ...@@ -1271,7 +1271,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
desc.format = dst_format->id; desc.format = dst_format->id;
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = 0; desc.usage = WINED3DUSAGE_PRIVATE;
desc.pool = WINED3D_POOL_SCRATCH; desc.pool = WINED3D_POOL_SCRATCH;
desc.width = wined3d_texture_get_level_width(src_texture, texture_level); desc.width = wined3d_texture_get_level_width(src_texture, texture_level);
desc.height = wined3d_texture_get_level_height(src_texture, texture_level); desc.height = wined3d_texture_get_level_height(src_texture, texture_level);
......
...@@ -870,6 +870,7 @@ enum wined3d_shader_byte_code_format ...@@ -870,6 +870,7 @@ enum wined3d_shader_byte_code_format
#define WINED3DUSAGE_TEXTAPI 0x10000000 #define WINED3DUSAGE_TEXTAPI 0x10000000
#define WINED3DUSAGE_MASK 0x10007fff #define WINED3DUSAGE_MASK 0x10007fff
#define WINED3DUSAGE_PRIVATE 0x00400000
#define WINED3DUSAGE_LEGACY_CUBEMAP 0x00800000 #define WINED3DUSAGE_LEGACY_CUBEMAP 0x00800000
#define WINED3DUSAGE_TEXTURE 0x01000000 #define WINED3DUSAGE_TEXTURE 0x01000000
#define WINED3DUSAGE_OWNDC 0x02000000 #define WINED3DUSAGE_OWNDC 0x02000000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment