Index: dxgltest/Tests3D.cpp |
— | — | @@ -273,6 +273,7 @@ |
274 | 274 | }
|
275 | 275 |
|
276 | 276 | INT_PTR CALLBACK TexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
| 277 | +INT_PTR CALLBACK VertexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
277 | 278 |
|
278 | 279 | void RunTest3D(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int apiver,
|
279 | 280 | int filter, int msaa, double fps, bool fullscreen, bool resizable)
|
— | — | @@ -282,6 +283,11 @@ |
283 | 284 | DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_TEXSHADER),NULL,TexShader7Proc);
|
284 | 285 | return;
|
285 | 286 | }
|
| 287 | + if(testnum == 3)
|
| 288 | + {
|
| 289 | + DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_TEXSHADER),NULL,VertexShader7Proc);
|
| 290 | + return;
|
| 291 | + }
|
286 | 292 | DDSCAPS2 caps;
|
287 | 293 | DDSURFACEDESC2 ddsd;
|
288 | 294 | DDPIXELFORMAT ddpfz;
|
— | — | @@ -672,6 +678,7 @@ |
673 | 679 | error = d3d7dev->SetLight(0,&lights[0]);
|
674 | 680 | break;
|
675 | 681 | case 2:
|
| 682 | + case 3:
|
676 | 683 | MakeCube3D();
|
677 | 684 | ZeroMemory(&material,sizeof(D3DMATERIAL7));
|
678 | 685 | material.ambient.r = 1.0f;
|
— | — | @@ -1089,6 +1096,7 @@ |
1090 | 1097 | SendDlgItemMessage(hWnd,IDC_SPECULAR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
1091 | 1098 | SendDlgItemMessage(hWnd,IDC_FACTOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
1092 | 1099 | SendDlgItemMessage(hWnd,IDC_FOGCOLOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
| 1100 | + SendDlgItemMessage(hWnd,IDC_BGCOLOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
1093 | 1101 | PopulateBlendCombo(GetDlgItem(hWnd,IDC_SRCBLEND),true);
|
1094 | 1102 | PopulateBlendCombo(GetDlgItem(hWnd,IDC_DESTBLEND),true);
|
1095 | 1103 | SendDlgItemMessage(hWnd,IDC_SRCBLEND,CB_SETCURSEL,D3DBLEND_ONE-1,0);
|
— | — | @@ -1357,3 +1365,89 @@ |
1358 | 1366 |
|
1359 | 1367 |
|
1360 | 1368 | }
|
| 1369 | +
|
| 1370 | +INT_PTR CALLBACK VertexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
| 1371 | +{
|
| 1372 | + HRESULT error;
|
| 1373 | + D3DVIEWPORT7 vp;
|
| 1374 | + HWND hDisplay;
|
| 1375 | + int number;
|
| 1376 | + TCHAR tmpstring[MAX_PATH+1];
|
| 1377 | + switch(Msg)
|
| 1378 | + {
|
| 1379 | + case WM_INITDIALOG:
|
| 1380 | + RECT r;
|
| 1381 | + DDSCAPS2 caps;
|
| 1382 | + DDSURFACEDESC2 ddsd;
|
| 1383 | + DDPIXELFORMAT ddpfz;
|
| 1384 | + testnum = 3;
|
| 1385 | + ddinterface = new MultiDirectDraw(7,&error,NULL);
|
| 1386 | + hDisplay = GetDlgItem(hWnd,IDC_DISPLAY);
|
| 1387 | + ::hWnd = hDisplay;
|
| 1388 | + error = ddinterface->SetCooperativeLevel(hDisplay,DDSCL_NORMAL);
|
| 1389 | + ZeroMemory(&ddsd,sizeof(DDSURFACEDESC2));
|
| 1390 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 1391 | + ddsd.dwFlags = DDSD_CAPS;
|
| 1392 | + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
| 1393 | + error = ddinterface->CreateSurface(&ddsd,&ddsurface,NULL);
|
| 1394 | + error = ddinterface->CreateClipper(0,&ddclipper,NULL);
|
| 1395 | + error = ddclipper->SetHWnd(0,hDisplay);
|
| 1396 | + error = ddsurface->SetClipper(ddclipper);
|
| 1397 | + ZeroMemory(&ddsd,sizeof(DDSURFACEDESC2));
|
| 1398 | + ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
| 1399 | + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
| 1400 | + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_3DDEVICE;
|
| 1401 | + GetClientRect(hDisplay,&r);
|
| 1402 | + ddsd.dwWidth = r.right;
|
| 1403 | + ddsd.dwHeight = r.bottom;
|
| 1404 | + error = ddinterface->CreateSurface(&ddsd,&ddsrender,NULL);
|
| 1405 | + error = ddinterface->QueryInterface(IID_IDirect3D7,(VOID**)&d3d7);
|
| 1406 | + error = d3d7->EnumZBufferFormats(IID_IDirect3DRGBDevice,zcallback,&ddpfz);
|
| 1407 | + error = ddsrender->GetSurfaceDesc(&ddsd);
|
| 1408 | + ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT;
|
| 1409 | + ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER|DDSCAPS_VIDEOMEMORY;
|
| 1410 | + memcpy(&ddsd.ddpfPixelFormat,&ddpfz,sizeof(DDPIXELFORMAT));
|
| 1411 | + error = ddinterface->CreateSurface(&ddsd,&zbuffer,NULL);
|
| 1412 | + error = ddsrender->AddAttachedSurface(zbuffer);
|
| 1413 | + error = d3d7->CreateDevice(IID_IDirect3DHALDevice,(LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(),&d3d7dev);
|
| 1414 | + if(error != D3D_OK)
|
| 1415 | + error = d3d7->CreateDevice(IID_IDirect3DRGBDevice,(LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(),&d3d7dev);
|
| 1416 | + ddsrender->GetSurfaceDesc(&ddsd);
|
| 1417 | + vp.dvMaxZ = 1.0f;
|
| 1418 | + vp.dvMinZ = 0.0f;
|
| 1419 | + vp.dwX = vp.dwY = 0;
|
| 1420 | + vp.dwWidth = ddsd.dwWidth;
|
| 1421 | + vp.dwHeight = ddsd.dwHeight;
|
| 1422 | + error = d3d7dev->SetViewport(&vp);
|
| 1423 | + error = d3d7dev->SetRenderState(D3DRENDERSTATE_ZENABLE,TRUE);
|
| 1424 | + InitTest3D(3);
|
| 1425 | + SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("None"));
|
| 1426 | + SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("Gradients"));
|
| 1427 | + SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("DXGL logo (small)"));
|
| 1428 | + SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("DXGL logo (large)"));
|
| 1429 | + SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_ADDSTRING,0,(LPARAM)_T("Texture file"));
|
| 1430 | + SendDlgItemMessage(hWnd,IDC_TEXTURE,CB_SETCURSEL,0,0);
|
| 1431 | + SendDlgItemMessage(hWnd,IDC_DIFFUSE,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
|
| 1432 | + SendDlgItemMessage(hWnd,IDC_SPECULAR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
| 1433 | + SendDlgItemMessage(hWnd,IDC_FACTOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
| 1434 | + SendDlgItemMessage(hWnd,IDC_FOGCOLOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
| 1435 | + SendDlgItemMessage(hWnd,IDC_BGCOLOR,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
| 1436 | + SendDlgItemMessage(hWnd,IDC_AMBIENT,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
|
| 1437 | + SendDlgItemMessage(hWnd,IDC_EMISSIVE,WM_SETTEXT,0,(LPARAM)_T("00000000"));
|
| 1438 | + SendDlgItemMessage(hWnd,IDC_MATAMBIENT,WM_SETTEXT,0,(LPARAM)_T("FFFFFFFF"));
|
| 1439 | + ::width = ddsd.dwWidth;
|
| 1440 | + ::height = ddsd.dwHeight;
|
| 1441 | + StartTimer(hWnd,WM_APP,60);
|
| 1442 | + break;
|
| 1443 | + case WM_CLOSE:
|
| 1444 | + ddinterface->Release();
|
| 1445 | + EndDialog(hWnd,IDCANCEL);
|
| 1446 | + break;
|
| 1447 | + case WM_APP:
|
| 1448 | + RunTestTimed3D(testnum);
|
| 1449 | + break;
|
| 1450 | + default:
|
| 1451 | + return FALSE;
|
| 1452 | + }
|
| 1453 | + return TRUE;
|
| 1454 | +}
|