On 12 June 2016 at 22:21, Stefan Dösinger <stefandoesinger(a)gmx.at> wrote:
+static HRESULT WINAPI is_warp_cb(GUID *guid, char *description, char *name, + D3DDEVICEDESC *hal_desc, D3DDEVICEDESC *hel_desc, void *ctx) +{ + BOOL *is_warp = ctx; + if (IsEqualGUID(guid, &IID_IDirect3DHALDevice)) + { + *is_warp = !!(hal_desc->dwDevCaps & D3DDEVCAPS_TEXTURESYSTEMMEMORY); + return DDENUMRET_CANCEL; + } + return DDENUMRET_OK; +} + static void test_p8_blit(void) { IDirectDrawSurface *src, *dst, *dst_p8; DDSURFACEDESC surface_desc; IDirectDraw *ddraw; + IDirect3D *d3d; IDirectDrawPalette *palette, *palette2; ULONG refcount; HWND window; @@ -5305,6 +5318,7 @@ static void test_p8_blit(void) PALETTEENTRY palette_entries[256]; unsigned int x; DDBLTFX fx; + BOOL is_warp = FALSE; static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80}; static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80}; @@ -5322,6 +5336,16 @@ static void test_p8_blit(void) hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
+ /* Locking a P8 surface crashes on WARP if a d3d device has been created. So we + * need to find the caps via enumeration. */ + hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D, (void **)&d3d); + if (SUCCEEDED(hr)) + { + hr = IDirect3D_EnumDevices(d3d, is_warp_cb, &is_warp); + ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); + IDirect3D_Release(d3d); + } Can't you just use ddraw4/7's GetDeviceIdentifier()?