Index: dxglcfg/dxgltest.cpp |
— | — | @@ -222,7 +222,8 @@ |
223 | 223 | {7, 7, 0, 2, TRUE, 60.0, TRUE, TRUE, TRUE, _T("DrawPrimitive textured cube (DX7)")},
|
224 | 224 | {7, 7, 0, 0, TRUE, 60.0, TRUE, TRUE, TRUE, _T("Texture Stage shaders (Interactive, DX7)")},
|
225 | 225 | {7, 7, 0, 0, TRUE, 60.0, TRUE, TRUE, TRUE, _T("Vertex shaders (Interactive, DX7)")},
|
226 | | - {1, 7, 0, 1, TRUE, 60.0, FALSE, FALSE, FALSE, _T("SetCursorPos Test")}
|
| 226 | + {1, 7, 0, 1, TRUE, 60.0, FALSE, FALSE, FALSE, _T("SetCursorPos Test")},
|
| 227 | + {1, 7, 0, 1, TRUE, 60.0, FALSE, FALSE, FALSE, _T("Blt Background, Raster operation Blt sprites")}
|
227 | 228 | };
|
228 | 229 | const int END_TESTS = __LINE__ - 4;
|
229 | 230 | const int numtests = END_TESTS - START_TESTS;
|
Index: dxglcfg/surfacegen.cpp |
— | — | @@ -986,6 +986,40 @@ |
987 | 987 | }
|
988 | 988 | }
|
989 | 989 |
|
| 990 | +void DrawROPPatternSurface(MultiDirectDrawSurface *surface, int bpp, int ddver)
|
| 991 | +{
|
| 992 | + DDSURFACEDESC2 ddsd;
|
| 993 | + if (ddver > 3)ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 994 | + else ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 995 | + surface->GetSurfaceDesc(&ddsd);
|
| 996 | + surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
| 997 | + switch (bpp)
|
| 998 | + {
|
| 999 | + case 8:
|
| 1000 | + default:
|
| 1001 | + for (int i = 0; i < 6; i++)
|
| 1002 | + memcpy((unsigned char*)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_8[6 * i], 6);
|
| 1003 | + break;
|
| 1004 | + case 15:
|
| 1005 | + for (int i = 0; i < 6; i++)
|
| 1006 | + memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_15[6 * i], 12);
|
| 1007 | + break;
|
| 1008 | + case 16:
|
| 1009 | + for (int i = 0; i < 6; i++)
|
| 1010 | + memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_16[6 * i], 12);
|
| 1011 | + break;
|
| 1012 | + case 24:
|
| 1013 | + for (int i = 0; i < 6; i++)
|
| 1014 | + memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_24[18 * i], 18);
|
| 1015 | + break;
|
| 1016 | + case 32:
|
| 1017 | + for (int i = 0; i < 6; i++)
|
| 1018 | + memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_32[6 * i], 24);
|
| 1019 | + break;
|
| 1020 | + }
|
| 1021 | + surface->Unlock(NULL);
|
| 1022 | +}
|
| 1023 | +
|
990 | 1024 | void DrawROPPatterns(MultiDirectDrawSurface *primary, DDSPRITE *sprites, int backbuffers, int ddver, int bpp, DWORD *ropcaps,
|
991 | 1025 | HWND hwnd, LPDIRECTDRAWPALETTE palette)
|
992 | 1026 | {
|
— | — | @@ -1041,33 +1075,7 @@ |
1042 | 1076 | break;
|
1043 | 1077 | }
|
1044 | 1078 | sprites[4].surface->Unlock(NULL);
|
1045 | | - sprites[5].surface->GetSurfaceDesc(&ddsd);
|
1046 | | - sprites[5].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
1047 | | - switch (bpp)
|
1048 | | - {
|
1049 | | - case 8:
|
1050 | | - default:
|
1051 | | - for (int i = 0; i < 6; i++)
|
1052 | | - memcpy((unsigned char*)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_8[6 * i], 6);
|
1053 | | - break;
|
1054 | | - case 15:
|
1055 | | - for (int i = 0; i < 6; i++)
|
1056 | | - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_15[6 * i], 12);
|
1057 | | - break;
|
1058 | | - case 16:
|
1059 | | - for (int i = 0; i < 6; i++)
|
1060 | | - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_16[6 * i], 12);
|
1061 | | - break;
|
1062 | | - case 24:
|
1063 | | - for (int i = 0; i < 6; i++)
|
1064 | | - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_24[18 * i], 18);
|
1065 | | - break;
|
1066 | | - case 32:
|
1067 | | - for (int i = 0; i < 6; i++)
|
1068 | | - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_32[6 * i], 24);
|
1069 | | - break;
|
1070 | | - }
|
1071 | | - sprites[5].surface->Unlock(NULL);
|
| 1079 | + DrawROPPatternSurface(sprites[5].surface, bpp, ddver);
|
1072 | 1080 | for (int y = 0; y < 32; y++)
|
1073 | 1081 | {
|
1074 | 1082 | for (int x = 0; x < 32; x++)
|
Index: dxglcfg/surfacegen.h |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | void DrawDitheredColor(DDSURFACEDESC2 *ddsd, unsigned char *buffer, DWORD color, BOOL invert); // Draw a dithered color over the surface
|
25 | 25 | void DrawGradients(DDSURFACEDESC2 ddsd, unsigned char *buffer, HWND hwnd, LPDIRECTDRAWPALETTE palette, int type, DWORD color); // Gradients
|
26 | 26 | void DrawGDIPatterns(DDSURFACEDESC2 ddsd, HDC hDC, int type); // GDI pattern test
|
| 27 | +void DrawROPPatternSurface(MultiDirectDrawSurface *surface, int bpp, int ddver); // ROP pattern test - pattern surface
|
27 | 28 | void DrawROPPatterns(MultiDirectDrawSurface *primary, DDSPRITE *sprites, int backbuffers, int ddver, int bpp, DWORD *ropcaps,
|
28 | 29 | HWND hwnd, LPDIRECTDRAWPALETTE palette); // ROP pattern test
|
29 | 30 | void DrawRotatedBlt(MultiDirectDrawSurface *primary, DDSPRITE *sprites);
|
Index: dxglcfg/tests.cpp |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | static HWND hWnd;
|
48 | 48 | static int testnum;
|
49 | 49 | static unsigned int randnum;
|
50 | | -static int testtypes[] = {0,1,0,1,0,1,0,0,2,1,0,0,0,0,0,0,0};
|
| 50 | +static int testtypes[] = {0,1,0,1,0,1,0,0,2,1,0,0,0,0,0,0,0,0};
|
51 | 51 | static DWORD counter;
|
52 | 52 | static DWORD hotspotx,hotspoty;
|
53 | 53 |
|
— | — | @@ -1097,7 +1097,7 @@ |
1098 | 1098 | sprites[2].width = sprites[2].height = 16.0f;
|
1099 | 1099 | sprites[3].width = sprites[3].height = 16.0f;
|
1100 | 1100 | sprites[4].width = sprites[4].height = 8.0f;
|
1101 | | - sprites[5].width = sprites[4].height = 6.0f;
|
| 1101 | + sprites[5].width = sprites[5].height = 6.0f;
|
1102 | 1102 | sprites[0].ddsd.dwWidth = sprites[0].ddsd.dwHeight =
|
1103 | 1103 | sprites[0].rect.right = sprites[0].rect.bottom = 256;
|
1104 | 1104 | sprites[1].ddsd.dwWidth = sprites[1].ddsd.dwHeight =
|
— | — | @@ -1339,6 +1339,71 @@ |
1340 | 1340 | sprites[0].xvelocity = randfloat(5);
|
1341 | 1341 | sprites[0].yvelocity = randfloat(5);
|
1342 | 1342 | break;
|
| 1343 | + case 17: // ROP sprites
|
| 1344 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 1345 | + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 1346 | + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 1347 | + ddinterface->CreateSurface(&ddsd, &sprites[0].surface, NULL);
|
| 1348 | + ddsrender->GetPalette(&palette);
|
| 1349 | + error = sprites[0].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
| 1350 | + if (palette) palette->Release();
|
| 1351 | + DrawGradients(ddsd, (unsigned char *)ddsd.lpSurface, hWnd, palette, 1, 0);
|
| 1352 | + error = sprites[0].surface->Unlock(NULL);
|
| 1353 | + sprites[0].width = (float)ddsd.dwWidth;
|
| 1354 | + sprites[0].height = (float)ddsd.dwHeight;
|
| 1355 | + sprites[0].rect.left = sprites[0].rect.top = 0;
|
| 1356 | + sprites[0].rect.right = ddsd.dwWidth;
|
| 1357 | + sprites[0].rect.bottom = ddsd.dwHeight;
|
| 1358 | + sprites[0].bltfx.dwSize = 0;
|
| 1359 | + sprites[0].bltflags = DDBLT_WAIT;
|
| 1360 | + memcpy(&sprites[4], &sprites[0], sizeof(DDSPRITE));
|
| 1361 | + sprites[4].ddsd = ddsd;
|
| 1362 | + if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
| 1363 | + else temp1 = ddsrender;
|
| 1364 | + temp1->SetColorKey(DDCKEY_DESTBLT, &ckey);
|
| 1365 | + if (backbuffers) temp1->Release();
|
| 1366 | + sprites[4].surface = NULL;
|
| 1367 | + sprites[4].width = sprites[4].height = 6.0f;
|
| 1368 | + sprites[4].ddsd.dwWidth = sprites[4].ddsd.dwHeight =
|
| 1369 | + sprites[4].rect.right = sprites[4].rect.bottom = 6;
|
| 1370 | + ddinterface->CreateSurface(&sprites[4].ddsd, &sprites[4].surface, NULL);
|
| 1371 | + DrawROPPatternSurface(sprites[4].surface, bpp, ddver);
|
| 1372 | + for (i = 1; i < 4; i++)
|
| 1373 | + {
|
| 1374 | + sprites[i].width = sprites[i].height = 64.f;
|
| 1375 | + sprites[i].ddsd.dwWidth = sprites[i].ddsd.dwHeight =
|
| 1376 | + sprites[i].rect.right = sprites[i].rect.bottom = 64;
|
| 1377 | + sprites[i].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 1378 | + sprites[i].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 1379 | + if (ddver > 3) sprites[i].ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 1380 | + else sprites[i].ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 1381 | + ddinterface->CreateSurface(&sprites[i].ddsd, &sprites[i].surface, NULL);
|
| 1382 | + error = sprites[i].surface->Lock(NULL, &sprites[i].ddsd, DDLOCK_WAIT, NULL);
|
| 1383 | + DrawPalette(sprites[i].ddsd, (unsigned char *)sprites[i].ddsd.lpSurface);
|
| 1384 | + sprites[i].surface->Unlock(NULL);
|
| 1385 | + sprites[i].x = randfloat((float)ddsd.dwWidth);
|
| 1386 | + sprites[i].y = randfloat((float)ddsd.dwHeight);
|
| 1387 | + sprites[i].xvelocity = randfloat(5);
|
| 1388 | + sprites[i].yvelocity = randfloat(5);
|
| 1389 | + sprites[i].bltflags = DDBLT_WAIT | DDBLT_ROP;
|
| 1390 | + sprites[i].bltfx.dwSize = sizeof(DDBLTFX);
|
| 1391 | + switch (i)
|
| 1392 | + {
|
| 1393 | + case 1:
|
| 1394 | + sprites[i].bltfx.dwROP = SRCCOPY;
|
| 1395 | + break;
|
| 1396 | + case 2:
|
| 1397 | + sprites[i].bltfx.dwROP = DSTINVERT;
|
| 1398 | + break;
|
| 1399 | + case 3:
|
| 1400 | + sprites[i].bltfx.dwROP = PATCOPY;
|
| 1401 | + sprites[i].bltfx.lpDDSPattern = (LPDIRECTDRAWSURFACE)sprites[4].surface->GetSurface();
|
| 1402 | + break;
|
| 1403 | + default:
|
| 1404 | + break;
|
| 1405 | + }
|
| 1406 | + }
|
| 1407 | + break;
|
1343 | 1408 | default:
|
1344 | 1409 | break;
|
1345 | 1410 | }
|
— | — | @@ -2063,6 +2128,51 @@ |
2064 | 2129 | if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
|
2065 | 2130 | }
|
2066 | 2131 | break;
|
| 2132 | + case 17: // ROP sprites
|
| 2133 | + if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
| 2134 | + else temp1 = ddsrender;
|
| 2135 | + bltfx.dwFillColor = 0;
|
| 2136 | + temp1->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &bltfx);
|
| 2137 | + if (backbuffers) temp1->Release();
|
| 2138 | + for (int i = 0; i < 4; i++)
|
| 2139 | + {
|
| 2140 | + sprites[i].x += sprites[i].xvelocity;
|
| 2141 | + if (sprites[i].xvelocity < 0 && sprites[i].x < 0) sprites[i].xvelocity = -sprites[i].xvelocity;
|
| 2142 | + if (sprites[i].xvelocity > 0 && (sprites[i].x + sprites[i].width) > width)
|
| 2143 | + sprites[i].xvelocity = -sprites[i].xvelocity;
|
| 2144 | + sprites[i].y += sprites[i].yvelocity;
|
| 2145 | + if (sprites[i].yvelocity < 0 && sprites[i].y < 0) sprites[i].yvelocity = -sprites[i].yvelocity;
|
| 2146 | + if (sprites[i].yvelocity > 0 && (sprites[i].y + sprites[i].height) > height)
|
| 2147 | + sprites[i].yvelocity = -sprites[i].yvelocity;
|
| 2148 | + if (sprites[i].surface)
|
| 2149 | + {
|
| 2150 | + if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
|
| 2151 | + else temp1 = ddsrender;
|
| 2152 | + r1.left = (DWORD)sprites[i].x;
|
| 2153 | + r1.right = (DWORD)sprites[i].x + (DWORD)sprites[i].width;
|
| 2154 | + r1.top = (DWORD)sprites[i].y;
|
| 2155 | + r1.bottom = (DWORD)sprites[i].y + (DWORD)sprites[i].height;
|
| 2156 | + if(sprites[i].bltfx.dwSize == sizeof(DDBLTFX))
|
| 2157 | + temp1->Blt(&r1, sprites[i].surface, &sprites[i].rect, sprites[i].bltflags, &sprites[i].bltfx);
|
| 2158 | + else temp1->Blt(&r1, sprites[i].surface, &sprites[i].rect, sprites[i].bltflags, NULL);
|
| 2159 | + if (backbuffers) temp1->Release();
|
| 2160 | + }
|
| 2161 | + }
|
| 2162 | + if (fullscreen)
|
| 2163 | + {
|
| 2164 | + if (backbuffers && ddsrender) ddsrender->Flip(NULL, DDFLIP_WAIT);
|
| 2165 | + }
|
| 2166 | + else
|
| 2167 | + {
|
| 2168 | + p.x = 0;
|
| 2169 | + p.y = 0;
|
| 2170 | + ClientToScreen(hWnd, &p);
|
| 2171 | + GetClientRect(hWnd, &r1);
|
| 2172 | + OffsetRect(&r1, p.x, p.y);
|
| 2173 | + SetRect(&r2, 0, 0, width, height);
|
| 2174 | + if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
|
| 2175 | + }
|
| 2176 | + break;
|
2067 | 2177 | }
|
2068 | 2178 | }
|
2069 | 2179 |
|
Index: dxglcfg/tests.h |
— | — | @@ -31,6 +31,7 @@ |
32 | 32 | float yvelocity;
|
33 | 33 | DWORD bltflags;
|
34 | 34 | RECT rect;
|
| 35 | + DDBLTFX bltfx;
|
35 | 36 | } DDSPRITE;
|
36 | 37 |
|
37 | 38 | void RunDXGLTest(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int apiver,
|