ddraw: Set WINED3D_SURFACE_PIN_SYSMEM directly in ddraw_surface_create_texture().
This commit is contained in:
parent
fdb5e13f18
commit
45d37313b8
|
@ -2868,12 +2868,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DDSURFACEDESC2 desc2;
|
DDSURFACEDESC2 desc2;
|
||||||
const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
|
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);
|
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);
|
WARN("Failed to create texture, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -3143,7 +3137,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
|
||||||
{
|
{
|
||||||
struct ddraw_surface *object2 = NULL;
|
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)
|
if (version == 7)
|
||||||
IDirectDrawSurface7_Release(&object->IDirectDrawSurface7_iface);
|
IDirectDrawSurface7_Release(&object->IDirectDrawSurface7_iface);
|
||||||
|
|
|
@ -194,7 +194,7 @@ struct ddraw_texture
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *desc,
|
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,
|
HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
|
||||||
DDSURFACEDESC2 *desc, DWORD flags, UINT version) DECLSPEC_HIDDEN;
|
DDSURFACEDESC2 *desc, DWORD flags, UINT version) DECLSPEC_HIDDEN;
|
||||||
ULONG ddraw_surface_release_iface(struct ddraw_surface *This) 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,
|
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 ddraw_surface *root, *mip, **attach;
|
||||||
struct wined3d_resource_desc wined3d_desc;
|
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.depth = 1;
|
||||||
wined3d_desc.size = 0;
|
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)
|
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
||||||
{
|
{
|
||||||
wined3d_desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
|
wined3d_desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
|
||||||
hr = wined3d_texture_create_cube(ddraw->wined3d_device, &wined3d_desc, levels,
|
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
|
else
|
||||||
{
|
{
|
||||||
wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE;
|
wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE;
|
||||||
hr = wined3d_texture_create_2d(ddraw->wined3d_device, &wined3d_desc, levels,
|
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))
|
if (FAILED(hr))
|
||||||
|
|
Loading…
Reference in New Issue