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

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

parent 7de4df9f
......@@ -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;
......
......@@ -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;
}
......
......@@ -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
......
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