[PATCH 1/7] ddraw: Create a sysmem surface if the format is not supported
Stefan Dösinger
stefan at codeweavers.com
Thu Sep 5 17:11:10 CDT 2013
Some tests inadvertently rely on this by creating P8 textures without
any location flag set. Windows returns them a sysmem texture. Patch 7
adds an explicit test.
---
dlls/ddraw/ddraw.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 652d20b..a7f29b5 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2737,6 +2737,27 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
ddrawformat_from_wined3dformat(&desc2.u4.ddpfPixelFormat, mode.format_id);
}
+ if (!(desc2.ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
+ && !(desc2.ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE))
+ {
+ enum wined3d_format_id format = wined3dformat_from_ddrawformat(&desc2.u4.ddpfPixelFormat);
+ enum wined3d_resource_type rtype;
+
+ if (desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE)
+ rtype = WINED3D_RTYPE_TEXTURE;
+ else if (desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
+ rtype = WINED3D_RTYPE_CUBE_TEXTURE;
+ else
+ rtype = WINED3D_RTYPE_SURFACE;
+
+ hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
+ mode.format_id, 0, rtype, format);
+ if (SUCCEEDED(hr))
+ desc2.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
+ else
+ desc2.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
+ }
+
/* No Width or no Height? Use the original screen size
*/
if(!(desc2.dwFlags & DDSD_WIDTH) ||
--
1.8.1.5
More information about the wine-patches
mailing list