Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
August 2018
- 62 participants
- 701 discussions
Binary packages for various distributions will be available from:
https://www.winehq.org/download
Summary of the past few weeks
* This is an out of bounds release to correct a regression in Star Craft 2
and to allow some patches to get some tested before the next official
wine release.
* Appended is a list of patches pulled from the mailing list.
Updated patchsets
* Corrected regression with sound not playing in Star Craft 2
Added
* [41573] Stop a crash in Battle.Net.
* [45524] Speed Improvements in Tital Fall 2.
* dinput8 to share code with dinput (part of League of Legends support)
* [45327] Improvements to support for League of Legends.
* [45535] Stop an out of bounds access in Rekordbox
League of Legends currently doesn't work with this release, we are still
working through the remaining issues.
As always, if you find a bug, please report it via
https://bugs.winehq.org
Best Regards
Alistair.
---
Andrew Eikum (1):
dsound: Correctly calculate angle between vectors with equal and
opposite directions
Andrey Gusev (1):
api-ms-win-devices-config-l1-1-0: Add dll.
Aric Stewart (1):
hidclass.sys: Unload all devices before unloading a minidriver
Charles Davis (1):
libwine: Use getsegmentdata(3) on Mac OS to find the end of the
__TEXT segment.
Daniel Lehman (1):
odbc32: Rename functions to avoid conflicts with native drivers.
Dmitry Timoshkov (5):
programs: Allow to disable MIME-type associations.
kernel32: Set environment variable %PUBLIC% on the process start-up.
kernel32: Add support for MOVEFILE_WRITE_THROUGH to MoveFile.
server: Add support for FILE_WRITE_THROUGH to create_file() request.
kernel32: Add support for FILE_FLAG_WRITE_THROUGH to CreateFile.
Fabian Maurer (4):
wnet: Make WNetGetUniversalNameW return required size when buffer
is too small and add test
ntoskrnl: Emulate sti/cli instructions on x86_64
winmm: Don't crash in waveOutOpen when nSamplesPerSec is 0 and add
tests
cmd: Handle quotes when parsing the folders in the PATH
environment variable
Gijs Vermeulen (1):
wine.inf: Add "Sources" key.
Jacek Caban (2):
winevulkan: Expose driver vkGetInstanceProcAddr via winevulkan
exports.
winevulkan: Mark ICD and thunking functions as private.
Kai Krakow (1):
winebus.sys: Do not report HID report read errors unconditionally
Matteo Bruni (1):
d3dcompiler: Make types array static const.
Michael Stefaniuc (55):
windowscodecs: Use the ARRAY_SIZE() macro
localspl: Use the ARRAY_SIZE() macro
mmdevapi: Use the ARRAY_SIZE() macro
mapi32: Use the ARRAY_SIZE() macro
krnl386.exe16: Use the ARRAY_SIZE() macro
inetcpl.cpl: Use the ARRAY_SIZE() macro
hhctrl.ocx: Use the ARRAY_SIZE() macro
dpnet: Use the ARRAY_SIZE() macro
dx8vb: Use the ARRAY_SIZE() macro
fusion: Use the ARRAY_SIZE() macro
evr: Use the ARRAY_SIZE() macro
d3d10: Use the ARRAY_SIZE() macro
d3d8: Use the ARRAY_SIZE() macro
d3dcompiler: Use the ARRAY_SIZE() macro
d3dxof: Use the ARRAY_SIZE() macro
dnsapi: Use the ARRAY_SIZE() macro
amstream: Use the ARRAY_SIZE() macro
browseui: Use the ARRAY_SIZE() macro
gameux: Use the ARRAY_SIZE() macro
inetcomm: Use the ARRAY_SIZE() macro
iphlpapi: Use the ARRAY_SIZE() macro
itss: Remove a superfluous variable initialization
itss: Use the ARRAY_SIZE() macro
attrib: Use the ARRAY_SIZE() macro
clock: Use the ARRAY_SIZE() macro
hostname: Use the ARRAY_SIZE() macro
icinfo: Use the ARRAY_SIZE() macro
net: Use the ARRAY_SIZE() macro
taskkill: Use the ARRAY_SIZE() macro
ipconfig: Use the ARRAY_SIZE() macro
msiexec: Use the ARRAY_SIZE() macro
taskmgr: Use the ARRAY_SIZE() macro
uninstaller: Use the ARRAY_SIZE() macro
wineboot: Use the ARRAY_SIZE() macro
wordpad: Use the ARRAY_SIZE() macro
winetest: Use the ARRAY_SIZE() macro
mountmgr.sys: Use the ARRAY_SIZE() macro
mpr: Use the ARRAY_SIZE() macro
msacm32: Use the ARRAY_SIZE() macro
msrle32: Use the ARRAY_SIZE() macro
msvcrt: Use the ARRAY_SIZE() macro
scrobj: Use the ARRAY_SIZE() macro
storage.dll16: Use the ARRAY_SIZE() macro
urlmon: Use the ARRAY_SIZE() macro
msvideo.dll16: Use the ARRAY_SIZE() macro
mscoree: Use the ARRAY_SIZE() macro
dxdiagn: Use the ARRAY_SIZE() macro
localui: Use the ARRAY_SIZE() macro
inetmib1: Use the ARRAY_SIZE() macro
kernel32: Use the ARRAY_SIZE() macro
mciwave: Use the ARRAY_SIZE() macro
midimap: Use the ARRAY_SIZE() macro
mscms: Use the ARRAY_SIZE() macro
msctf: Use the ARRAY_SIZE() macro
msscript.ocx: Use the ARRAY_SIZE() macro
Nikolay Sivov (1):
wmp: Make it possible to query IUnknown from IWMPControls.
Piotr Caban (3):
msvcp90: Fix EOF delimiter handling in basic_istream<char>::ignore.
wbemprox: Add Win32_NetworkAdapterConfiguration::IPAddress property.
wbemprox: Add Win32_NetworkAdapterConfiguration::IPSubnet property.
Stefan Dösinger (4):
wined3d: Fix WINED3D_MCS_COLOR2.
d3d9/tests: Add a test for D3DMCS_COLOR{1/2}.
d3d8/tests: Add a test for D3DMCS_COLOR{1/2}.
ddraw/tests: Add a test for D3DMCS_COLOR{1/2}.
Zebediah Figura (1):
msi: Generate unique names for 32- and 64-bit custom action server
pipes.
1
0
Based on a patch by Alex Henrie.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/ddraw/tests/d3d.c | 1058 ---------------------------------------------
dlls/ddraw/tests/ddraw7.c | 482 +++++++++++++++++++++
2 files changed, 482 insertions(+), 1058 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index 77836fd627e..ec0f8d715ca 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -1404,1063 +1404,6 @@ out:
IDirect3DVertexBuffer7_Release(lpVBufSrc);
}
-#define IS_VALUE_NEAR(a, b) ( ((a) == (b)) || ((a) == (b) - 1) || ((a) == (b) + 1) )
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-static void DeviceLoadTest(void)
-{
- DDSURFACEDESC2 ddsd;
- IDirectDrawSurface7 *texture_levels[2][8];
- IDirectDrawSurface7 *cube_face_levels[2][6][8];
- DWORD flags;
- HRESULT hr;
- DDBLTFX ddbltfx;
- RECT loadrect;
- POINT loadpoint;
- int i, i1, i2;
- unsigned diff_count = 0, diff_count2 = 0;
- unsigned x, y;
- BOOL load_mip_subset_broken = FALSE;
- IDirectDrawPalette *palettes[5];
- PALETTEENTRY table1[256];
- DDCOLORKEY ddckey;
- D3DDEVICEDESC7 d3dcaps;
-
- /* Test loading of texture subrectangle with a mipmap surface. */
- memset(texture_levels, 0, sizeof(texture_levels));
- memset(cube_face_levels, 0, sizeof(cube_face_levels));
- memset(palettes, 0, sizeof(palettes));
-
- for (i = 0; i < 2; i++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
- ddsd.dwWidth = 128;
- ddsd.dwHeight = 128;
- U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
- U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
- U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
- U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
- U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
- U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[i][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- /* Check the number of created mipmaps */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_GetSurfaceDesc(texture_levels[i][0], &ddsd);
- ok(hr==DD_OK,"IDirectDrawSurface7_GetSurfaceDesc returned: %x\n",hr);
- ok(U2(ddsd).dwMipMapCount == 8, "unexpected mip count %u\n", U2(ddsd).dwMipMapCount);
- if (U2(ddsd).dwMipMapCount != 8) goto out;
-
- for (i1 = 1; i1 < 8; i1++)
- {
- hr = IDirectDrawSurface7_GetAttachedSurface(texture_levels[i][i1 - 1], &ddsd.ddsCaps, &texture_levels[i][i1]);
- ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
- if (FAILED(hr)) goto out;
- }
- }
-
- for (i1 = 0; i1 < 8; i1++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[0][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- /* x stored in green component, y in blue. */
- DWORD color = 0xff0000 | (x << 8) | y;
- *textureRow++ = color;
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[0][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
- }
-
- for (i1 = 0; i1 < 8; i1++)
- {
- memset(&ddbltfx, 0, sizeof(ddbltfx));
- ddbltfx.dwSize = sizeof(ddbltfx);
- U5(ddbltfx).dwFillColor = 0;
- hr = IDirectDrawSurface7_Blt(texture_levels[1][i1], NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
- ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr);
- }
-
- /* First test some broken coordinates. */
- loadpoint.x = loadpoint.y = 0;
- SetRectEmpty(&loadrect);
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
- ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- loadpoint.x = loadpoint.y = 50;
- loadrect.left = 0;
- loadrect.top = 0;
- loadrect.right = 100;
- loadrect.bottom = 100;
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
- ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- /* Test actual loading. */
- loadpoint.x = loadpoint.y = 31;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- for (i1 = 0; i1 < 8; i1++)
- {
- diff_count = 0;
- diff_count2 = 0;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[1][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- DWORD color = *textureRow++;
-
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top)
- {
- if (color & 0xffffff) diff_count++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != 0xff || g != x + loadrect.left - loadpoint.x || b != y + loadrect.top - loadpoint.y) diff_count++;
- }
-
- /* This codepath is for software RGB device. It has what looks like some weird off by one errors, but may
- technically be correct as it's not precisely defined by docs. */
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top + 1)
- {
- if (color & 0xffffff) diff_count2++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != 0xff || !IS_VALUE_NEAR(g, x + loadrect.left - loadpoint.x) ||
- !IS_VALUE_NEAR(b, y + loadrect.top - loadpoint.y)) diff_count2++;
- }
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[1][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
-
- ok(diff_count == 0 || diff_count2 == 0, "Unexpected destination texture level pixels; %u differences at %d level\n",
- MIN(diff_count, diff_count2), i1);
-
- loadpoint.x /= 2;
- loadpoint.y /= 2;
- loadrect.top /= 2;
- loadrect.left /= 2;
- loadrect.right = (loadrect.right + 1) / 2;
- loadrect.bottom = (loadrect.bottom + 1) / 2;
- }
-
- /* This crashes on native (tested on real windows XP / directx9 / nvidia and
- * qemu Win98 / directx7 / RGB software rasterizer):
- * passing non toplevel surfaces (sublevels) to Load (DX7 docs tell not to do this)
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][1], NULL, texture_levels[0][1], NULL, 0);
- */
-
- /* Freed in reverse order as native seems to dislike and crash on freeing top level surface first. */
- for (i = 0; i < 2; i++)
- {
- for (i1 = 7; i1 >= 0; i1--)
- {
- if (texture_levels[i][i1]) IDirectDrawSurface7_Release(texture_levels[i][i1]);
- }
- }
- memset(texture_levels, 0, sizeof(texture_levels));
-
- /* Test texture size mismatch. */
- for (i = 0; i < 2; i++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
- ddsd.dwWidth = i ? 256 : 128;
- ddsd.dwHeight = 128;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[i][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
- }
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], NULL, texture_levels[0][0], NULL, 0);
- ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[0][0], NULL, texture_levels[1][0], NULL, 0);
- ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- IDirectDrawSurface7_Release(texture_levels[0][0]);
- IDirectDrawSurface7_Release(texture_levels[1][0]);
- memset(texture_levels, 0, sizeof(texture_levels));
-
- memset(&d3dcaps, 0, sizeof(d3dcaps));
- hr = IDirect3DDevice7_GetCaps(lpD3DDevice, &d3dcaps);
- ok(hr == D3D_OK, "IDirect3DDevice7_GetCaps returned %08x\n", hr);
-
- if (!(d3dcaps.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_CUBEMAP))
- {
- skip("No cubemap support\n");
- }
- else
- {
- /* Test loading mipmapped cubemap texture subrectangle from another similar texture. */
- for (i = 0; i < 2; i++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
- ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
- ddsd.dwWidth = 128;
- ddsd.dwHeight = 128;
- U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
- U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
- U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
- U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
- U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
- U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[i][0][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- flags = DDSCAPS2_CUBEMAP_NEGATIVEX;
- for (i1 = 1; i1 < 6; i1++, flags <<= 1)
- {
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
- ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | flags;
- hr = IDirectDrawSurface7_GetAttachedSurface(cube_face_levels[i][0][0], &ddsd.ddsCaps, &cube_face_levels[i][i1][0]);
- ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
- if (FAILED(hr)) goto out;
- }
-
- for (i1 = 0; i1 < 6; i1++)
- {
- /* Check the number of created mipmaps */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_GetSurfaceDesc(cube_face_levels[i][i1][0], &ddsd);
- ok(hr==DD_OK,"IDirectDrawSurface7_GetSurfaceDesc returned: %x\n",hr);
- ok(U2(ddsd).dwMipMapCount == 8, "unexpected mip count %u\n", U2(ddsd).dwMipMapCount);
- if (U2(ddsd).dwMipMapCount != 8) goto out;
-
- for (i2 = 1; i2 < 8; i2++)
- {
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
- ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
- hr = IDirectDrawSurface7_GetAttachedSurface(cube_face_levels[i][i1][i2 - 1], &ddsd.ddsCaps, &cube_face_levels[i][i1][i2]);
- ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
- if (FAILED(hr)) goto out;
- }
- }
- }
-
- for (i = 0; i < 6; i++)
- for (i1 = 0; i1 < 8; i1++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(cube_face_levels[0][i][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- /* face number in low 4 bits of red, x stored in green component, y in blue. */
- DWORD color = 0xf00000 | (i << 16) | (x << 8) | y;
- *textureRow++ = color;
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(cube_face_levels[0][i][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
- }
-
- for (i = 0; i < 6; i++)
- for (i1 = 0; i1 < 8; i1++)
- {
- memset(&ddbltfx, 0, sizeof(ddbltfx));
- ddbltfx.dwSize = sizeof(ddbltfx);
- U5(ddbltfx).dwFillColor = 0;
- hr = IDirectDrawSurface7_Blt(cube_face_levels[1][i][i1], NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
- ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr);
- }
-
- loadpoint.x = loadpoint.y = 10;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], &loadpoint, cube_face_levels[0][0][0], &loadrect,
- DDSCAPS2_CUBEMAP_ALLFACES);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- for (i = 0; i < 6; i++)
- {
- loadpoint.x = loadpoint.y = 10;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
-
- for (i1 = 0; i1 < 8; i1++)
- {
- diff_count = 0;
- diff_count2 = 0;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(cube_face_levels[1][i][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- DWORD color = *textureRow++;
-
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top)
- {
- if (color & 0xffffff) diff_count++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != (0xf0 | i) || g != x + loadrect.left - loadpoint.x ||
- b != y + loadrect.top - loadpoint.y) diff_count++;
- }
-
- /* This codepath is for software RGB device. It has what looks like some weird off by one errors, but may
- technically be correct as it's not precisely defined by docs. */
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top + 1)
- {
- if (color & 0xffffff) diff_count2++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != (0xf0 | i) || !IS_VALUE_NEAR(g, x + loadrect.left - loadpoint.x) ||
- !IS_VALUE_NEAR(b, y + loadrect.top - loadpoint.y)) diff_count2++;
- }
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(cube_face_levels[1][i][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
-
- ok(diff_count == 0 || diff_count2 == 0,
- "Unexpected destination texture level pixels; %u differences at face %x level %d\n",
- MIN(diff_count, diff_count2), i, i1);
-
- loadpoint.x /= 2;
- loadpoint.y /= 2;
- loadrect.top /= 2;
- loadrect.left /= 2;
- loadrect.right = (loadrect.right + 1) / 2;
- loadrect.bottom = (loadrect.bottom + 1) / 2;
- }
- }
-
- for (i = 0; i < 2; i++)
- for (i1 = 5; i1 >= 0; i1--)
- for (i2 = 7; i2 >= 0; i2--)
- {
- if (cube_face_levels[i][i1][i2]) IDirectDrawSurface7_Release(cube_face_levels[i][i1][i2]);
- }
- memset(cube_face_levels, 0, sizeof(cube_face_levels));
-
- /* Test cubemap loading from regular texture. */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX;
- ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
- ddsd.dwWidth = 128;
- ddsd.dwHeight = 128;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[0][0][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
- ddsd.dwWidth = 128;
- ddsd.dwHeight = 128;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[0][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, texture_levels[0][0], NULL,
- DDSCAPS2_CUBEMAP_ALLFACES);
- ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- IDirectDrawSurface7_Release(cube_face_levels[0][0][0]);
- memset(cube_face_levels, 0, sizeof(cube_face_levels));
- IDirectDrawSurface7_Release(texture_levels[0][0]);
- memset(texture_levels, 0, sizeof(texture_levels));
-
- /* Partial cube maps(e.g. created with an explicitly set DDSCAPS2_CUBEMAP_POSITIVEX flag)
- * BSOD some Windows machines when an app tries to create them(Radeon X1600, Windows XP,
- * Catalyst 10.2 driver, 6.14.10.6925)
- */
- }
-
- /* Test texture loading with different mip level count (larger levels match, smaller levels missing in destination. */
- for (i = 0; i < 2; i++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_MIPMAPCOUNT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
- ddsd.dwWidth = 128;
- ddsd.dwHeight = 128;
- U2(ddsd).dwMipMapCount = i ? 4 : 8;
- U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
- U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
- U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
- U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
- U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
- U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[i][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- /* Check the number of created mipmaps */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_GetSurfaceDesc(texture_levels[i][0], &ddsd);
- ok(hr==DD_OK,"IDirectDrawSurface7_GetSurfaceDesc returned: %x\n",hr);
- ok(U2(ddsd).dwMipMapCount == (i ? 4 : 8), "unexpected mip count %u\n", U2(ddsd).dwMipMapCount);
- if (U2(ddsd).dwMipMapCount != (i ? 4 : 8)) goto out;
-
- for (i1 = 1; i1 < (i ? 4 : 8); i1++)
- {
- hr = IDirectDrawSurface7_GetAttachedSurface(texture_levels[i][i1 - 1], &ddsd.ddsCaps, &texture_levels[i][i1]);
- ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
- if (FAILED(hr)) goto out;
- }
- }
-
- for (i1 = 0; i1 < 8; i1++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[0][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- /* x stored in green component, y in blue. */
- DWORD color = 0xf00000 | (i1 << 16) | (x << 8) | y;
- *textureRow++ = color;
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[0][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
- }
-
- for (i1 = 0; i1 < 4; i1++)
- {
- memset(&ddbltfx, 0, sizeof(ddbltfx));
- ddbltfx.dwSize = sizeof(ddbltfx);
- U5(ddbltfx).dwFillColor = 0;
- hr = IDirectDrawSurface7_Blt(texture_levels[1][i1], NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
- ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr);
- }
-
- loadpoint.x = loadpoint.y = 31;
- loadrect.left = 30;
- loadrect.top = 20;
- loadrect.right = 93;
- loadrect.bottom = 52;
-
- /* Destination mip levels are a subset of source mip levels. */
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- for (i1 = 0; i1 < 4; i1++)
- {
- diff_count = 0;
- diff_count2 = 0;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[1][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- DWORD color = *textureRow++;
-
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top)
- {
- if (color & 0xffffff) diff_count++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != (0xf0 | i1) || g != x + loadrect.left - loadpoint.x ||
- b != y + loadrect.top - loadpoint.y) diff_count++;
- }
-
- /* This codepath is for software RGB device. It has what looks like some weird off by one errors, but may
- technically be correct as it's not precisely defined by docs. */
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top + 1)
- {
- if (color & 0xffffff) diff_count2++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != (0xf0 | i1) || !IS_VALUE_NEAR(g, x + loadrect.left - loadpoint.x) ||
- !IS_VALUE_NEAR(b, y + loadrect.top - loadpoint.y)) diff_count2++;
- }
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[1][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
-
- ok(diff_count == 0 || diff_count2 == 0, "Unexpected destination texture level pixels; %u differences at %d level\n",
- MIN(diff_count, diff_count2), i1);
-
- loadpoint.x /= 2;
- loadpoint.y /= 2;
- loadrect.top /= 2;
- loadrect.left /= 2;
- loadrect.right = (loadrect.right + 1) / 2;
- loadrect.bottom = (loadrect.bottom + 1) / 2;
- }
-
- /* Destination mip levels are a superset of source mip levels (should fail). */
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[0][0], &loadpoint, texture_levels[1][0], &loadrect, 0);
- ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- for (i = 0; i < 2; i++)
- {
- for (i1 = 7; i1 >= 0; i1--)
- {
- if (texture_levels[i][i1]) IDirectDrawSurface7_Release(texture_levels[i][i1]);
- }
- }
- memset(texture_levels, 0, sizeof(texture_levels));
-
- /* Test loading from mipmap texture to a regular texture that matches one sublevel in size. */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
- ddsd.dwWidth = 128;
- ddsd.dwHeight = 128;
- U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
- U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
- U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
- U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
- U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
- U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[0][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
- ddsd.dwWidth = 32;
- ddsd.dwHeight = 32;
- U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
- U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
- U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
- U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
- U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
- U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[1][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (i1 = 1; i1 < 8; i1++)
- {
- hr = IDirectDrawSurface7_GetAttachedSurface(texture_levels[0][i1 - 1], &ddsd.ddsCaps, &texture_levels[0][i1]);
- ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
- if (FAILED(hr)) goto out;
- }
-
- for (i1 = 0; i1 < 8; i1++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[0][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- /* x stored in green component, y in blue. */
- DWORD color = 0xf00000 | (i1 << 16) | (x << 8) | y;
- *textureRow++ = color;
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[0][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
- }
-
- memset(&ddbltfx, 0, sizeof(ddbltfx));
- ddbltfx.dwSize = sizeof(ddbltfx);
- U5(ddbltfx).dwFillColor = 0;
- hr = IDirectDrawSurface7_Blt(texture_levels[1][0], NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
- ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr);
-
- loadpoint.x = loadpoint.y = 32;
- loadrect.left = 32;
- loadrect.top = 32;
- loadrect.right = 96;
- loadrect.bottom = 96;
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- loadpoint.x /= 4;
- loadpoint.y /= 4;
- loadrect.top /= 4;
- loadrect.left /= 4;
- loadrect.right = (loadrect.right + 3) / 4;
- loadrect.bottom = (loadrect.bottom + 3) / 4;
-
- /* NOTE: something in either nvidia driver or directx9 on WinXP appears to be broken:
- * this kind of Load calls (to subset with smaller surface(s)) produces wrong results with
- * copied subrectangles divided more than needed, without apparent logic. But it works
- * as expected on qemu / Win98 / directx7 / RGB device. Some things are broken on XP, e.g.
- * some games don't work that worked in Win98, so it is assumed here XP results are wrong.
- * The following code attempts to detect broken results, actual tests will then be skipped
- */
- load_mip_subset_broken = TRUE;
- diff_count = 0;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[1][0], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- DWORD color = *textureRow++;
-
- if (x < 2 || x >= 2 + 4 ||
- y < 2 || y >= 2 + 4)
- {
- if (color & 0xffffff) diff_count++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
-
- if ((r & (0xf0)) != 0xf0) diff_count++;
- }
- }
- }
-
- if (diff_count) load_mip_subset_broken = FALSE;
-
- if (load_mip_subset_broken) {
- skip("IDirect3DDevice7_Load is broken (happens on some modern Windows installations like XP). Skipping affected tests.\n");
- } else {
- diff_count = 0;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- DWORD color = *textureRow++;
-
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top)
- {
- if (color & 0xffffff) diff_count++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != (0xf0 | 2) || g != x + loadrect.left - loadpoint.x ||
- b != y + loadrect.top - loadpoint.y) diff_count++;
- }
- }
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[1][0], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
-
- ok(diff_count == 0, "Unexpected destination texture level pixels; %u differences\n", diff_count);
-
- for (i = 0; i < 2; i++)
- {
- for (i1 = 7; i1 >= 0; i1--)
- {
- if (texture_levels[i][i1]) IDirectDrawSurface7_Release(texture_levels[i][i1]);
- }
- }
- memset(texture_levels, 0, sizeof(texture_levels));
-
- if (!load_mip_subset_broken)
- {
- /* Test loading when destination mip levels are a subset of source mip levels and start from smaller
- * surface (than first source mip level)
- */
- for (i = 0; i < 2; i++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- if (i) ddsd.dwFlags |= DDSD_MIPMAPCOUNT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
- ddsd.dwWidth = i ? 32 : 128;
- ddsd.dwHeight = i ? 32 : 128;
- if (i) U2(ddsd).dwMipMapCount = 4;
- U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
- U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
- U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
- U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
- U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
- U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[i][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- /* Check the number of created mipmaps */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_GetSurfaceDesc(texture_levels[i][0], &ddsd);
- ok(hr==DD_OK,"IDirectDrawSurface7_GetSurfaceDesc returned: %x\n",hr);
- ok(U2(ddsd).dwMipMapCount == (i ? 4 : 8), "unexpected mip count %u\n", U2(ddsd).dwMipMapCount);
- if (U2(ddsd).dwMipMapCount != (i ? 4 : 8)) goto out;
-
- for (i1 = 1; i1 < (i ? 4 : 8); i1++)
- {
- hr = IDirectDrawSurface7_GetAttachedSurface(texture_levels[i][i1 - 1], &ddsd.ddsCaps, &texture_levels[i][i1]);
- ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
- if (FAILED(hr)) goto out;
- }
- }
-
- for (i1 = 0; i1 < 8; i1++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[0][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- /* x stored in green component, y in blue. */
- DWORD color = 0xf00000 | (i1 << 16) | (x << 8) | y;
- *textureRow++ = color;
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[0][i1], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
- }
-
- for (i1 = 0; i1 < 4; i1++)
- {
- memset(&ddbltfx, 0, sizeof(ddbltfx));
- ddbltfx.dwSize = sizeof(ddbltfx);
- U5(ddbltfx).dwFillColor = 0;
- hr = IDirectDrawSurface7_Blt(texture_levels[1][i1], NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
- ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr);
- }
-
- loadpoint.x = loadpoint.y = 0;
- loadrect.left = 0;
- loadrect.top = 0;
- loadrect.right = 64;
- loadrect.bottom = 64;
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], &loadpoint, texture_levels[0][0], &loadrect, 0);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- i = 0;
- for (i1 = 0; i1 < 8 && i < 4; i1++)
- {
- DDSURFACEDESC2 ddsd2;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_GetSurfaceDesc(texture_levels[0][i1], &ddsd);
- ok(SUCCEEDED(hr), "IDirectDrawSurface7_GetSurfaceDesc returned %#x.\n", hr);
-
- memset(&ddsd2, 0, sizeof(DDSURFACEDESC2));
- ddsd2.dwSize = sizeof(ddsd2);
- hr = IDirectDrawSurface7_GetSurfaceDesc(texture_levels[1][i], &ddsd2);
- ok(SUCCEEDED(hr), "IDirectDrawSurface7_GetSurfaceDesc returned %#x.\n", hr);
-
- if (ddsd.dwWidth == ddsd2.dwWidth && ddsd.dwHeight == ddsd2.dwHeight)
- {
- diff_count = 0;
-
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(texture_levels[1][i], NULL, &ddsd, DDLOCK_WAIT, NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- for (y = 0 ; y < ddsd.dwHeight; y++)
- {
- DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
-
- for (x = 0; x < ddsd.dwWidth; x++)
- {
- DWORD color = *textureRow++;
-
- if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
- y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top)
- {
- if (color & 0xffffff) diff_count++;
- }
- else
- {
- DWORD r = (color & 0xff0000) >> 16;
- DWORD g = (color & 0xff00) >> 8;
- DWORD b = (color & 0xff);
-
- if (r != (0xf0 | i1) || g != x + loadrect.left - loadpoint.x ||
- b != y + loadrect.top - loadpoint.y) diff_count++;
- }
- }
- }
-
- hr = IDirectDrawSurface7_Unlock(texture_levels[1][i], NULL);
- ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
-
- ok(diff_count == 0, "Unexpected destination texture level pixels; %u differences at %d level\n", diff_count, i1);
-
- i++;
- }
-
- loadpoint.x /= 2;
- loadpoint.y /= 2;
- loadrect.top /= 2;
- loadrect.left /= 2;
- loadrect.right = (loadrect.right + 1) / 2;
- loadrect.bottom = (loadrect.bottom + 1) / 2;
- }
-
- for (i = 0; i < 2; i++)
- {
- for (i1 = 7; i1 >= 0; i1--)
- {
- if (texture_levels[i][i1]) IDirectDrawSurface7_Release(texture_levels[i][i1]);
- }
- }
- memset(texture_levels, 0, sizeof(texture_levels));
- }
-
- /* Test palette copying. */
- for (i = 0; i < 2; i++)
- {
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
- ddsd.dwWidth = 128;
- ddsd.dwHeight = 128;
- U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
- U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
- U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 8;
- hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[i][0], NULL);
- ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
- if (FAILED(hr)) goto out;
-
- /* Check the number of created mipmaps */
- memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_GetSurfaceDesc(texture_levels[i][0], &ddsd);
- ok(hr==DD_OK,"IDirectDrawSurface7_GetSurfaceDesc returned: %x\n",hr);
- ok(U2(ddsd).dwMipMapCount == 8, "unexpected mip count %u\n", U2(ddsd).dwMipMapCount);
- if (U2(ddsd).dwMipMapCount != 8) goto out;
-
- for (i1 = 1; i1 < 8; i1++)
- {
- hr = IDirectDrawSurface7_GetAttachedSurface(texture_levels[i][i1 - 1], &ddsd.ddsCaps, &texture_levels[i][i1]);
- ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
- if (FAILED(hr)) goto out;
- }
- }
-
- memset(table1, 0, sizeof(table1));
- for (i = 0; i < 3; i++)
- {
- table1[0].peBlue = i + 1;
- hr = IDirectDraw7_CreatePalette(lpDD, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, table1, &palettes[i], NULL);
- ok(hr == DD_OK, "CreatePalette returned %08x\n", hr);
- if (FAILED(hr))
- {
- skip("IDirectDraw7_CreatePalette failed; skipping further tests\n");
- goto out;
- }
- }
-
- hr = IDirectDrawSurface7_SetPalette(texture_levels[0][0], palettes[0]);
- ok(hr==DD_OK, "IDirectDrawSurface7_SetPalette returned: %x\n", hr);
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], NULL, texture_levels[0][0], NULL, 0);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- hr = IDirectDrawSurface7_GetPalette(texture_levels[0][1], &palettes[4]);
- ok(hr==DDERR_NOPALETTEATTACHED, "IDirectDrawSurface7_GetPalette returned: %x\n", hr);
-
- hr = IDirectDrawSurface7_GetPalette(texture_levels[1][0], &palettes[4]);
- ok(hr==DDERR_NOPALETTEATTACHED, "IDirectDrawSurface7_GetPalette returned: %x\n", hr);
-
- hr = IDirectDrawSurface7_SetPalette(texture_levels[0][1], palettes[1]);
- ok(hr==DDERR_NOTONMIPMAPSUBLEVEL, "IDirectDrawSurface7_SetPalette returned: %x\n", hr);
- hr = IDirectDrawSurface7_SetPalette(texture_levels[1][0], palettes[2]);
- ok(hr==DD_OK, "IDirectDrawSurface7_SetPalette returned: %x\n", hr);
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], NULL, texture_levels[0][0], NULL, 0);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- memset(table1, 0, sizeof(table1));
- hr = IDirectDrawSurface7_GetPalette(texture_levels[1][0], &palettes[4]);
- ok(hr==DD_OK, "IDirectDrawSurface7_GetPalette returned: %x\n", hr);
- if (SUCCEEDED(hr))
- {
- hr = IDirectDrawPalette_GetEntries(palettes[4], 0, 0, 256, table1);
- ok(hr == DD_OK, "IDirectDrawPalette_GetEntries returned %08x\n", hr);
- ok(table1[0].peBlue == 1, "Unexpected palette color after load: %u\n", (unsigned)table1[0].peBlue);
- }
-
- /* Test colorkey copying. */
- ddckey.dwColorSpaceLowValue = ddckey.dwColorSpaceHighValue = 64;
- hr = IDirectDrawSurface7_SetColorKey(texture_levels[0][0], DDCKEY_SRCBLT, &ddckey);
- ok(hr==DD_OK, "IDirectDrawSurface7_SetColorKey returned: %x\n", hr);
- hr = IDirectDrawSurface7_SetColorKey(texture_levels[0][1], DDCKEY_SRCBLT, &ddckey);
- ok(hr == DDERR_NOTONMIPMAPSUBLEVEL, "Got unexpected hr %#x.\n", hr);
-
- hr = IDirectDrawSurface7_GetColorKey(texture_levels[1][0], DDCKEY_SRCBLT, &ddckey);
- ok(hr==DDERR_NOCOLORKEY, "IDirectDrawSurface7_GetColorKey returned: %x\n", hr);
-
- hr = IDirect3DDevice7_Load(lpD3DDevice, texture_levels[1][0], NULL, texture_levels[0][0], NULL, 0);
- ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
-
- hr = IDirectDrawSurface7_GetColorKey(texture_levels[1][0], DDCKEY_SRCBLT, &ddckey);
- ok(hr==DD_OK, "IDirectDrawSurface7_GetColorKey returned: %x\n", hr);
- ok(ddckey.dwColorSpaceLowValue == ddckey.dwColorSpaceHighValue && ddckey.dwColorSpaceLowValue == 64,
- "Unexpected color key values: %u - %u\n", ddckey.dwColorSpaceLowValue, ddckey.dwColorSpaceHighValue);
-
- out:
-
- for (i = 0; i < 5; i++)
- {
- if (palettes[i]) IDirectDrawPalette_Release(palettes[i]);
- }
-
- for (i = 0; i < 2; i++)
- {
- for (i1 = 7; i1 >= 0; i1--)
- {
- if (texture_levels[i][i1]) IDirectDrawSurface7_Release(texture_levels[i][i1]);
- }
- }
-
- for (i = 0; i < 2; i++)
- for (i1 = 5; i1 >= 0; i1--)
- for (i2 = 7; i2 >= 0; i2--)
- {
- if (cube_face_levels[i][i1][i2]) IDirectDrawSurface7_Release(cube_face_levels[i][i1][i2]);
- }
-}
-
static void SetMaterialTest(void)
{
HRESULT rc;
@@ -3422,7 +2365,6 @@ START_TEST(d3d)
SetMaterialTest();
CapsTest();
VertexBufferDescTest();
- DeviceLoadTest();
SetRenderTargetTest();
VertexBufferLockRest();
z_format_test();
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 35a45c03456..4b9d367a748 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -14267,6 +14267,487 @@ static void test_viewport(void)
DestroyWindow(window);
}
+static unsigned int validate_loaded_surface(IDirectDrawSurface7 *surface, unsigned int face,
+ unsigned int level, const RECT *src_rect, const POINT *dst_point)
+{
+ DDSURFACEDESC2 surface_desc;
+ unsigned int diff, x, y;
+ HRESULT hr;
+
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ hr = IDirectDrawSurface7_Lock(surface, NULL, &surface_desc, DDLOCK_WAIT, NULL);
+ ok(SUCCEEDED(hr), "Failed to map surface, hr %#x.\n", hr);
+
+ for (y = 0, diff = 0; y < surface_desc.dwHeight; ++y)
+ {
+ DWORD *texture_row = (DWORD *)((char *)surface_desc.lpSurface + y * U1(surface_desc).lPitch);
+
+ for (x = 0; x < surface_desc.dwWidth; ++x)
+ {
+ DWORD colour = texture_row[x];
+ DWORD r = (colour & 0xff0000) >> 16;
+ DWORD g = (colour & 0xff00) >> 8;
+ DWORD b = (colour & 0xff);
+
+ if (x < dst_point->x || x >= dst_point->x + src_rect->right - src_rect->left
+ || y < dst_point->y || y >= dst_point->y + src_rect->bottom - src_rect->top)
+ {
+ if (colour & 0xffffff)
+ ++diff;
+ }
+ else
+ {
+ if (r != ((face << 4) | level)
+ || g != x + src_rect->left - dst_point->x
+ || b != y + src_rect->top - dst_point->y)
+ ++diff;
+ }
+ }
+ }
+
+ hr = IDirectDrawSurface7_Unlock(surface, NULL);
+ ok(SUCCEEDED(hr), "Failed to unmap surface, hr %#x.\n", hr);
+
+ return diff;
+}
+
+static void test_device_load(void)
+{
+ IDirectDrawSurface7 *src_surface, *dst_surface, *surface, *tmp;
+ DDSCAPS2 mip_caps = {0, DDSCAPS2_MIPMAPSUBLEVEL, 0, {0}};
+ IDirectDrawPalette *src_palette, *dst_palette, *palette;
+ unsigned int i, j, k, l, x, y;
+ DDSURFACEDESC2 surface_desc;
+ IDirect3DDevice7 *device;
+ PALETTEENTRY table1[256];
+ D3DDEVICEDESC7 d3d_caps;
+ DDCOLORKEY colour_key;
+ IDirectDraw7 *ddraw;
+ BOOL cube_support;
+ IDirect3D7 *d3d;
+ ULONG refcount;
+ HWND window;
+ DDBLTFX fx;
+ HRESULT hr;
+
+#define TEX_MIP 0x01
+#define TEX_CUBE 0x02
+#define NULL_COORDS 0x04
+
+ /* Creating partial cube maps (e.g. created with just
+ * DDSCAPS2_CUBEMAP_POSITIVEX) BSODs some Windows machines. (Radeon X1600,
+ * Windows XP, Catalyst 10.2 driver, 6.14.10.6925)
+ *
+ * Passing non-toplevel surfaces to IDirect3DDevice7_Load() crashes on
+ * native. (Windows XP / NVIDIA, Windows 98 / RGB software rasteriser) */
+ static const struct
+ {
+ unsigned int src_w, src_h, src_mip_count;
+ RECT src_rect;
+ DWORD src_flags;
+ unsigned int dst_w, dst_h, dst_mip_count;
+ POINT dst_point;
+ DWORD dst_flags;
+ HRESULT hr;
+ }
+ tests[] =
+ {
+ {128, 128, 0, { 0, 0, 0, 0}, TEX_MIP, 128, 128, 0, { 0, 0}, TEX_MIP, DDERR_INVALIDPARAMS},
+ {128, 128, 0, { 0, 0, 100, 100}, TEX_MIP, 128, 128, 0, {50, 50}, TEX_MIP, DDERR_INVALIDPARAMS},
+ {128, 128, 0, {30, 20, 93, 52}, TEX_MIP, 128, 128, 0, {31, 31}, TEX_MIP, D3D_OK},
+ {128, 128, 0, { 0, 0, 0, 0}, NULL_COORDS, 128, 128, 0, { 0, 0}, NULL_COORDS, D3D_OK},
+ {128, 128, 0, { 0, 0, 0, 0}, NULL_COORDS, 256, 128, 0, { 0, 0}, NULL_COORDS, DDERR_INVALIDPARAMS},
+ {256, 128, 0, { 0, 0, 0, 0}, NULL_COORDS, 128, 128, 0, { 0, 0}, NULL_COORDS, DDERR_INVALIDPARAMS},
+ {128, 128, 0, {30, 20, 93, 52}, TEX_MIP | TEX_CUBE, 128, 128, 0, {10, 10}, TEX_MIP | TEX_CUBE, D3D_OK},
+ {128, 128, 0, { 0, 0, 0, 0}, NULL_COORDS, 128, 128, 0, { 0, 0}, TEX_CUBE | NULL_COORDS, DDERR_INVALIDPARAMS},
+ {128, 128, 0, {30, 20, 93, 52}, TEX_MIP, 128, 128, 4, {31, 31}, TEX_MIP, D3D_OK},
+ {128, 128, 4, {30, 20, 93, 52}, TEX_MIP, 128, 128, 0, {31, 31}, TEX_MIP, DDERR_INVALIDPARAMS},
+ {128, 128, 0, {32, 32, 96, 96}, TEX_MIP, 32, 32, 0, {32, 32}, 0, D3D_OK},
+ {128, 128, 0, { 0, 0, 64, 64}, TEX_MIP, 32, 32, 4, { 0, 0}, TEX_MIP, D3D_OK},
+ };
+
+ window = create_window();
+ if (!(device = create_device(window, DDSCL_NORMAL)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice7_GetDirect3D(device, &d3d);
+ ok(SUCCEEDED(hr), "Failed to get Direct3D7 interface, hr %#x.\n", hr);
+ hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw);
+ ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr);
+ IDirect3D7_Release(d3d);
+
+ memset(&d3d_caps, 0, sizeof(d3d_caps));
+ hr = IDirect3DDevice7_GetCaps(device, &d3d_caps);
+ ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
+ cube_support = d3d_caps.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_CUBEMAP;
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ unsigned int src_count, dst_count;
+ POINT dst_point, dst_point_broken;
+ RECT src_rect, src_rect_broken;
+
+ if ((tests[i].src_flags | tests[i].dst_flags) & TEX_CUBE && !cube_support)
+ {
+ skip("No cubemap support, skipping test %u.\n", i);
+ continue;
+ }
+
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ if (tests[i].src_mip_count)
+ surface_desc.dwFlags |= DDSD_MIPMAPCOUNT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
+ if (tests[i].src_flags & (TEX_MIP | TEX_CUBE))
+ surface_desc.ddsCaps.dwCaps |= DDSCAPS_COMPLEX;
+ if (tests[i].src_flags & TEX_MIP)
+ surface_desc.ddsCaps.dwCaps |= DDSCAPS_MIPMAP;
+ if (tests[i].src_flags & TEX_CUBE)
+ surface_desc.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
+ surface_desc.dwWidth = tests[i].src_w;
+ surface_desc.dwHeight = tests[i].src_h;
+ U2(surface_desc).dwMipMapCount = tests[i].src_mip_count;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &src_surface, NULL);
+ ok(SUCCEEDED(hr), "Test %u: Failed to create source surface, hr %#x.\n", i, hr);
+
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ if (tests[i].dst_mip_count)
+ surface_desc.dwFlags |= DDSD_MIPMAPCOUNT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
+ if (tests[i].dst_flags & (TEX_MIP | TEX_CUBE))
+ surface_desc.ddsCaps.dwCaps |= DDSCAPS_COMPLEX;
+ if (tests[i].dst_flags & TEX_MIP)
+ surface_desc.ddsCaps.dwCaps |= DDSCAPS_MIPMAP;
+ surface_desc.ddsCaps.dwCaps2 = 0;
+ if (tests[i].dst_flags & TEX_CUBE)
+ surface_desc.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
+ surface_desc.dwWidth = tests[i].dst_w;
+ surface_desc.dwHeight = tests[i].dst_h;
+ U2(surface_desc).dwMipMapCount = tests[i].dst_mip_count;
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &dst_surface, NULL);
+ ok(SUCCEEDED(hr), "Test %u: Failed to create destination surface, hr %#x.\n", i, hr);
+
+ src_count = dst_count = 1;
+ if (tests[i].src_flags & TEX_MIP)
+ src_count = tests[i].src_mip_count ? tests[i].src_mip_count : 8;
+ if (tests[i].dst_flags & TEX_MIP)
+ dst_count = tests[i].dst_mip_count ? tests[i].dst_mip_count : 8;
+
+ surface = src_surface;
+ IDirectDrawSurface7_AddRef(surface);
+ for (j = 0;;)
+ {
+ DDSCAPS2 face_caps = {0, 0, 0, {0}};
+
+ /* Check the number of created mipmaps. */
+ if (tests[i].src_flags & TEX_MIP)
+ {
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
+ ok(SUCCEEDED(hr), "Test %u: Failed to get surface description, hr %#x.\n", i, hr);
+ ok(U2(surface_desc).dwMipMapCount == src_count,
+ "Test %u: Got unexpected mip count %u, expected %u.\n",
+ i, U2(surface_desc).dwMipMapCount, src_count);
+ }
+
+ for (k = 0; ; ++k)
+ {
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ hr = IDirectDrawSurface7_Lock(surface, NULL, &surface_desc, DDLOCK_WAIT, NULL);
+ ok(SUCCEEDED(hr), "Test %u: Failed to map surface, hr %#x.\n", i, hr);
+
+ for (y = 0; y < surface_desc.dwHeight; ++y)
+ {
+ DWORD *texture_row = (DWORD *)((BYTE *)surface_desc.lpSurface + y * U1(surface_desc).lPitch);
+
+ for (x = 0; x < surface_desc.dwWidth; ++x)
+ {
+ /* The face number is stored in the high 4 bits of the
+ * red component, the mip-level in the low 4 bits. The
+ * x-coordinate is stored in the green component, and
+ * the y-coordinate in the blue component. */
+ texture_row[x] = (j << 20) | (k << 16) | (x << 8) | y;
+ }
+ }
+
+ hr = IDirectDrawSurface7_Unlock(surface, NULL);
+ ok(SUCCEEDED(hr), "Test %u: Failed to unmap surface, hr %#x.\n", i, hr);
+
+ hr = IDirectDrawSurface7_GetAttachedSurface(surface, &mip_caps, &tmp);
+ IDirectDrawSurface7_Release(surface);
+ if (FAILED(hr))
+ break;
+ surface = tmp;
+ }
+
+ if (!(tests[i].src_flags & TEX_CUBE) || ++j >= 6)
+ break;
+
+ face_caps.dwCaps2 = DDSCAPS2_CUBEMAP | (DDSCAPS2_CUBEMAP_POSITIVEX << j);
+ hr = IDirectDrawSurface7_GetAttachedSurface(src_surface, &face_caps, &surface);
+ ok(SUCCEEDED(hr), "Test %u: Failed to get face %u.\n", i, j);
+ }
+
+ surface = dst_surface;
+ IDirectDrawSurface7_AddRef(surface);
+ for (j = 0;;)
+ {
+ DDSCAPS2 face_caps = {0, 0, 0, {0}};
+
+ /* Check the number of created mipmaps. */
+ if (tests[i].dst_flags & TEX_MIP)
+ {
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
+ ok(SUCCEEDED(hr), "Test %u: Failed to get surface description, hr %#x.\n", i, hr);
+ ok(U2(surface_desc).dwMipMapCount == dst_count,
+ "Test %u: Got unexpected mip count %u, expected %u.\n",
+ i, U2(surface_desc).dwMipMapCount, dst_count);
+ }
+
+ for (;;)
+ {
+ memset(&fx, 0, sizeof(fx));
+ fx.dwSize = sizeof(fx);
+ U5(fx).dwFillColor = 0x00000000;
+ hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
+ ok(SUCCEEDED(hr), "Test %u: Failed to clear surface, hr %#x.\n", i, hr);
+
+ hr = IDirectDrawSurface7_GetAttachedSurface(surface, &mip_caps, &tmp);
+ IDirectDrawSurface7_Release(surface);
+ if (FAILED(hr))
+ break;
+ surface = tmp;
+ }
+
+ if (!(tests[i].dst_flags & TEX_CUBE) || ++j >= 6)
+ break;
+
+ face_caps.dwCaps2 = DDSCAPS2_CUBEMAP | (DDSCAPS2_CUBEMAP_POSITIVEX << j);
+ hr = IDirectDrawSurface7_GetAttachedSurface(dst_surface, &face_caps, &surface);
+ ok(SUCCEEDED(hr), "Test %u: Failed to get face %u.\n", i, j);
+ }
+
+ src_rect = tests[i].src_rect;
+ dst_point = tests[i].dst_point;
+ hr = IDirect3DDevice7_Load(device,
+ dst_surface, tests[i].dst_flags & NULL_COORDS ? NULL : &dst_point,
+ src_surface, tests[i].src_flags & NULL_COORDS ? NULL : &src_rect,
+ tests[i].dst_flags & TEX_CUBE ? DDSCAPS2_CUBEMAP_ALLFACES : 0);
+ ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
+
+ if (SUCCEEDED(hr))
+ {
+ unsigned int level_offset, level_offset_broken;
+
+ for (level_offset = 0, k = tests[i].src_w; k > tests[i].dst_w; ++level_offset, k /= 2);
+ level_offset_broken = src_count - dst_count;
+
+ surface = dst_surface;
+ IDirectDrawSurface7_AddRef(surface);
+ for (j = 0;;)
+ {
+ DDSCAPS2 face_caps = {0, 0, 0, {0}};
+
+ if (tests[i].src_flags & NULL_COORDS)
+ SetRect(&src_rect, 0, 0, tests[i].src_w, tests[i].src_h);
+ else
+ src_rect = tests[i].src_rect;
+
+ if (tests[i].dst_flags & NULL_COORDS)
+ dst_point.x = dst_point.y = 0;
+ else
+ dst_point = tests[i].dst_point;
+
+ for (k = 0; k < level_offset; ++k)
+ {
+ dst_point.x /= 2;
+ dst_point.y /= 2;
+ src_rect.top /= 2;
+ src_rect.left /= 2;
+ src_rect.right = (src_rect.right + 1) / 2;
+ src_rect.bottom = (src_rect.bottom + 1) / 2;
+ }
+
+ for (k = 0; ; ++k)
+ {
+ unsigned int diff, diff2, diff3;
+
+ diff = validate_loaded_surface(surface, j, k + level_offset, &src_rect, &dst_point);
+
+ /* On some newer (XP+) versions of Windows, it appears the
+ * source/destination coordinates are divided too often.
+ * This works correctly on Windows 98 with the RGB
+ * software rasteriser. */
+ src_rect_broken = src_rect;
+ dst_point_broken = dst_point;
+ for (l = 0; l < level_offset; ++l)
+ {
+ dst_point_broken.x /= 2;
+ dst_point_broken.y /= 2;
+ src_rect_broken.top /= 2;
+ src_rect_broken.left /= 2;
+ src_rect_broken.right = (src_rect_broken.right + 1) / 2;
+ src_rect_broken.bottom = (src_rect_broken.bottom + 1) / 2;
+ }
+ diff2 = validate_loaded_surface(surface, j, k + level_offset,
+ &src_rect_broken, &dst_point_broken);
+
+ /* On Windows 8+ things are slightly worse still. Instead
+ * of applying the correct level offset twice, like on
+ * XP+, an incorrect offset is applied in addition to the
+ * correct one. Additionally, on Windows 8+, this offset
+ * also affects the selected source mip-level, as opposed
+ * to Windows XP+ where it only affects the
+ * source/destination coordinates. */
+ src_rect_broken = src_rect;
+ dst_point_broken = dst_point;
+ for (l = 0; l < level_offset_broken; ++l)
+ {
+ dst_point_broken.x /= 2;
+ dst_point_broken.y /= 2;
+ src_rect_broken.top /= 2;
+ src_rect_broken.left /= 2;
+ src_rect_broken.right = (src_rect_broken.right + 1) / 2;
+ src_rect_broken.bottom = (src_rect_broken.bottom + 1) / 2;
+ }
+ diff3 = validate_loaded_surface(surface, j, k + level_offset_broken,
+ &src_rect_broken, &dst_point_broken);
+
+ ok(!diff || broken(!diff2 || !diff3), "Test %u, face %u, level %u: "
+ "Unexpected destination texture level pixels; %u/%u/%u differences.\n",
+ i, j, k, diff, diff2, diff3);
+
+ hr = IDirectDrawSurface7_GetAttachedSurface(surface, &mip_caps, &tmp);
+ IDirectDrawSurface7_Release(surface);
+ if (FAILED(hr))
+ break;
+ surface = tmp;
+
+ dst_point.x /= 2;
+ dst_point.y /= 2;
+ src_rect.top /= 2;
+ src_rect.left /= 2;
+ src_rect.right = (src_rect.right + 1) / 2;
+ src_rect.bottom = (src_rect.bottom + 1) / 2;
+ }
+
+ if (!(tests[i].dst_flags & TEX_CUBE) || ++j >= 6)
+ break;
+
+ face_caps.dwCaps2 = DDSCAPS2_CUBEMAP | (DDSCAPS2_CUBEMAP_POSITIVEX << j);
+ hr = IDirectDrawSurface7_GetAttachedSurface(dst_surface, &face_caps, &surface);
+ ok(SUCCEEDED(hr), "Test %u: Failed to get face %u.\n", i, j);
+ }
+ }
+
+ IDirectDrawSurface7_Release(dst_surface);
+ IDirectDrawSurface7_Release(src_surface);
+ }
+#undef TEX_MIP
+#undef TEX_CUBE
+#undef NULL_COORDS
+
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
+ surface_desc.dwWidth = 128;
+ surface_desc.dwHeight = 128;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 8;
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &src_surface, NULL);
+ ok(SUCCEEDED(hr), "Failed to create source surface, hr %#x.\n", hr);
+ hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &dst_surface, NULL);
+ ok(SUCCEEDED(hr), "Failed to create destination surface, hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_GetAttachedSurface(src_surface, &mip_caps, &surface);
+ ok(SUCCEEDED(hr), "Failed to get surface, hr %#x.\n", hr);
+
+ /* Test palette copying. */
+ memset(table1, 0, sizeof(table1));
+ table1[0].peBlue = 1;
+ hr = IDirectDraw7_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, table1, &src_palette, NULL);
+ ok(SUCCEEDED(hr), "Failed to create source palette, hr %#x.\n", hr);
+ table1[0].peBlue = 3;
+ hr = IDirectDraw7_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, table1, &dst_palette, NULL);
+ ok(SUCCEEDED(hr), "Failed to create destination palette, hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface7_SetPalette(src_surface, src_palette);
+ ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_Load(device, dst_surface, NULL, src_surface, NULL, 0);
+ ok(SUCCEEDED(hr), "Failed to load texture, hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface7_GetPalette(surface, &palette);
+ ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_GetPalette(dst_surface, &palette);
+ ok(hr == DDERR_NOPALETTEATTACHED, "Got unexpected hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface7_SetPalette(surface, src_palette);
+ ok(hr == DDERR_NOTONMIPMAPSUBLEVEL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_SetPalette(dst_surface, dst_palette);
+ ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_Load(device, dst_surface, NULL, src_surface, NULL, 0);
+ ok(SUCCEEDED(hr), "Failed to load texture, hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface7_GetPalette(dst_surface, &palette);
+ ok(SUCCEEDED(hr), "Failed to get palette, hr %#x.\n", hr);
+ ok(palette == dst_palette, "Got unexpected palette %p, expected %p.\n", palette, dst_palette);
+ memset(table1, 0, sizeof(table1));
+ hr = IDirectDrawPalette_GetEntries(palette, 0, 0, 256, table1);
+ ok(SUCCEEDED(hr), "Failed to retrieve palette entries, hr %#x.\n", hr);
+ ok(table1[0].peBlue == 1, "Got unexpected palette colour %#x.\n", (unsigned int)table1[0].peBlue);
+ IDirectDrawPalette_Release(palette);
+
+ IDirectDrawPalette_Release(dst_palette);
+ IDirectDrawPalette_Release(src_palette);
+
+ /* Test colour-key copying. */
+ colour_key.dwColorSpaceLowValue = 32;
+ colour_key.dwColorSpaceHighValue = 64;
+ hr = IDirectDrawSurface7_SetColorKey(src_surface, DDCKEY_SRCBLT, &colour_key);
+ ok(SUCCEEDED(hr), "Failed to set colour-key, hr %#x.\n", hr);
+ hr = IDirectDrawSurface7_SetColorKey(surface, DDCKEY_SRCBLT, &colour_key);
+ ok(hr == DDERR_NOTONMIPMAPSUBLEVEL, "Got unexpected hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface7_GetColorKey(dst_surface, DDCKEY_SRCBLT, &colour_key);
+ ok(hr == DDERR_NOCOLORKEY, "Got unexpected hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_Load(device, dst_surface, NULL, src_surface, NULL, 0);
+ ok(SUCCEEDED(hr), "Failed to load texture, hr %#x.\n", hr);
+
+ hr = IDirectDrawSurface7_GetColorKey(dst_surface, DDCKEY_SRCBLT, &colour_key);
+ ok(SUCCEEDED(hr), "Failed to get colour-key, hr %#x.\n", hr);
+ ok(colour_key.dwColorSpaceLowValue == 32, "Got unexpected value %u.\n", colour_key.dwColorSpaceLowValue);
+ ok(colour_key.dwColorSpaceHighValue == 32, "Got unexpected value %u.\n", colour_key.dwColorSpaceHighValue);
+
+ IDirectDrawSurface7_Release(surface);
+ IDirectDrawSurface7_Release(dst_surface);
+ IDirectDrawSurface7_Release(src_surface);
+
+ IDirectDraw7_Release(ddraw);
+ refcount = IDirect3DDevice7_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ DestroyWindow(window);
+}
+
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
@@ -14402,4 +14883,5 @@ START_TEST(ddraw7)
test_clear();
test_enum_surfaces();
test_viewport();
+ test_device_load();
}
--
2.11.0
2
1
From: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
A ddraw4 version is on my TODO list. ddraw1 and ddraw2 cannot use
lighting and per-vertex colour at the same time due to the predefined
D3D*VERTEX structs. ddraw4 can, and it has D3DLIGHTSTATE_COLORVERTEX,
but the material source states are missing. I assume that one or more of
the material properties then track the vertex colour, but I have to find
out which.
---
dlls/ddraw/tests/ddraw7.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 134 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 4b9d367a748..cc1662293c0 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -14748,6 +14748,139 @@ static void test_device_load(void)
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirect3DDevice7 *device;
+ IDirectDrawSurface7 *rt;
+ D3DMATERIAL7 material;
+ D3DCOLOR colour;
+ unsigned int i;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+
+ static struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad_2c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+ static struct
+ {
+ struct vec3 position;
+ DWORD colour;
+ }
+ quad_1c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000},
+ };
+ static struct
+ {
+ struct vec3 position;
+ }
+ quad_0c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}},
+ {{-1.0f, 1.0f, 0.0f}},
+ {{ 1.0f, -1.0f, 0.0f}},
+ {{ 1.0f, 1.0f, 0.0f}},
+ };
+
+ /* The idea here is to set up ambient light parameters in a way that the
+ * ambient colour from the material is just passed through. The emissive
+ * colour is just passed through anyway. The sum of ambient + emissive
+ * should allow deduction of where the material colour came from. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ void *vtx;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0, quad_2c},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00, quad_2c},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080, quad_1c},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0, quad_1c},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0, quad_1c},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0, quad_0c},
+ };
+
+ window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, 0, 0, 0, 0);
+ if (!(device = create_device(window, DDSCL_NORMAL)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+ hr = IDirect3DDevice7_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ U3(U1(material).ambient).b = 0.5f;
+ U3(U3(material).emissive).b = 0.25f;
+ hr = IDirect3DDevice7_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP,
+ D3DFVF_XYZ | tests[i].fvf, tests[i].vtx, 4, 0);
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ colour = get_surface_color(rt, 320, 240);
+ ok(compare_color(colour, tests[i].result, 1),
+ "Expected colour 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, colour);
+ }
+
+ IDirectDrawSurface7_Release(rt);
+ refcount = IDirect3DDevice7_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ DestroyWindow(window);
+}
+
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
@@ -14884,4 +15017,5 @@ START_TEST(ddraw7)
test_enum_surfaces();
test_viewport();
test_device_load();
+ test_color_vertex();
}
--
2.11.0
1
0
From: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d8/tests/visual.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index 3379f072cc4..24481bd0533 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -10335,6 +10335,118 @@ done:
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirect3DDevice8 *device;
+ D3DMATERIAL8 material;
+ IDirect3D8 *d3d;
+ D3DCOLOR colour;
+ unsigned int i;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+
+ /* The idea here is to set up ambient light parameters in a way that the
+ * ambient colour from the material is just passed through. The emissive
+ * colour is just passed through anyway. The sum of ambient + emissive
+ * should allow deduction of where the material colour came from.
+ *
+ * Note that in cases without a D3DFVF_DIFFUSE flag the first colour value
+ * in the struct will be fed into the specular vertex colour slot. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+ };
+ static const struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+
+ window = create_window();
+ ok(!!window, "Failed to create a window.\n");
+
+ d3d = Direct3DCreate8(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ material.Ambient.b = 0.5f;
+ material.Emissive.b = 0.25f;
+ hr = IDirect3DDevice8_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | tests[i].fvf);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice8_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ colour = getPixelColor(device, 320, 240);
+ ok(color_match(colour, tests[i].result, 1),
+ "Expected colour 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, colour);
+ }
+
+ refcount = IDirect3DDevice8_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(visual)
{
D3DADAPTER_IDENTIFIER8 identifier;
@@ -10408,4 +10520,5 @@ START_TEST(visual)
test_drawindexedprimitiveup();
test_map_synchronisation();
test_viewport();
+ test_color_vertex();
}
--
2.11.0
1
0
From: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d9/tests/visual.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 114 insertions(+)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 5567e72cef8..9c3e83d3005 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -24085,6 +24085,119 @@ done:
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirect3DDevice9 *device;
+ D3DMATERIAL9 material;
+ IDirect3D9 *d3d;
+ D3DCOLOR colour;
+ unsigned int i;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+
+ /* The idea here is to set up ambient light parameters in a way that the
+ * ambient colour from the material is just passed through. The emissive
+ * colour is just passed through anyway. The sum of ambient + emissive
+ * should allow deduction of where the material colour came from.
+ *
+ * Note that in cases without a D3DFVF_DIFFUSE flag the first colour value
+ * in the struct will be fed into the specular vertex colour slot. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+ };
+
+ static const struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+
+ window = create_window();
+ ok(!!window, "Failed to create a window.\n");
+
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ material.Ambient.b = 0.5f;
+ material.Emissive.b = 0.25f;
+ hr = IDirect3DDevice9_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | tests[i].fvf);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice9_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ colour = getPixelColor(device, 320, 240);
+ ok(color_match(colour, tests[i].result, 1),
+ "Expected colour 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, colour);
+ }
+
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(visual)
{
D3DADAPTER_IDENTIFIER9 identifier;
@@ -24222,4 +24335,5 @@ START_TEST(visual)
test_mvp_software_vertex_shaders();
test_null_format();
test_map_synchronisation();
+ test_color_vertex();
}
--
2.11.0
1
0
[PATCH 06/12] d3d8/tests: Test DXT1 and DXT3 as well in volume_dxt5_test().
by Henri Verbeet 04 Aug '18
by Henri Verbeet 04 Aug '18
04 Aug '18
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d8/tests/visual.c | 160 ++++++++++++++++++++++++++++++++---------------
1 file changed, 108 insertions(+), 52 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index bed70d8a17c..3379f072cc4 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -4952,26 +4952,74 @@ done:
DestroyWindow(window);
}
-static void volume_dxt5_test(void)
+static void volume_dxtn_test(void)
{
IDirect3DVolumeTexture8 *texture;
+ struct surface_readback rb;
IDirect3DDevice8 *device;
+ IDirect3DSurface8 *rt;
D3DLOCKED_BOX box;
+ unsigned int i, j;
IDirect3D8 *d3d;
- unsigned int i;
- D3DCOLOR color;
ULONG refcount;
+ DWORD colour;
HWND window;
HRESULT hr;
- static const char texture_data[] =
+ static const BYTE dxt1_data[] =
{
- /* A 8x4x2 texture consisting of 4 4x4 blocks. The colors of the blocks are red, green, blue and white. */
- 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xf8, 0x00, 0xf8, 0xf0, 0xf0, 0xf0, 0xf0,
+ 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
+ };
+ static const BYTE dxt3_data[] =
+ {
+ 0xff, 0xee, 0xff, 0xee, 0xff, 0xee, 0xff, 0xee, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xdd, 0xff, 0xdd, 0xff, 0xdd, 0xff, 0xdd, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xcc, 0xff, 0xcc, 0xff, 0xcc, 0xff, 0xcc, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xbb, 0xff, 0xbb, 0xff, 0xbb, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
+ };
+ static const BYTE dxt5_data[] =
+ {
+ /* A 8x4x2 texture consisting of 4 4x4 blocks. The colours of the
+ * blocks are red, green, blue and white. */
+ 0xff, 0xff, 0x80, 0x0d, 0xd8, 0x80, 0x0d, 0xd8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
};
+ static const DWORD dxt1_expected_colours[] =
+ {
+ 0xffff0000, 0x00000000, 0xff00ff00, 0xff00ff00,
+ 0xff0000ff, 0xff0000ff, 0xffffffff, 0xffffffff,
+ };
+ static const DWORD dxt3_expected_colours[] =
+ {
+ 0xffff0000, 0xeeff0000, 0xff00ff00, 0xdd00ff00,
+ 0xff0000ff, 0xcc0000ff, 0xffffffff, 0xbbffffff,
+ };
+ static const DWORD dxt5_expected_colours[] =
+ {
+ 0xffff0000, 0x00ff0000, 0xff00ff00, 0xff00ff00,
+ 0xff0000ff, 0xff0000ff, 0xffffffff, 0xffffffff
+ };
+
+ static const struct
+ {
+ const char *name;
+ D3DFORMAT format;
+ const BYTE *data;
+ DWORD data_size;
+ const DWORD *expected_colours;
+ }
+ tests[] =
+ {
+ {"DXT1", D3DFMT_DXT1, dxt1_data, sizeof(dxt1_data), dxt1_expected_colours},
+ {"DXT3", D3DFMT_DXT3, dxt3_data, sizeof(dxt3_data), dxt3_expected_colours},
+ {"DXT5", D3DFMT_DXT5, dxt5_data, sizeof(dxt5_data), dxt5_expected_colours},
+ };
+
static const struct
{
struct vec3 position;
@@ -4989,69 +5037,77 @@ static void volume_dxt5_test(void)
{{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}},
{{ 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.75f}},
};
- static const DWORD expected_colors[] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff};
window = create_window();
d3d = Direct3DCreate8(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
+
if (!(device = create_device(d3d, window, window, TRUE)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
}
- if (FAILED(IDirect3D8_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_DXT5)))
+ hr = IDirect3DDevice8_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
- skip("Volume DXT5 textures are not supported, skipping test.\n");
- IDirect3DDevice8_Release(device);
- goto done;
- }
+ if (FAILED(IDirect3D8_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, tests[i].format)))
+ {
+ skip("%s volume textures are not supported, skipping test.\n", tests[i].name);
+ continue;
+ }
+ hr = IDirect3DDevice8_CreateVolumeTexture(device, 8, 4, 2, 1, 0,
+ tests[i].format, D3DPOOL_MANAGED, &texture);
+ ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
- hr = IDirect3DDevice8_CreateVolumeTexture(device, 8, 4, 2, 1, 0, D3DFMT_DXT5,
- D3DPOOL_MANAGED, &texture);
- ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
+ hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &box, NULL, 0);
+ ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr);
+ memcpy(box.pBits, tests[i].data, tests[i].data_size);
+ hr = IDirect3DVolumeTexture8_UnlockBox(texture, 0);
+ ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
- hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &box, NULL, 0);
- ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr);
- memcpy(box.pBits, texture_data, sizeof(texture_data));
- hr = IDirect3DVolumeTexture8_UnlockBox(texture, 0);
- ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
+ ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)texture);
+ ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ ok(SUCCEEDED(hr), "Failed to set colour op, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ ok(SUCCEEDED(hr), "Failed to set colour arg, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
+ ok(SUCCEEDED(hr), "Failed to set colour op, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT);
+ ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr);
- hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
- ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
- hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)texture);
- ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
- hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
- hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr);
- hr = IDirect3DDevice8_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
- hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT);
- ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
- hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0);
- ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
- hr = IDirect3DDevice8_BeginScene(device);
- ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
- hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads));
- ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
- hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads));
- ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
- hr = IDirect3DDevice8_EndScene(device);
- ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+ get_rt_readback(rt, &rb);
+ for (j = 0; j < ARRAY_SIZE(dxt1_expected_colours); ++j)
+ {
+ colour = get_readback_color(&rb, 40 + 80 * j, 240);
+ ok(color_match(colour, tests[i].expected_colours[j], 1),
+ "Expected colour 0x%08x, got 0x%08x, case %u.\n", tests[i].expected_colours[j], colour, j);
+ }
+ release_surface_readback(&rb);
- for (i = 0; i < 4; i++)
- {
- color = getPixelColor(device, 80 + 160 * i, 240);
- ok (color_match(color, expected_colors[i], 1),
- "Expected color 0x%08x, got 0x%08x, case %u.\n", expected_colors[i], color, i);
+ hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
+ ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
+ IDirect3DVolumeTexture8_Release(texture);
}
- hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
- ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
- IDirect3DVolumeTexture8_Release(texture);
+ IDirect3DSurface8_Release(rt);
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
@@ -10326,7 +10382,7 @@ START_TEST(visual)
zenable_test();
resz_test();
fog_special_test();
- volume_dxt5_test();
+ volume_dxtn_test();
volume_v16u16_test();
add_dirty_rect_test();
test_3dc_formats();
--
2.11.0
1
0
[PATCH 05/12] d3d9/tests: Test DXT1 and DXT3 as well in volume_dxt5_test().
by Henri Verbeet 04 Aug '18
by Henri Verbeet 04 Aug '18
04 Aug '18
From: Connor McAdams <conmanx360(a)gmail.com>
Signed-off-by: Connor McAdams <conmanx360(a)gmail.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d9/tests/visual.c | 162 ++++++++++++++++++++++++++++++++---------------
1 file changed, 110 insertions(+), 52 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index b36c1890392..5567e72cef8 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -17741,26 +17741,74 @@ done:
DestroyWindow(window);
}
-static void volume_dxt5_test(void)
+static void volume_dxtn_test(void)
{
IDirect3DVolumeTexture9 *texture;
+ struct surface_readback rb;
IDirect3DDevice9 *device;
+ IDirect3DSurface9 *rt;
D3DLOCKED_BOX box;
+ unsigned int i, j;
IDirect3D9 *d3d;
- unsigned int i;
ULONG refcount;
- DWORD color;
+ DWORD colour;
HWND window;
HRESULT hr;
- static const char texture_data[] =
+ static const BYTE dxt1_data[] =
+ {
+ 0x00, 0xf8, 0x00, 0xf8, 0xf0, 0xf0, 0xf0, 0xf0,
+ 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
+ };
+ static const BYTE dxt3_data[] =
+ {
+ 0xff, 0xee, 0xff, 0xee, 0xff, 0xee, 0xff, 0xee, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xdd, 0xff, 0xdd, 0xff, 0xdd, 0xff, 0xdd, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xcc, 0xff, 0xcc, 0xff, 0xcc, 0xff, 0xcc, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xbb, 0xff, 0xbb, 0xff, 0xbb, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
+ };
+ static const BYTE dxt5_data[] =
{
- /* A 8x4x2 texture consisting of 4 4x4 blocks. The colors of the blocks are red, green, blue and white. */
- 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
+ /* A 8x4x2 texture consisting of 4 4x4 blocks. The colours of the
+ * blocks are red, green, blue and white. */
+ 0xff, 0xff, 0x80, 0x0d, 0xd8, 0x80, 0x0d, 0xd8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
};
+ static const DWORD dxt1_expected_colours[] =
+ {
+ 0xffff0000, 0x00000000, 0xff00ff00, 0xff00ff00,
+ 0xff0000ff, 0xff0000ff, 0xffffffff, 0xffffffff,
+ };
+ static const DWORD dxt3_expected_colours[] =
+ {
+ 0xffff0000, 0xeeff0000, 0xff00ff00, 0xdd00ff00,
+ 0xff0000ff, 0xcc0000ff, 0xffffffff, 0xbbffffff,
+ };
+ static const DWORD dxt5_expected_colours[] =
+ {
+ 0xffff0000, 0x00ff0000, 0xff00ff00, 0xff00ff00,
+ 0xff0000ff, 0xff0000ff, 0xffffffff, 0xffffffff
+ };
+
+ static const struct
+ {
+ const char *name;
+ D3DFORMAT format;
+ const BYTE *data;
+ DWORD data_size;
+ const DWORD *expected_colours;
+ }
+ tests[] =
+ {
+ {"DXT1", D3DFMT_DXT1, dxt1_data, sizeof(dxt1_data), dxt1_expected_colours},
+ {"DXT3", D3DFMT_DXT3, dxt3_data, sizeof(dxt3_data), dxt3_expected_colours},
+ {"DXT5", D3DFMT_DXT5, dxt5_data, sizeof(dxt5_data), dxt5_expected_colours},
+ };
+
static const struct
{
struct vec3 position;
@@ -17778,67 +17826,77 @@ static void volume_dxt5_test(void)
{{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}},
{{ 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.75f}},
};
- static const DWORD expected_colors[] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff};
window = create_window();
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
- if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_DXT5)))
- {
- skip("DXT5 volume textures are not supported, skipping test.\n");
- goto done;
- }
+
if (!(device = create_device(d3d, window, window, TRUE)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
}
- hr = IDirect3DDevice9_CreateVolumeTexture(device, 8, 4, 2, 1, 0, D3DFMT_DXT5,
- D3DPOOL_MANAGED, &texture, NULL);
- ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_GetRenderTarget(device, 0, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
- hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &box, NULL, 0);
- ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr);
- memcpy(box.pBits, texture_data, sizeof(texture_data));
- hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0);
- ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, tests[i].format)))
+ {
+ skip("%s volume textures are not supported, skipping test.\n", tests[i].name);
+ continue;
+ }
+ hr = IDirect3DDevice9_CreateVolumeTexture(device, 8, 4, 2, 1, 0,
+ tests[i].format, D3DPOOL_MANAGED, &texture, NULL);
+ ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
- ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);
- ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
- ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr);
+ hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &box, NULL, 0);
+ ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr);
+ memcpy(box.pBits, tests[i].data, tests[i].data_size);
+ hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0);
+ ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
- hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0);
- ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
- hr = IDirect3DDevice9_BeginScene(device);
- ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
- hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads));
- ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
- hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads));
- ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
- hr = IDirect3DDevice9_EndScene(device);
- ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
+ ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);
+ ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ ok(SUCCEEDED(hr), "Failed to set colour op, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ ok(SUCCEEDED(hr), "Failed to set colour arg, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
+ ok(SUCCEEDED(hr), "Failed to set colour op, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+ ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr);
- for (i = 0; i < 4; i++)
- {
- color = getPixelColor(device, 80 + 160 * i, 240);
- ok (color_match(color, expected_colors[i], 1),
- "Expected color 0x%08x, got 0x%08x, case %u.\n", expected_colors[i], color, i);
+ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ get_rt_readback(rt, &rb);
+ for (j = 0; j < ARRAY_SIZE(dxt1_expected_colours); ++j)
+ {
+ colour = get_readback_color(&rb, 40 + 80 * j, 240);
+ ok(color_match(colour, tests[i].expected_colours[j], 1),
+ "Expected colour 0x%08x, got 0x%08x, case %u.\n", tests[i].expected_colours[j], colour, j);
+ }
+ release_surface_readback(&rb);
+
+ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
+ ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
+ IDirect3DVolumeTexture9_Release(texture);
}
- hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
- ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
- IDirect3DVolumeTexture9_Release(texture);
+ IDirect3DSurface9_Release(rt);
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
@@ -24131,7 +24189,7 @@ START_TEST(visual)
zenable_test();
fog_special_test();
volume_srgb_test();
- volume_dxt5_test();
+ volume_dxtn_test();
add_dirty_rect_test();
multisampled_depth_buffer_test();
resz_test();
--
2.11.0
1
0
04 Aug '18
From: Connor McAdams <conmanx360(a)gmail.com>
Signed-off-by: Connor McAdams <conmanx360(a)gmail.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/resource.c | 9 ++
dlls/wined3d/texture.c | 40 ++++--
dlls/wined3d/utils.c | 286 +++++++++++++++++++++++++++++++++++++----
dlls/wined3d/wined3d_private.h | 6 +
4 files changed, 304 insertions(+), 37 deletions(-)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index b5dcdf012db..bf54245276a 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -477,3 +477,12 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource)
resource->draw_binding = WINED3D_LOCATION_TEXTURE_RGB;
}
}
+
+const struct wined3d_format *wined3d_resource_get_decompress_format(struct wined3d_resource *resource,
+ const struct wined3d_context *context)
+{
+ if (resource->format_flags & (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE)
+ && !(context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
+ return wined3d_get_format(context->gl_info, WINED3DFMT_B8G8R8A8_UNORM_SRGB, resource->usage);
+ return wined3d_get_format(context->gl_info, WINED3DFMT_B8G8R8A8_UNORM, resource->usage);
+}
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index c316906a957..ebdacfa2ee0 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1727,7 +1727,13 @@ void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct win
if (texture->flags & alloc_flag)
return;
- if (format->conv_byte_count)
+ if (texture->resource.format_flags & WINED3DFMT_FLAG_DECOMPRESS)
+ {
+ TRACE("WINED3DFMT_FLAG_DECOMPRESS set.\n");
+ texture->flags |= WINED3D_TEXTURE_CONVERTED;
+ format = wined3d_resource_get_decompress_format(&texture->resource, context);
+ }
+ else if (format->conv_byte_count)
{
texture->flags |= WINED3D_TEXTURE_CONVERTED;
}
@@ -1897,6 +1903,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
void *converted_mem = NULL;
struct wined3d_format f;
unsigned int level;
+ BOOL decompress;
GLenum target;
TRACE("texture %p, sub_resource_idx %u, context %p, format %s, src_box %s, data {%#x:%p}, "
@@ -1948,20 +1955,31 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
bo.addr += src_box->left * format->byte_count;
}
- if (format->upload)
+ decompress = texture->resource.format_flags & WINED3DFMT_FLAG_DECOMPRESS;
+ if (format->upload || decompress)
{
+ const struct wined3d_format *compressed_format = format;
unsigned int dst_row_pitch, dst_slice_pitch;
void *src_mem;
- if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
- ERR("Converting a block-based format.\n");
+ if (decompress)
+ {
+ format = wined3d_resource_get_decompress_format(&texture->resource, context);
+ }
+ else
+ {
+ if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ ERR("Converting a block-based format.\n");
- f = *format;
- f.byte_count = format->conv_byte_count;
- format = &f;
+ f = *format;
+ f.byte_count = format->conv_byte_count;
+ format = &f;
+ }
wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
+ /* Note that uploading 3D textures may require quite some address
+ * space; it may make sense to upload them per-slice instead. */
if (!(converted_mem = heap_calloc(update_d, dst_slice_pitch)))
{
ERR("Failed to allocate upload buffer.\n");
@@ -1970,8 +1988,12 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
src_mem = context_map_bo_address(context, &bo, src_slice_pitch,
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
- format->upload(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
- dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
+ if (decompress)
+ compressed_format->decompress(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
+ dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
+ else
+ format->upload(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
+ dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
context_unmap_bo_address(context, &bo, GL_PIXEL_UNPACK_BUFFER);
bo.buffer_object = 0;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 937c1bc0df6..bac52022510 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -339,6 +339,230 @@ static const struct wined3d_format_base_flags format_base_flags[] =
{WINED3DFMT_RESZ, WINED3DFMT_FLAG_EXTENSION},
};
+static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
+{
+ BYTE c;
+
+ /* (2⁸ - 1) / (2⁵ - 1) ≈ 2⁸ / (2⁵ + 2¹⁰)
+ * (2⁸ - 1) / (2⁶ - 1) ≈ 2⁸ / (2⁶ + 2¹²) */
+ c = rgb565 >> 11;
+ *r = (c << 3) + (c >> 2);
+ c = (rgb565 >> 5) & 0x3f;
+ *g = (c << 2) + (c >> 4);
+ c = rgb565 & 0x1f;
+ *b = (c << 3) + (c >> 2);
+}
+
+static void build_dxtn_colour_table(WORD colour0, WORD colour1,
+ DWORD colour_table[4], enum wined3d_format_id format_id)
+{
+ unsigned int i;
+ struct
+ {
+ BYTE r, g, b;
+ } c[4];
+
+ rgb888_from_rgb565(colour0, &c[0].r, &c[0].g, &c[0].b);
+ rgb888_from_rgb565(colour1, &c[1].r, &c[1].g, &c[1].b);
+
+ if (format_id == WINED3DFMT_BC1_UNORM && colour0 <= colour1)
+ {
+ c[2].r = (c[0].r + c[1].r) / 2;
+ c[2].g = (c[0].g + c[1].g) / 2;
+ c[2].b = (c[0].b + c[1].b) / 2;
+
+ c[3].r = 0;
+ c[3].g = 0;
+ c[3].b = 0;
+ }
+ else
+ {
+ for (i = 0; i < 2; ++i)
+ {
+ c[i + 2].r = (2 * c[i].r + c[1 - i].r) / 3;
+ c[i + 2].g = (2 * c[i].g + c[1 - i].g) / 3;
+ c[i + 2].b = (2 * c[i].b + c[1 - i].b) / 3;
+ }
+ }
+
+ for (i = 0; i < 4; ++i)
+ {
+ colour_table[i] = (c[i].r << 16) | (c[i].g << 8) | c[i].b;
+ }
+}
+
+static void build_dxtn_alpha_table(BYTE alpha0, BYTE alpha1, BYTE alpha_table[8])
+{
+ unsigned int i;
+
+ alpha_table[0] = alpha0;
+ alpha_table[1] = alpha1;
+
+ if (alpha0 > alpha1)
+ {
+ for (i = 0; i < 6; ++i)
+ {
+ alpha_table[2 + i] = ((6 - i) * alpha0 + (i + 1) * alpha1) / 7;
+ }
+ return;
+ }
+ else
+ {
+ for (i = 0; i < 4; ++i)
+ {
+ alpha_table[2 + i] = ((4 - i) * alpha0 + (i + 1) * alpha1) / 5;
+ }
+ alpha_table[6] = 0x00;
+ alpha_table[7] = 0xff;
+ }
+}
+
+static void decompress_dxtn_block(const BYTE *src, BYTE *dst, unsigned int width,
+ unsigned int height, unsigned int dst_row_pitch, enum wined3d_format_id format_id)
+{
+ const UINT64 *s = (const UINT64 *)src;
+ BOOL bc1_alpha = FALSE;
+ DWORD colour_table[4];
+ BYTE alpha_table[8];
+ UINT64 alpha_bits;
+ DWORD colour_bits;
+ unsigned int x, y;
+ BYTE colour_idx;
+ DWORD *dst_row;
+ BYTE alpha;
+
+ if (format_id == WINED3DFMT_BC1_UNORM)
+ {
+ WORD colour0, colour1;
+
+ alpha_bits = 0;
+
+ colour0 = s[0] & 0xffff;
+ colour1 = (s[0] >> 16) & 0xffff;
+ colour_bits = (s[0] >> 32) & 0xffffffff;
+ build_dxtn_colour_table(colour0, colour1, colour_table, format_id);
+ if (colour0 <= colour1)
+ bc1_alpha = TRUE;
+ }
+ else
+ {
+ alpha_bits = s[0];
+ if (format_id == WINED3DFMT_BC3_UNORM)
+ {
+ build_dxtn_alpha_table(alpha_bits & 0xff, (alpha_bits >> 8) & 0xff, alpha_table);
+ alpha_bits >>= 16;
+ }
+
+ colour_bits = (s[1] >> 32) & 0xffffffff;
+ build_dxtn_colour_table(s[1] & 0xffff, (s[1] >> 16) & 0xffff, colour_table, format_id);
+ }
+
+ for (y = 0; y < height; ++y)
+ {
+ dst_row = (DWORD *)&dst[y * dst_row_pitch];
+ for (x = 0; x < width; ++x)
+ {
+ colour_idx = (colour_bits >> (y * 8 + x * 2)) & 0x3;
+ switch (format_id)
+ {
+ case WINED3DFMT_BC1_UNORM:
+ alpha = bc1_alpha && colour_idx == 3 ? 0x00 : 0xff;
+ break;
+
+ case WINED3DFMT_BC2_UNORM:
+ alpha = (alpha_bits >> (y * 16 + x * 4)) & 0xf;
+ /* (2⁸ - 1) / (2⁴ - 1) ≈ 2⁸ / (2⁴ + 2⁸) */
+ alpha |= alpha << 4;
+ break;
+
+ case WINED3DFMT_BC3_UNORM:
+ alpha = alpha_table[(alpha_bits >> (y * 12 + x * 3)) & 0x7];
+ break;
+
+ default:
+ alpha = 0xff;
+ break;
+ }
+ dst_row[x] = (alpha << 24) | colour_table[colour_idx];
+ }
+ }
+}
+
+static void decompress_dxtn(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
+ unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
+ unsigned int width, unsigned int height, unsigned int depth, enum wined3d_format_id format_id)
+{
+ unsigned int block_byte_count, block_w, block_h;
+ const BYTE *src_row, *src_slice = src;
+ BYTE *dst_row, *dst_slice = dst;
+ unsigned int x, y, z;
+
+ block_byte_count = format_id == WINED3DFMT_BC1_UNORM ? 8 : 16;
+
+ for (z = 0; z < depth; ++z)
+ {
+ src_row = src_slice;
+ dst_row = dst_slice;
+ for (y = 0; y < height; y += 4)
+ {
+ for (x = 0; x < width; x += 4)
+ {
+ block_w = min(width - x, 4);
+ block_h = min(height - y, 4);
+ decompress_dxtn_block(&src_row[x * (block_byte_count / 4)],
+ &dst_row[x * 4], block_w, block_h, dst_row_pitch, format_id);
+ }
+ src_row += src_row_pitch;
+ dst_row += dst_row_pitch * 4;
+ }
+ src_slice += src_slice_pitch;
+ dst_slice += dst_slice_pitch;
+ }
+}
+
+static void decompress_bc3(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
+ unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
+ unsigned int width, unsigned int height, unsigned int depth)
+{
+ decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
+ dst_slice_pitch, width, height, depth, WINED3DFMT_BC3_UNORM);
+}
+
+static void decompress_bc2(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
+ unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
+ unsigned int width, unsigned int height, unsigned int depth)
+{
+ decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
+ dst_slice_pitch, width, height, depth, WINED3DFMT_BC2_UNORM);
+}
+
+static void decompress_bc1(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
+ unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
+ unsigned int width, unsigned int height, unsigned int depth)
+{
+ decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
+ dst_slice_pitch, width, height, depth, WINED3DFMT_BC1_UNORM);
+}
+
+static const struct wined3d_format_decompress_info
+{
+ enum wined3d_format_id id;
+ void (*decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
+ unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
+ unsigned int width, unsigned int height, unsigned int depth);
+}
+format_decompress_info[] =
+{
+ {WINED3DFMT_DXT1, decompress_bc1},
+ {WINED3DFMT_DXT2, decompress_bc2},
+ {WINED3DFMT_DXT3, decompress_bc2},
+ {WINED3DFMT_DXT4, decompress_bc3},
+ {WINED3DFMT_DXT5, decompress_bc3},
+ {WINED3DFMT_BC1_UNORM, decompress_bc1},
+ {WINED3DFMT_BC2_UNORM, decompress_bc2},
+ {WINED3DFMT_BC3_UNORM, decompress_bc3},
+};
+
struct wined3d_format_block_info
{
enum wined3d_format_id id;
@@ -437,6 +661,9 @@ struct wined3d_format_texture_info
void (*download)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
unsigned int width, unsigned int height, unsigned int depth);
+ void (*decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
+ unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
+ unsigned int width, unsigned int height, unsigned int depth);
};
static void convert_l4a4_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
@@ -1897,6 +2124,34 @@ static BOOL init_format_block_info(struct wined3d_gl_info *gl_info)
return TRUE;
}
+/* Most compressed formats are not supported for 3D textures by OpenGL.
+ *
+ * In the case of the S3TC/DXTn formats, NV_texture_compression_vtc provides
+ * these formats for 3D textures, but unfortunately the block layout is
+ * different from the one used by Direct3D.
+ *
+ * Since applications either don't check format availability at all before
+ * using these, or refuse to run without them, we decompress them on upload.
+ *
+ * Affected applications include "Heroes VI", "From Dust", "Halo Online" and
+ * "Eldorado". */
+static BOOL init_format_decompress_info(struct wined3d_gl_info *gl_info)
+{
+ struct wined3d_format *format;
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(format_decompress_info); ++i)
+ {
+ if (!(format = get_format_internal(gl_info, format_decompress_info[i].id)))
+ return FALSE;
+
+ format->flags[WINED3D_GL_RES_TYPE_TEX_3D] |= WINED3DFMT_FLAG_DECOMPRESS;
+ format->decompress = format_decompress_info[i].decompress;
+ }
+
+ return TRUE;
+}
+
static GLenum wined3d_gl_type_to_enum(enum wined3d_gl_resource_type type)
{
switch (type)
@@ -3390,34 +3645,8 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
}
}
- /* GL_EXT_texture_compression_s3tc does not support 3D textures. Some Windows drivers
- * for dx9 GPUs support it, some do not, so not supporting DXTn volumes is OK for d3d9.
- *
- * Note that GL_NV_texture_compression_vtc adds this functionality to OpenGL, but the
- * block layout is not compatible with the one used by d3d. See volume_dxt5_test. */
- idx = get_format_idx(WINED3DFMT_DXT1);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_DXT2);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_DXT3);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_DXT4);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_DXT5);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_BC1_UNORM);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_BC1_UNORM_SRGB);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_BC2_UNORM);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_BC2_UNORM_SRGB);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_BC3_UNORM);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- idx = get_format_idx(WINED3DFMT_BC3_UNORM_SRGB);
- gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- /* Similarly with ATI1N / ATI2N and GL_ARB_texture_compression_rgtc. */
+ /* These formats are not supported for 3D textures. See also
+ * WINED3DFMT_FLAG_DECOMPRESS. */
idx = get_format_idx(WINED3DFMT_ATI1N);
gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
idx = get_format_idx(WINED3DFMT_ATI2N);
@@ -3742,6 +3971,7 @@ BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, struct wi
if (!init_format_base_info(gl_info)) return FALSE;
if (!init_format_block_info(gl_info)) goto fail;
+ if (!init_format_decompress_info(gl_info)) goto fail;
if (!ctx) /* WINED3D_NO3D */
return TRUE;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ece41ebd06c..25f7cb2416e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3081,6 +3081,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
+const struct wined3d_format *wined3d_resource_get_decompress_format(struct wined3d_resource *resource,
+ const struct wined3d_context *context) DECLSPEC_HIDDEN;
GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
@@ -4231,6 +4233,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_EXTENSION 0x00000020
#define WINED3DFMT_FLAG_FBO_ATTACHABLE 0x00000040
#define WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB 0x00000080
+#define WINED3DFMT_FLAG_DECOMPRESS 0x00000100
#define WINED3DFMT_FLAG_FLOAT 0x00000200
#define WINED3DFMT_FLAG_BUMPMAP 0x00000400
#define WINED3DFMT_FLAG_SRGB_READ 0x00000800
@@ -4304,6 +4307,9 @@ struct wined3d_format
void (*download)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
unsigned int dst_row_pitch, unsigned dst_slice_pitch,
unsigned int width, unsigned int height, unsigned int depth);
+ void (*decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
+ unsigned int dst_row_pitch, unsigned dst_slice_pitch,
+ unsigned int width, unsigned int height, unsigned int depth);
enum wined3d_format_id typeless_id;
GLenum gl_view_class;
--
2.11.0
1
0
[PATCH 02/12] d3d11: Handle D3D_DRIVER_TYPE_WARP in D3D11CreateDevice().
by Henri Verbeet 04 Aug '18
by Henri Verbeet 04 Aug '18
04 Aug '18
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d11/d3d11_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/d3d11/d3d11_main.c b/dlls/d3d11/d3d11_main.c
index 154a376b784..5d085edf2fe 100644
--- a/dlls/d3d11/d3d11_main.c
+++ b/dlls/d3d11/d3d11_main.c
@@ -202,6 +202,8 @@ HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_t
switch(driver_type)
{
+ case D3D_DRIVER_TYPE_WARP:
+ FIXME("WARP driver not implemented, falling back to hardware.\n");
case D3D_DRIVER_TYPE_HARDWARE:
{
hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter);
--
2.11.0
1
0
[PATCH 01/12] d3d10: Handle D3D10_DRIVER_TYPE_WARP in D3D10CreateDevice().
by Henri Verbeet 04 Aug '18
by Henri Verbeet 04 Aug '18
04 Aug '18
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d10/d3d10_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c
index 7c8bee7534d..4d3ed1244ed 100644
--- a/dlls/d3d10/d3d10_main.c
+++ b/dlls/d3d10/d3d10_main.c
@@ -63,6 +63,8 @@ HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver
switch (driver_type)
{
+ case D3D10_DRIVER_TYPE_WARP:
+ FIXME("WARP driver not implemented, falling back to hardware.\n");
case D3D10_DRIVER_TYPE_HARDWARE:
{
hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter);
--
2.11.0
1
0