Commit 45d37313 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Set WINED3D_SURFACE_PIN_SYSMEM directly in ddraw_surface_create_texture().

parent fdb5e13f
......@@ -2868,12 +2868,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
HRESULT hr;
DDSURFACEDESC2 desc2;
const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
/* Some applications assume surfaces will always be mapped at the same
* address. Some of those also assume that this address is valid even when
* the surface isn't mapped, and that updates done this way will be
* visible on the screen. The game Nox is such an application,
* Commandos: Behind Enemy Lines is another. */
const DWORD flags = WINED3D_SURFACE_PIN_SYSMEM;
TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p.\n", ddraw, DDSD, surface, UnkOuter);
......@@ -3116,7 +3110,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
}
}
if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, flags, &object)))
if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, &object)))
{
WARN("Failed to create texture, hr %#x.\n", hr);
return hr;
......@@ -3143,7 +3137,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
{
struct ddraw_surface *object2 = NULL;
if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, flags, &object2)))
if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, &object2)))
{
if (version == 7)
IDirectDrawSurface7_Release(&object->IDirectDrawSurface7_iface);
......
......@@ -194,7 +194,7 @@ struct ddraw_texture
};
HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *desc,
unsigned int version, DWORD surface_flags, struct ddraw_surface **surface) DECLSPEC_HIDDEN;
unsigned int version, struct ddraw_surface **surface) DECLSPEC_HIDDEN;
HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
DDSURFACEDESC2 *desc, DWORD flags, UINT version) DECLSPEC_HIDDEN;
ULONG ddraw_surface_release_iface(struct ddraw_surface *This) DECLSPEC_HIDDEN;
......
......@@ -5594,7 +5594,7 @@ static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops =
};
HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *desc,
unsigned int version, DWORD surface_flags, struct ddraw_surface **surface)
unsigned int version, struct ddraw_surface **surface)
{
struct ddraw_surface *root, *mip, **attach;
struct wined3d_resource_desc wined3d_desc;
......@@ -5658,17 +5658,23 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *
wined3d_desc.depth = 1;
wined3d_desc.size = 0;
/* Some applications assume surfaces will always be mapped at the same
* address. Some of those also assume that this address is valid even when
* the surface isn't mapped, and that updates done this way will be
* visible on the screen. The game Nox is such an application,
* Commandos: Behind Enemy Lines is another. We set
* WINED3D_SURFACE_PIN_SYSMEM because of this. */
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
{
wined3d_desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
hr = wined3d_texture_create_cube(ddraw->wined3d_device, &wined3d_desc, levels,
surface_flags, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
WINED3D_SURFACE_PIN_SYSMEM, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
}
else
{
wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE;
hr = wined3d_texture_create_2d(ddraw->wined3d_device, &wined3d_desc, levels,
surface_flags, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
WINED3D_SURFACE_PIN_SYSMEM, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
}
if (FAILED(hr))
......
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