Index: dxglcfg/tests.cpp |
— | — | @@ -395,7 +395,7 @@ |
396 | 396 | wc.hInstance = hinstance;
|
397 | 397 | wc.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(IDI_DXGL));
|
398 | 398 | wc.hIconSm = LoadIcon(hinstance,MAKEINTRESOURCE(IDI_DXGLSM));
|
399 | | - if(testnum == 6) wc.hCursor = LoadCursor(NULL,IDC_CROSS);
|
| 399 | + if((testnum == 6) || (testnum == 16)) wc.hCursor = LoadCursor(NULL,IDC_CROSS);
|
400 | 400 | else wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
401 | 401 | wc.hbrBackground = NULL;
|
402 | 402 | wc.lpszClassName = wndclassname;
|
— | — | @@ -808,6 +808,7 @@ |
809 | 809 | HBRUSH brush;
|
810 | 810 | RECT r;
|
811 | 811 | DDCOLORKEY colorkey;
|
| 812 | + DDBLTFX bltfx;
|
812 | 813 | void *bmppointer;
|
813 | 814 | int i;
|
814 | 815 | const DWORD colormasks[7] = { 0xFF0000, 0xFF00, 0xFFFF00, 0xFF, 0xFF00FF, 0xFFFF, 0xFFFFFF };
|
— | — | @@ -817,7 +818,7 @@ |
818 | 819 | error = ddsrender->GetSurfaceDesc(&ddsd);
|
819 | 820 | switch (test)
|
820 | 821 | {
|
821 | | - case 0:
|
| 822 | + case 0: // Palette and gradients
|
822 | 823 | if (!fullscreen) backbuffers = 0;
|
823 | 824 | buffer = (unsigned char *)malloc(ddsd.lPitch*ddsd.dwHeight);
|
824 | 825 | DrawPalette(ddsd, buffer);
|
— | — | @@ -871,7 +872,7 @@ |
872 | 873 | free(buffer);
|
873 | 874 | if (palette) palette->Release();
|
874 | 875 | break;
|
875 | | - case 2:
|
| 876 | + case 2: // GDI patterns
|
876 | 877 | if (!fullscreen) backbuffers = 0;
|
877 | 878 | error = ddsrender->GetDC(&hRenderDC);
|
878 | 879 | DrawGDIPatterns(ddsd, hRenderDC, 0);
|
— | — | @@ -946,7 +947,7 @@ |
947 | 948 | }
|
948 | 949 | if (temp1) temp1->Release();
|
949 | 950 | break;
|
950 | | - case 4:
|
| 951 | + case 4: // BltFast sprites
|
951 | 952 | ddsrender->GetSurfaceDesc(&ddsd);
|
952 | 953 | ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
953 | 954 | ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
— | — | @@ -1010,7 +1011,7 @@ |
1011 | 1012 | sprites[i].yvelocity = randfloat(5);
|
1012 | 1013 | }
|
1013 | 1014 | break;
|
1014 | | - case 6:
|
| 1015 | + case 6: // Mouse pointer test
|
1015 | 1016 | ddsrender->GetSurfaceDesc(&ddsd);
|
1016 | 1017 | ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
1017 | 1018 | ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
— | — | @@ -1072,7 +1073,7 @@ |
1073 | 1074 | DeleteDC(memorydc);
|
1074 | 1075 | DeleteObject(bitmap);
|
1075 | 1076 | break;
|
1076 | | - case 7:
|
| 1077 | + case 7: // ROP patterns
|
1077 | 1078 | if (!fullscreen) backbuffers = 0;
|
1078 | 1079 | ddsrender->GetSurfaceDesc(&ddsd);
|
1079 | 1080 | ddsrender->GetPalette(&palette);
|
— | — | @@ -1115,7 +1116,7 @@ |
1116 | 1117 | DrawROPPatterns(ddsrender, sprites, backbuffers, ddver, bpp, ddcaps.dwRops,hWnd,palette);
|
1117 | 1118 | if (palette) palette->Release();
|
1118 | 1119 | break;
|
1119 | | - case 8:
|
| 1120 | + case 8: // Rotated Blt patterns
|
1120 | 1121 | ddsrender->GetSurfaceDesc(&ddsd);
|
1121 | 1122 | sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
1122 | 1123 | sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
— | — | @@ -1137,8 +1138,8 @@ |
1138 | 1139 | ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
|
1139 | 1140 | counter = 0;
|
1140 | 1141 | break;
|
1141 | | - case 10:
|
1142 | | - case 11:
|
| 1142 | + case 10: // Source Key Override test
|
| 1143 | + case 11: // Destination Key Override Test
|
1143 | 1144 | ddsrender->GetSurfaceDesc(&ddsd);
|
1144 | 1145 | sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
1145 | 1146 | sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
— | — | @@ -1179,7 +1180,7 @@ |
1180 | 1181 | sprites[2].surface->Unlock(NULL);
|
1181 | 1182 | counter = 0;
|
1182 | 1183 | break;
|
1183 | | - case 12:
|
| 1184 | + case 12: // Solid cube
|
1184 | 1185 | MakeCube3D(5, 2);
|
1185 | 1186 | ZeroMemory(&material, sizeof(D3DMATERIAL7));
|
1186 | 1187 | material.ambient.r = 0.5f;
|
— | — | @@ -1218,7 +1219,7 @@ |
1219 | 1220 | lights[0].dvAttenuation1 = 0.4f;
|
1220 | 1221 | error = d3d7dev->SetLight(0, &lights[0]);
|
1221 | 1222 | break;
|
1222 | | - case 13:
|
| 1223 | + case 13: // Solid cube
|
1223 | 1224 | MakeCube3D(5, 2);
|
1224 | 1225 | cleartexformats();
|
1225 | 1226 | d3d7dev->EnumTextureFormats(gettexformat, NULL);
|
— | — | @@ -1264,10 +1265,10 @@ |
1265 | 1266 | lights[0].dvAttenuation1 = 0.4f;
|
1266 | 1267 | error = d3d7dev->SetLight(0, &lights[0]);
|
1267 | 1268 | break;
|
1268 | | - case 15:
|
| 1269 | + case 15: // Vertex pipeline test
|
1269 | 1270 | ZeroMemory(lights, 8 * sizeof(D3DLIGHT7));
|
1270 | 1271 | MakeLights();
|
1271 | | - case 14:
|
| 1272 | + case 14: // Pixel pipeline test
|
1272 | 1273 | MakeCube3D(5, 8);
|
1273 | 1274 | ZeroMemory(&material, sizeof(D3DMATERIAL7));
|
1274 | 1275 | material.ambient.r = 1.0f;
|
— | — | @@ -1299,6 +1300,34 @@ |
1300 | 1301 | error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &matProj);
|
1301 | 1302 | texshaderstate = defaulttexshaderstate;
|
1302 | 1303 | break;
|
| 1304 | + case 16: // SetCursorPos test
|
| 1305 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 1306 | + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 1307 | + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 1308 | + ddsd.dwWidth = GetSystemMetrics(SM_CXCURSOR);
|
| 1309 | + ddsd.dwHeight = GetSystemMetrics(SM_CYCURSOR);
|
| 1310 | + sprites[0].width = (float)ddsd.dwWidth;
|
| 1311 | + sprites[0].height = (float)ddsd.dwHeight;
|
| 1312 | + sprites[0].rect.left = sprites[0].rect.top = 0;
|
| 1313 | + sprites[0].rect.right = ddsd.dwWidth;
|
| 1314 | + sprites[0].rect.bottom = ddsd.dwHeight;
|
| 1315 | + memcpy(&sprites[0].ddsd, &ddsd, sizeof(DDSURFACEDESC2));
|
| 1316 | + colorkey.dwColorSpaceHighValue = colorkey.dwColorSpaceLowValue = 0;
|
| 1317 | + ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
|
| 1318 | + sprites[0].surface->SetColorKey(DDCKEY_SRCBLT, &colorkey);
|
| 1319 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 1320 | + bltfx.dwFillColor = 0;
|
| 1321 | + sprites[0].surface->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &bltfx);
|
| 1322 | + cursor = LoadCursor(NULL, IDC_ARROW);
|
| 1323 | + sprites[0].surface->GetDC(&hRenderDC);
|
| 1324 | + DrawIcon(hRenderDC, 0, 0, cursor);
|
| 1325 | + sprites[0].surface->ReleaseDC(hRenderDC);
|
| 1326 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 1327 | + sprites[0].x = randfloat((float)ddsd.dwWidth);
|
| 1328 | + sprites[0].y = randfloat((float)ddsd.dwHeight);
|
| 1329 | + sprites[0].xvelocity = randfloat(5);
|
| 1330 | + sprites[0].yvelocity = randfloat(5);
|
| 1331 | + break;
|
1303 | 1332 | default:
|
1304 | 1333 | break;
|
1305 | 1334 | }
|
— | — | @@ -1313,7 +1342,7 @@ |
1314 | 1343 | HDC hDCdest, hDCsrc;
|
1315 | 1344 | RECT r1, r2;
|
1316 | 1345 | int x, y;
|
1317 | | - POINT p;
|
| 1346 | + POINT p, p2;
|
1318 | 1347 | RECT srcrect, destrect;
|
1319 | 1348 | HRESULT error;
|
1320 | 1349 | D3DMATRIX mat;
|
— | — | @@ -1744,7 +1773,7 @@ |
1745 | 1774 | if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
|
1746 | 1775 | }
|
1747 | 1776 | break;
|
1748 | | - case 12:
|
| 1777 | + case 12: // Solid cube
|
1749 | 1778 | error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
|
1750 | 1779 | time = (float)clock() / (float)CLOCKS_PER_SEC;
|
1751 | 1780 | mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
— | — | @@ -1774,7 +1803,7 @@ |
1775 | 1804 | if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
|
1776 | 1805 | }
|
1777 | 1806 | break;
|
1778 | | - case 13:
|
| 1807 | + case 13: // Textured cube
|
1779 | 1808 | error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
|
1780 | 1809 | time = (float)clock() / (float)CLOCKS_PER_SEC;
|
1781 | 1810 | mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
— | — | @@ -1811,7 +1840,7 @@ |
1812 | 1841 | if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
|
1813 | 1842 | }
|
1814 | 1843 | break;
|
1815 | | - case 14:
|
| 1844 | + case 14: // Pixel pipeline test
|
1816 | 1845 | error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
|
1817 | 1846 | time = (float)clock() / (float)CLOCKS_PER_SEC;
|
1818 | 1847 | mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
— | — | @@ -1841,7 +1870,7 @@ |
1842 | 1871 | if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
|
1843 | 1872 | }
|
1844 | 1873 | break;
|
1845 | | - case 15:
|
| 1874 | + case 15: // Vertex pipeline test
|
1846 | 1875 | error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
|
1847 | 1876 | time = (float)clock() / (float)CLOCKS_PER_SEC;
|
1848 | 1877 | mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
|
— | — | @@ -1871,6 +1900,122 @@ |
1872 | 1901 | if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
|
1873 | 1902 | }
|
1874 | 1903 | break;
|
| 1904 | + case 16: // SetCursorPos test
|
| 1905 | + if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
| 1906 | + else temp1 = ddsrender;
|
| 1907 | + temp1->GetDC(&hDCdest);
|
| 1908 | + brush = CreateSolidBrush(0);
|
| 1909 | + destrect.left = 0;
|
| 1910 | + destrect.right = width;
|
| 1911 | + destrect.top = 0;
|
| 1912 | + destrect.bottom = height;
|
| 1913 | + FillRect(hDCdest, &destrect, brush);
|
| 1914 | + DeleteObject(brush);
|
| 1915 | + _tcscpy(message, _T("SetCursorPos test - Mouse should follow pointer."));
|
| 1916 | + displayfonts[0] = CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
| 1917 | + ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
| 1918 | + DEFAULT_PITCH, _T("Fixedsys"));
|
| 1919 | + displayfonts[1] = (HFONT)SelectObject(hDCdest, displayfonts[0]);
|
| 1920 | + SetTextColor(hDCdest, RGB(255, 255, 255));
|
| 1921 | + SetBkColor(hDCdest, RGB(0, 0, 255));
|
| 1922 | + TextOut(hDCdest, 0, 0, message, _tcslen(message));
|
| 1923 | + GetTextExtentPoint(hDCdest, _T("A"), 1, &textsize);
|
| 1924 | + sprites[0].x += sprites[0].xvelocity;
|
| 1925 | + if (sprites[0].xvelocity < 0 && sprites[0].x < 0) sprites[0].xvelocity = -sprites[0].xvelocity;
|
| 1926 | + if (sprites[0].xvelocity > 0 && sprites[0].x >= width) sprites[0].xvelocity = -sprites[0].xvelocity;
|
| 1927 | + sprites[0].y += sprites[0].yvelocity;
|
| 1928 | + if (sprites[0].yvelocity < 0 && sprites[0].y < 0) sprites[0].yvelocity = -sprites[0].yvelocity;
|
| 1929 | + if (sprites[0].yvelocity > 0 && sprites[0].y >= height) sprites[0].yvelocity = -sprites[0].yvelocity;
|
| 1930 | + // Show stats
|
| 1931 | + _tcscpy(message, _T("Requested position: X="));
|
| 1932 | + _itot(sprites[0].x, number, 10);
|
| 1933 | + _tcscat(message, number);
|
| 1934 | + _tcscat(message, _T(" Y="));
|
| 1935 | + _itot(sprites[0].y, number, 10);
|
| 1936 | + _tcscat(message, number);
|
| 1937 | + SetBkColor(hDCdest, RGB(0, 0, 127));
|
| 1938 | + TextOut(hDCdest, 0, textsize.cy, message, _tcslen(message));
|
| 1939 | + if (GetActiveWindow() == hWnd)
|
| 1940 | + {
|
| 1941 | + if (fullscreen)
|
| 1942 | + {
|
| 1943 | + SetCursorPos(sprites[0].x, sprites[0].y);
|
| 1944 | + GetCursorPos(&p2);
|
| 1945 | + }
|
| 1946 | + else
|
| 1947 | + {
|
| 1948 | + p.x = 0;
|
| 1949 | + p.y = 0;
|
| 1950 | + ClientToScreen(hWnd, &p);
|
| 1951 | + SetCursorPos((int)sprites[0].x + p.x, (int)sprites[0].y + p.y);
|
| 1952 | + GetCursorPos(&p2);
|
| 1953 | + p2.x -= p.x;
|
| 1954 | + p2.y -= p.y;
|
| 1955 | + }
|
| 1956 | + }
|
| 1957 | + _tcscpy(message, _T("Actual position: X="));
|
| 1958 | + _itot(p2.x, number, 10);
|
| 1959 | + _tcscat(message, number);
|
| 1960 | + _tcscat(message, _T(" Y="));
|
| 1961 | + _itot(p2.y, number, 10);
|
| 1962 | + _tcscat(message, number);
|
| 1963 | + _tcscat(message, _T(" "));
|
| 1964 | + TextOut(hDCdest, 0, 2*textsize.cy, message, _tcslen(message));
|
| 1965 | + x = (_tcslen(message)*textsize.cx);
|
| 1966 | + if ((p2.x == (LONG)sprites[0].x) && (p2.y == (LONG)sprites[0].y))
|
| 1967 | + {
|
| 1968 | + SetTextColor(hDCdest, RGB(0, 255, 0));
|
| 1969 | + _tcscpy(message, _T("Positions match"));
|
| 1970 | + }
|
| 1971 | + else
|
| 1972 | + {
|
| 1973 | + _tcscpy(message, _T("Positions offset by X="));
|
| 1974 | + _itot(p2.x - (LONG)sprites[0].x, number, 10);
|
| 1975 | + _tcscat(message, number);
|
| 1976 | + _tcscat(message, _T(" Y="));
|
| 1977 | + _itot(p2.y - (LONG)sprites[0].y, number, 10);
|
| 1978 | + _tcscat(message, number);
|
| 1979 | + if (((p2.x - (LONG)sprites[0].x <= 2) && (p2.x - (LONG)sprites[0].x >= -2)) &&
|
| 1980 | + ((p2.y - (LONG)sprites[0].y <= 2) && (p2.y - (LONG)sprites[0].y >= -2)))
|
| 1981 | + SetTextColor(hDCdest, RGB(255, 255, 0));
|
| 1982 | + else SetTextColor(hDCdest, RGB(255, 0, 0));
|
| 1983 | + }
|
| 1984 | + TextOut(hDCdest, x, 2 * textsize.cy, message, _tcslen(message));
|
| 1985 | + SelectObject(hDCdest, displayfonts[1]);
|
| 1986 | + DeleteObject(displayfonts[0]);
|
| 1987 | + temp1->ReleaseDC(hDCdest);
|
| 1988 | + if (backbuffers) temp1->Release();
|
| 1989 | + if (sprites[0].surface)
|
| 1990 | + {
|
| 1991 | + if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
| 1992 | + else temp1 = ddsrender;
|
| 1993 | + destrect.left = sprites[0].x;
|
| 1994 | + destrect.top = sprites[0].y;
|
| 1995 | + destrect.right = sprites[0].x + sprites[0].ddsd.dwWidth;
|
| 1996 | + if (destrect.right > width) destrect.right = width;
|
| 1997 | + destrect.bottom = sprites[0].y + sprites[0].ddsd.dwHeight;
|
| 1998 | + if (destrect.bottom > height) destrect.bottom = height;
|
| 1999 | + srcrect.left = srcrect.top = 0;
|
| 2000 | + srcrect.right = destrect.right - destrect.left;
|
| 2001 | + srcrect.bottom = destrect.bottom - destrect.top;
|
| 2002 | + temp1->Blt(&destrect, sprites[0].surface, &srcrect, DDBLT_KEYSRC | DDBLT_WAIT, NULL);
|
| 2003 | + if (backbuffers) temp1->Release();
|
| 2004 | + }
|
| 2005 | + if (fullscreen)
|
| 2006 | + {
|
| 2007 | + if (backbuffers && ddsrender) ddsrender->Flip(NULL, DDFLIP_WAIT);
|
| 2008 | + }
|
| 2009 | + else
|
| 2010 | + {
|
| 2011 | + p.x = 0;
|
| 2012 | + p.y = 0;
|
| 2013 | + ClientToScreen(hWnd, &p);
|
| 2014 | + GetClientRect(hWnd, &r1);
|
| 2015 | + OffsetRect(&r1, p.x, p.y);
|
| 2016 | + SetRect(&r2, 0, 0, width, height);
|
| 2017 | + if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
|
| 2018 | + }
|
| 2019 | + break;
|
1875 | 2020 | }
|
1876 | 2021 | }
|
1877 | 2022 |
|
— | — | @@ -1898,7 +2043,7 @@ |
1899 | 2044 | int op;
|
1900 | 2045 | switch(test)
|
1901 | 2046 | {
|
1902 | | - case 1:
|
| 2047 | + case 1: // Random noise
|
1903 | 2048 | default:
|
1904 | 2049 | if(backbuffers)
|
1905 | 2050 | {
|
— | — | @@ -1927,7 +2072,7 @@ |
1928 | 2073 | if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
|
1929 | 2074 | }
|
1930 | 2075 | break;
|
1931 | | - case 3:
|
| 2076 | + case 3: // Random GDI patterns
|
1932 | 2077 | ddsrender->GetDC(&hdc);
|
1933 | 2078 | op = rand32(randnum) % 4;
|
1934 | 2079 | pen = CreatePen(rand32(randnum) % 5,0,RGB(rand32(randnum)%256,rand32(randnum)%256,rand32(randnum)%256));
|
— | — | @@ -1971,7 +2116,7 @@ |
1972 | 2117 | if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
|
1973 | 2118 | }
|
1974 | 2119 | break;
|
1975 | | - case 5:
|
| 2120 | + case 5: // Random color fill Blt
|
1976 | 2121 | rndrect5:
|
1977 | 2122 | destrect.bottom = rand32(randnum)%ddsd.dwHeight;
|
1978 | 2123 | destrect.top = rand32(randnum)%ddsd.dwHeight;
|
— | — | @@ -2008,7 +2153,7 @@ |
2009 | 2154 | if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
|
2010 | 2155 | }
|
2011 | 2156 | break;
|
2012 | | - case 9:
|
| 2157 | + case 9: // Large batch color fill
|
2013 | 2158 | bltfx.dwSize = sizeof(DDBLTFX);
|
2014 | 2159 | switch (bpp)
|
2015 | 2160 | {
|