Index: ddraw/ShaderGen2D.cpp |
— | — | @@ -58,6 +58,20 @@ |
59 | 59 | Bits 32-39: Texture type input
|
60 | 60 | Bits 40-47: Texture type output
|
61 | 61 | AND the dwFlags by 0xF2FAADFF before packing ROP index bits
|
| 62 | +
|
| 63 | +Texture types:
|
| 64 | +0x00: Classic DXGL processing
|
| 65 | +0x01: 32-bit YUV444, 8-bit component (convert from other formats via software)
|
| 66 | +0x10: 8-bit palette
|
| 67 | +0x11: 4-bit palette
|
| 68 | +0x12: 2-bit palette
|
| 69 | +0x13: 1-bit palette
|
| 70 | +0x14: 4-bit palette index
|
| 71 | +0x15: 2-bit palette index
|
| 72 | +0x16: 1-bit palette index
|
| 73 | +0x20: (first entry for specific RGB formats)
|
| 74 | +0x80: (first entry for specific YUV formats)
|
| 75 | +0xC0: (first entry for compressed)
|
62 | 76 | */
|
63 | 77 |
|
64 | 78 | static const char revheader[] =
|
Index: dxglcfg/surfacegen.cpp |
— | — | @@ -1662,8 +1662,8 @@ |
1663 | 1663 | static const LPTSTR StrFormatTestMethods[] =
|
1664 | 1664 | {
|
1665 | 1665 | _T("Unknown"),
|
| 1666 | + _T("Blt Sysmem"),
|
1666 | 1667 | _T("Blt Vidmem"),
|
1667 | | - _T("Blt Sysmem"),
|
1668 | 1668 | _T("D3D Quad"),
|
1669 | 1669 | _T("Overlay")
|
1670 | 1670 | };
|
— | — | @@ -1725,7 +1725,7 @@ |
1726 | 1726 |
|
1727 | 1727 | static const LPTSTR strErrorMessages[] =
|
1728 | 1728 | {
|
1729 | | - _T("Unknown error"),
|
| 1729 | + _T("Unknown error: "),
|
1730 | 1730 | _T("Error creating src surf: "),
|
1731 | 1731 | _T("Error locking src surf: "),
|
1732 | 1732 | _T("Error getting hdc: "),
|
— | — | @@ -1732,7 +1732,9 @@ |
1733 | 1733 | _T("Error creating dest surf: "),
|
1734 | 1734 | _T("Error blitting src to pri: "),
|
1735 | 1735 | _T("Error blitting src to dest: "),
|
1736 | | - _T("Error blitting dest to pri: ")
|
| 1736 | + _T("Error blitting dest to pri: "),
|
| 1737 | + _T("Error initializing Direct3D"),
|
| 1738 | + _T("Overlays not available yet")
|
1737 | 1739 | };
|
1738 | 1740 |
|
1739 | 1741 | void DrawFormatTestHUD(MultiDirectDrawSurface *surface, int srcformat, int destformat, int showhud,
|
— | — | @@ -1809,7 +1811,7 @@ |
1810 | 1812 | _tcscat(buffer, strFormatTestPatterns[testpattern]);
|
1811 | 1813 | _tcscat(buffer, strFormatTestStatus2);
|
1812 | 1814 | if (testmethod < 0) testmethod = 0;
|
1813 | | - if (testmethod > 3) testmethod = 0;
|
| 1815 | + if (testmethod > 4) testmethod = 0;
|
1814 | 1816 | _tcscat(buffer, StrFormatTestMethods[testmethod]);
|
1815 | 1817 | TextOutShadow(hdc, posx, posy, buffer, _tcslen(buffer), RGB(0, 0, 192));
|
1816 | 1818 | // List source formats
|
— | — | @@ -1911,13 +1913,16 @@ |
1912 | 1914 | SetBkColor(hdc, RGB(255, 0, 0));
|
1913 | 1915 | SetTextColor(hdc, RGB(255, 255, 255));
|
1914 | 1916 | if (errorlocation < 0) errorlocation = 0;
|
1915 | | - if (errorlocation > 7) errorlocation = 0;
|
| 1917 | + if (errorlocation > 9) errorlocation = 0;
|
1916 | 1918 | posx = 0;
|
1917 | 1919 | posy = charsize.cy * (rows - 1);
|
1918 | 1920 | _tcscpy(buffer, strErrorMessages[errorlocation]);
|
1919 | | - _tcscat(buffer, _T("0x"));
|
1920 | | - _itot(error, number, 16);
|
1921 | | - _tcscat(buffer, number);
|
| 1921 | + if ((errorlocation != 8) && (errorlocation != 9))
|
| 1922 | + {
|
| 1923 | + _tcscat(buffer, _T("0x"));
|
| 1924 | + _itot(error, number, 16);
|
| 1925 | + _tcscat(buffer, number);
|
| 1926 | + }
|
1922 | 1927 | TextOutShadow(hdc, posx, posy, buffer, _tcslen(buffer), RGB(192, 0, 0));
|
1923 | 1928 | }
|
1924 | 1929 | SelectObject(hdc, DefaultFont);
|
Index: dxglcfg/tests.cpp |
— | — | @@ -348,6 +348,9 @@ |
349 | 349 | RunSurfaceFormatTest();
|
350 | 350 | break;
|
351 | 351 | case VK_TAB: // Render method
|
| 352 | + testmethod++;
|
| 353 | + if (testmethod > 4) testmethod = 1;
|
| 354 | + RunSurfaceFormatTest();
|
352 | 355 | break;
|
353 | 356 | }
|
354 | 357 | }
|
— | — | @@ -1328,7 +1331,7 @@ |
1329 | 1332 | lights[0].dvAttenuation1 = 0.4f;
|
1330 | 1333 | error = d3d7dev->SetLight(0, &lights[0]);
|
1331 | 1334 | break;
|
1332 | | - case 13: // Solid cube
|
| 1335 | + case 13: // Textured cube
|
1333 | 1336 | MakeCube3D(5, 2);
|
1334 | 1337 | cleartexformats();
|
1335 | 1338 | d3d7dev->EnumTextureFormats(gettexformat, NULL);
|
— | — | @@ -1510,7 +1513,7 @@ |
1511 | 1514 | case 18: // Surface format test
|
1512 | 1515 | ddsrender->GetSurfaceDesc(&ddsd);
|
1513 | 1516 | ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
1514 | | - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 1517 | + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
|
1515 | 1518 | ddinterface->CreateSurface(&ddsd, &sprites[0].surface, NULL); // Initial source surface
|
1516 | 1519 | srcformat = 0;
|
1517 | 1520 | destformat = -1;
|
— | — | @@ -2298,11 +2301,25 @@ |
2299 | 2302 | {
|
2300 | 2303 | HRESULT error;
|
2301 | 2304 | DDSURFACEDESC2 ddsd;
|
| 2305 | + DDSURFACEDESC2 ddsdTexture;
|
2302 | 2306 | DDBLTFX bltfx;
|
| 2307 | + D3DTLVERTEX vertices[4];
|
| 2308 | + WORD indices[6] = { 0,3,1,3,0,2 };
|
| 2309 | + D3DVIEWPORT7 viewport;
|
| 2310 | + D3DDEVICEDESC7 d3ddevdesc;
|
| 2311 | + DWORD texwidth, texheight;
|
2303 | 2312 | errorlocation = 0;
|
2304 | 2313 | errornumber = 0;
|
2305 | | - if (ddver > 3)ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
2306 | | - else ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 2314 | + if (ddver > 3)
|
| 2315 | + {
|
| 2316 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 2317 | + ddsdTexture.dwSize = sizeof(DDSURFACEDESC2);
|
| 2318 | + }
|
| 2319 | + else
|
| 2320 | + {
|
| 2321 | + ddsd.dwSize = sizeof(DDSURFACEDESC);
|
| 2322 | + ddsdTexture.dwSize = sizeof(DDSURFACEDESC);
|
| 2323 | + }
|
2307 | 2324 | if (sprites[0].surface)
|
2308 | 2325 | {
|
2309 | 2326 | sprites[0].surface->Release();
|
— | — | @@ -2314,105 +2331,278 @@ |
2315 | 2332 | sprites[1].surface = NULL;
|
2316 | 2333 | }
|
2317 | 2334 | ddsrender->GetSurfaceDesc(&ddsd);
|
2318 | | - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
2319 | | - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
2320 | | - if (srcformat > 0)
|
| 2335 | + switch (testmethod)
|
2321 | 2336 | {
|
2322 | | - ddsd.dwFlags |= DDSD_PIXELFORMAT;
|
2323 | | - ddsd.ddpfPixelFormat = surfaceformats[srcformat];
|
2324 | | - }
|
2325 | | - error = ddinterface->CreateSurface(&ddsd, &sprites[0].surface, NULL);
|
2326 | | - if (error)
|
2327 | | - {
|
2328 | | - errorlocation = 1;
|
2329 | | - errornumber = error;
|
2330 | | - bltfx.dwSize = sizeof(DDBLTFX);
|
2331 | | - bltfx.dwFillColor = 0;
|
2332 | | - ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
2333 | | - }
|
2334 | | - else
|
2335 | | - {
|
2336 | | - // FIXME: Select pattern
|
2337 | | - error = sprites[0].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
2338 | | - if(error)
|
| 2337 | + case 1:
|
| 2338 | + case 2:
|
| 2339 | + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 2340 | + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 2341 | + if (testmethod == 2) ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
|
| 2342 | + else ddsd.ddsCaps.dwCaps |= D3DDEBCAPS_SYSTEMMEMORY;
|
| 2343 | + if (srcformat > 0)
|
2339 | 2344 | {
|
2340 | | - errorlocation = 2;
|
| 2345 | + ddsd.dwFlags |= DDSD_PIXELFORMAT;
|
| 2346 | + ddsd.ddpfPixelFormat = surfaceformats[srcformat];
|
| 2347 | + }
|
| 2348 | + error = ddinterface->CreateSurface(&ddsd, &sprites[0].surface, NULL);
|
| 2349 | + if (error)
|
| 2350 | + {
|
| 2351 | + errorlocation = 1;
|
2341 | 2352 | errornumber = error;
|
2342 | 2353 | bltfx.dwSize = sizeof(DDBLTFX);
|
2343 | 2354 | bltfx.dwFillColor = 0;
|
2344 | | - ddsrender->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&bltfx);
|
2345 | | - sprites[0].surface->Release();
|
2346 | | - sprites[0].surface = NULL;
|
| 2355 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
2347 | 2356 | }
|
2348 | 2357 | else
|
2349 | 2358 | {
|
2350 | | - DrawPalette(ddsd, (unsigned char*)ddsd.lpSurface);
|
2351 | | - error = sprites[0].surface->Unlock(NULL);
|
2352 | | - if (destformat != -1)
|
| 2359 | + // FIXME: Select pattern
|
| 2360 | + error = sprites[0].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
| 2361 | + if (error)
|
2353 | 2362 | {
|
2354 | | - ddsrender->GetSurfaceDesc(&ddsd);
|
2355 | | - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
2356 | | - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
2357 | | - if (destformat > 0)
|
| 2363 | + errorlocation = 2;
|
| 2364 | + errornumber = error;
|
| 2365 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2366 | + bltfx.dwFillColor = 0;
|
| 2367 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2368 | + sprites[0].surface->Release();
|
| 2369 | + sprites[0].surface = NULL;
|
| 2370 | + }
|
| 2371 | + else
|
| 2372 | + {
|
| 2373 | + DrawPalette(ddsd, (unsigned char*)ddsd.lpSurface);
|
| 2374 | + error = sprites[0].surface->Unlock(NULL);
|
| 2375 | + if (destformat != -1)
|
2358 | 2376 | {
|
2359 | | - ddsd.dwFlags |= DDSD_PIXELFORMAT;
|
2360 | | - ddsd.ddpfPixelFormat = surfaceformats[destformat];
|
2361 | | - }
|
2362 | | - error = ddinterface->CreateSurface(&ddsd, &sprites[1].surface, NULL);
|
2363 | | - if (error)
|
2364 | | - {
|
2365 | | - errorlocation = 4;
|
2366 | | - errornumber = error;
|
2367 | | - bltfx.dwSize = sizeof(DDBLTFX);
|
2368 | | - bltfx.dwFillColor = 0;
|
2369 | | - ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
2370 | | - sprites[0].surface->Release();
|
2371 | | - sprites[0].surface = NULL;
|
2372 | | - }
|
2373 | | - else
|
2374 | | - {
|
2375 | | - error = sprites[1].surface->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
|
| 2377 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 2378 | + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 2379 | + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
| 2380 | + if (destformat > 0)
|
| 2381 | + {
|
| 2382 | + ddsd.dwFlags |= DDSD_PIXELFORMAT;
|
| 2383 | + ddsd.ddpfPixelFormat = surfaceformats[destformat];
|
| 2384 | + }
|
| 2385 | + error = ddinterface->CreateSurface(&ddsd, &sprites[1].surface, NULL);
|
2376 | 2386 | if (error)
|
2377 | 2387 | {
|
2378 | | - errorlocation = 6;
|
| 2388 | + errorlocation = 4;
|
2379 | 2389 | errornumber = error;
|
2380 | 2390 | bltfx.dwSize = sizeof(DDBLTFX);
|
2381 | 2391 | bltfx.dwFillColor = 0;
|
2382 | 2392 | ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2393 | + sprites[0].surface->Release();
|
| 2394 | + sprites[0].surface = NULL;
|
2383 | 2395 | }
|
2384 | 2396 | else
|
2385 | 2397 | {
|
2386 | | - error = ddsrender->Blt(NULL, sprites[1].surface, NULL, DDBLT_WAIT, NULL);
|
| 2398 | + error = sprites[1].surface->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
|
2387 | 2399 | if (error)
|
2388 | 2400 | {
|
2389 | | - errorlocation = 7;
|
| 2401 | + errorlocation = 6;
|
2390 | 2402 | errornumber = error;
|
2391 | 2403 | bltfx.dwSize = sizeof(DDBLTFX);
|
2392 | 2404 | bltfx.dwFillColor = 0;
|
2393 | 2405 | ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
2394 | 2406 | }
|
| 2407 | + else
|
| 2408 | + {
|
| 2409 | + error = ddsrender->Blt(NULL, sprites[1].surface, NULL, DDBLT_WAIT, NULL);
|
| 2410 | + if (error)
|
| 2411 | + {
|
| 2412 | + errorlocation = 7;
|
| 2413 | + errornumber = error;
|
| 2414 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2415 | + bltfx.dwFillColor = 0;
|
| 2416 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2417 | + }
|
| 2418 | + }
|
| 2419 | + sprites[0].surface->Release();
|
| 2420 | + sprites[0].surface = NULL;
|
| 2421 | + sprites[1].surface->Release();
|
| 2422 | + sprites[1].surface = NULL;
|
2395 | 2423 | }
|
| 2424 | + }
|
| 2425 | + else
|
| 2426 | + {
|
| 2427 | + error = ddsrender->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
|
| 2428 | + if (error)
|
| 2429 | + {
|
| 2430 | + errorlocation = 5;
|
| 2431 | + errornumber = error;
|
| 2432 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2433 | + bltfx.dwFillColor = 0;
|
| 2434 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2435 | + }
|
2396 | 2436 | sprites[0].surface->Release();
|
2397 | 2437 | sprites[0].surface = NULL;
|
2398 | | - sprites[1].surface->Release();
|
2399 | | - sprites[1].surface = NULL;
|
2400 | 2438 | }
|
2401 | 2439 | }
|
| 2440 | + }
|
| 2441 | + break;
|
| 2442 | + case 3:
|
| 2443 | + if (d3dfail)
|
| 2444 | + {
|
| 2445 | + errorlocation = 8;
|
| 2446 | + errornumber = 1;
|
| 2447 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2448 | + bltfx.dwFillColor = 0;
|
| 2449 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2450 | + }
|
| 2451 | + else
|
| 2452 | + {
|
| 2453 | + ZeroMemory(&vertices, 4 * sizeof(D3DVERTEX));
|
| 2454 | + vertices[0].sx = 0.0f; vertices[0].sy = 0.0f; vertices[0].sz = 0.0f; vertices[0].rhw = 1.0f;
|
| 2455 | + vertices[1].sx = 0.0f; vertices[1].sy = (float)ddsd.dwHeight; vertices[1].sz = 0.0f; vertices[1].rhw = 1.0f;
|
| 2456 | + vertices[2].sx = (float)ddsd.dwWidth; vertices[2].sy = 0.0f; vertices[2].sz = 0.0f; vertices[2].rhw = 1.0f;
|
| 2457 | + vertices[3].sx = (float)ddsd.dwWidth; vertices[3].sy = (float)ddsd.dwHeight; vertices[3].sz = 0.0f; vertices[3].rhw = 1.0f;
|
| 2458 | + vertices[0].tu = 0.0f; vertices[0].tv = 0.0f;
|
| 2459 | + vertices[1].tu = 0.0f; vertices[1].tv = 1.0f;
|
| 2460 | + vertices[2].tu = 1.0f; vertices[2].tv = 0.0f;
|
| 2461 | + vertices[3].tu = 1.0f; vertices[3].tv = 1.0f;
|
| 2462 | + vertices[0].dcColor = vertices[1].dcColor = vertices[2].dcColor = vertices[3].dcColor = 0xFFFFFFFF;
|
| 2463 | + viewport.dwWidth = ddsd.dwWidth; viewport.dwHeight = ddsd.dwHeight;
|
| 2464 | + viewport.dwX = 0; viewport.dwY = 0;
|
| 2465 | + viewport.dvMinZ = 0.0f; viewport.dvMaxZ = 1.0f;
|
| 2466 | + ZeroMemory(&ddsdTexture, sizeof(DDSURFACEDESC2));
|
| 2467 | + ddsdTexture.dwSize = sizeof(DDSURFACEDESC2);
|
| 2468 | + ddsdTexture.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_TEXTURESTAGE;
|
| 2469 | + if (srcformat > 0)
|
| 2470 | + {
|
| 2471 | + ddsdTexture.dwFlags |= DDSD_PIXELFORMAT;
|
| 2472 | + ddsdTexture.ddpfPixelFormat = surfaceformats[srcformat];
|
| 2473 | + }
|
| 2474 | + ddsdTexture.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
| 2475 | + ddsdTexture.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE;
|
| 2476 | + d3d7dev->GetCaps(&d3ddevdesc);
|
| 2477 | + if (d3ddevdesc.dwMaxTextureWidth >= 512) texwidth = 512;
|
| 2478 | + else texwidth = d3ddevdesc.dwMaxTextureWidth;
|
| 2479 | + if (d3ddevdesc.dwMaxTextureHeight >= 512) texheight = 512;
|
| 2480 | + else texheight = d3ddevdesc.dwMaxTextureHeight;
|
| 2481 | + ddsdTexture.dwWidth = texwidth;
|
| 2482 | + ddsdTexture.dwHeight = texheight;
|
| 2483 | + error = ddinterface->CreateSurface(&ddsdTexture, &sprites[0].surface, NULL);
|
| 2484 | + if (error)
|
| 2485 | + {
|
| 2486 | + errorlocation = 1;
|
| 2487 | + errornumber = error;
|
| 2488 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2489 | + bltfx.dwFillColor = 0;
|
| 2490 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2491 | + }
|
2402 | 2492 | else
|
2403 | 2493 | {
|
2404 | | - error = ddsrender->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
|
| 2494 | + // FIXME: Select pattern
|
| 2495 | + error = sprites[0].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
|
2405 | 2496 | if (error)
|
2406 | 2497 | {
|
2407 | | - errorlocation = 5;
|
| 2498 | + errorlocation = 2;
|
2408 | 2499 | errornumber = error;
|
2409 | 2500 | bltfx.dwSize = sizeof(DDBLTFX);
|
2410 | 2501 | bltfx.dwFillColor = 0;
|
2411 | 2502 | ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2503 | + sprites[0].surface->Release();
|
| 2504 | + sprites[0].surface = NULL;
|
2412 | 2505 | }
|
2413 | | - sprites[0].surface->Release();
|
2414 | | - sprites[0].surface = NULL;
|
| 2506 | + else
|
| 2507 | + {
|
| 2508 | + DrawPalette(ddsd, (unsigned char*)ddsd.lpSurface);
|
| 2509 | + error = sprites[0].surface->Unlock(NULL);
|
| 2510 | + if (destformat != -1)
|
| 2511 | + {
|
| 2512 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 2513 | + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 2514 | + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
|
| 2515 | + if (destformat > 0)
|
| 2516 | + {
|
| 2517 | + ddsd.dwFlags |= DDSD_PIXELFORMAT;
|
| 2518 | + ddsd.ddpfPixelFormat = surfaceformats[destformat];
|
| 2519 | + }
|
| 2520 | + error = ddinterface->CreateSurface(&ddsd, &sprites[1].surface, NULL);
|
| 2521 | + if (error)
|
| 2522 | + {
|
| 2523 | + errorlocation = 4;
|
| 2524 | + errornumber = error;
|
| 2525 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2526 | + bltfx.dwFillColor = 0;
|
| 2527 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2528 | + sprites[0].surface->Release();
|
| 2529 | + sprites[0].surface = NULL;
|
| 2530 | + }
|
| 2531 | + else
|
| 2532 | + {
|
| 2533 | + error = 0;
|
| 2534 | + d3d7dev->SetRenderTarget((LPDIRECTDRAWSURFACE7)sprites[1].surface->GetSurface(), 0);
|
| 2535 | + d3d7dev->SetViewport(&viewport);
|
| 2536 | + d3d7dev->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1);
|
| 2537 | + d3d7dev->BeginScene();
|
| 2538 | + d3d7dev->SetTexture(0, (LPDIRECTDRAWSURFACE7)sprites[0].surface->GetSurface());
|
| 2539 | + d3d7dev->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_POINT);
|
| 2540 | + d3d7dev->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFN_POINT);
|
| 2541 | + d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, vertices,
|
| 2542 | + 4, indices, 6, 0);
|
| 2543 | + d3d7dev->EndScene();
|
| 2544 | + if (error)
|
| 2545 | + {
|
| 2546 | + errorlocation = 6;
|
| 2547 | + errornumber = error;
|
| 2548 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2549 | + bltfx.dwFillColor = 0;
|
| 2550 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2551 | + }
|
| 2552 | + else
|
| 2553 | + {
|
| 2554 | + error = ddsrender->Blt(NULL, sprites[1].surface, NULL, DDBLT_WAIT, NULL);
|
| 2555 | + if (error)
|
| 2556 | + {
|
| 2557 | + errorlocation = 7;
|
| 2558 | + errornumber = error;
|
| 2559 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2560 | + bltfx.dwFillColor = 0;
|
| 2561 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2562 | + }
|
| 2563 | + }
|
| 2564 | + sprites[0].surface->Release();
|
| 2565 | + sprites[0].surface = NULL;
|
| 2566 | + sprites[1].surface->Release();
|
| 2567 | + sprites[1].surface = NULL;
|
| 2568 | + }
|
| 2569 | + }
|
| 2570 | + else
|
| 2571 | + {
|
| 2572 | + error = 0;
|
| 2573 | + d3d7dev->SetRenderTarget((LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), 0);
|
| 2574 | + d3d7dev->SetViewport(&viewport);
|
| 2575 | + d3d7dev->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1);
|
| 2576 | + d3d7dev->BeginScene();
|
| 2577 | + d3d7dev->SetTexture(0, (LPDIRECTDRAWSURFACE7)sprites[0].surface->GetSurface());
|
| 2578 | + d3d7dev->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_POINT);
|
| 2579 | + d3d7dev->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFN_POINT);
|
| 2580 | + d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, vertices,
|
| 2581 | + 4, indices, 6, 0);
|
| 2582 | + d3d7dev->EndScene();
|
| 2583 | + if (error)
|
| 2584 | + {
|
| 2585 | + errorlocation = 5;
|
| 2586 | + errornumber = error;
|
| 2587 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2588 | + bltfx.dwFillColor = 0;
|
| 2589 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2590 | + }
|
| 2591 | + sprites[0].surface->Release();
|
| 2592 | + sprites[0].surface = NULL;
|
| 2593 | + }
|
| 2594 | + }
|
2415 | 2595 | }
|
2416 | 2596 | }
|
| 2597 | + break;
|
| 2598 | + case 4:
|
| 2599 | + errorlocation = 9;
|
| 2600 | + errornumber = 1;
|
| 2601 | + bltfx.dwSize = sizeof(DDBLTFX);
|
| 2602 | + bltfx.dwFillColor = 0;
|
| 2603 | + ddsrender->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &bltfx);
|
| 2604 | + break;
|
| 2605 | + default:
|
| 2606 | + break;
|
2417 | 2607 | }
|
2418 | 2608 | DrawFormatTestHUD(ddsrender, srcformat, destformat, showhud, testpattern,
|
2419 | 2609 | testmethod, ddsd.dwWidth, ddsd.dwHeight, errorlocation, errornumber);
|
— | — | @@ -3841,10 +4031,3 @@ |
3842 | 4032 | }
|
3843 | 4033 | return TRUE;
|
3844 | 4034 | }
|
3845 | | -
|
3846 | | -/*
|
3847 | | -void DDFlipTestWindow::OnQueryNewPalette(wxQueryNewPaletteEvent& event)
|
3848 | | -{
|
3849 | | - //if(bpp == 8) ddsurface->SetPalette
|
3850 | | -}
|
3851 | | -*/ |
\ No newline at end of file |