wined3d: Create the DIB section for DDSCAPS_OWNDC surfaces on initialization.

This commit is contained in:
Henri Verbeet 2011-10-31 19:48:12 +01:00 committed by Alexandre Julliard
parent 7de4df9fd9
commit fcf96b634a
3 changed files with 15 additions and 0 deletions

View File

@ -5273,6 +5273,9 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
usage |= WINED3DUSAGE_DEPTHSTENCIL;
if (desc->ddsCaps.dwCaps & DDSCAPS_OWNDC)
usage |= WINED3DUSAGE_OWNDC;
if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
{
pool = WINED3DPOOL_SYSTEMMEM;

View File

@ -7305,6 +7305,17 @@ static HRESULT surface_init(struct wined3d_surface *surface, WINED3DSURFTYPE sur
return hr;
}
/* Similar to lockable rendertargets above, creating the DIB section
* during surface initialization prevents the sysmem pointer from changing
* after a wined3d_surface_getdc() call. */
if ((usage & WINED3DUSAGE_OWNDC) && !surface->hDC
&& SUCCEEDED(surface_create_dib_section(surface)))
{
HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory);
surface->resource.heapMemory = NULL;
surface->resource.allocatedMemory = surface->dib.bitmap_data;
}
return hr;
}

View File

@ -847,6 +847,7 @@ enum wined3d_sysval_semantic
#define WINED3DUSAGE_AUTOGENMIPMAP 0x00000400
#define WINED3DUSAGE_DMAP 0x00004000
#define WINED3DUSAGE_MASK 0x00004fff
#define WINED3DUSAGE_OWNDC 0x20000000
#define WINED3DUSAGE_STATICDECL 0x40000000
#define WINED3DUSAGE_OVERLAY 0x80000000