- Timestamp:
- May 21, 2010 12:48:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r29710 r29729 35 35 #endif 36 36 37 static FORMATOP gVBoxFormatOps [] = {37 static FORMATOP gVBoxFormatOps3D[] = { 38 38 {D3DDDIFMT_A8R8G8B8, 39 39 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| … … 108 108 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 109 109 110 {D3DDDIFMT_A8, 110 {D3DDDIFMT_A8, 111 111 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 112 112 0| … … 175 175 FORMATOP_BUMPMAP| 176 176 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 177 177 178 178 {D3DDDIFMT_A2W10V10U10, 179 179 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| … … 295 295 }; 296 296 297 #define VBOX_FORMATOP_COUNT() (sizeof(gVBoxFormatOps)/sizeof(gVBoxFormatOps[0])) 297 static FORMATOP gVBoxFormatOpsBase[] = { 298 {D3DDDIFMT_X8R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0}, 299 300 {D3DDDIFMT_R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0}, 301 302 {D3DDDIFMT_R5G6B5, FORMATOP_DISPLAYMODE, 0, 0, 0}, 303 304 {D3DDDIFMT_P8, FORMATOP_DISPLAYMODE, 0, 0, 0}, 305 }; 306 307 static FORMATOP gVBoxFormatOps[RT_ELEMENTS(gVBoxFormatOpsBase) /* some base formats we report ?? */ 308 + RT_ELEMENTS(gVBoxFormatOps3D) 309 #ifdef VBOX_WITH_VIDEOHWACCEL 310 + VBOXVHWA_MAX_FORMATS 311 #endif 312 ]; 313 static uint32_t gcVBoxFormatOps; 314 #define VBOX_FORMATOP_COUNT() (gcVBoxFormatOps) 298 315 299 316 #ifdef VBOX_WITH_VIDEOHWACCEL … … 324 341 325 342 #endif 343 344 int vboxFormatOpsMerge(FORMATOP *paOps, uint32_t *pcOps, uint32_t cMaxOps, FORMATOP *pOp) 345 { 346 uint32_t cOps = *pcOps; 347 348 Assert(cMaxOps >= cOps); 349 350 for (uint32_t i = 0; i < cOps; ++i) 351 { 352 FORMATOP *pCur = &paOps[i]; 353 if (pCur->Format == pOp->Format) 354 { 355 pCur->Operations |= pOp->Operations; 356 Assert(pCur->FlipMsTypes == pOp->FlipMsTypes); 357 Assert(pCur->BltMsTypes == pOp->BltMsTypes); 358 Assert(pCur->PrivateFormatBitCount == pOp->PrivateFormatBitCount); 359 return VINF_SUCCESS; 360 } 361 } 362 363 if (cMaxOps > cOps) 364 { 365 paOps[cOps] = *pOp; 366 ++cOps; 367 *pcOps = cOps; 368 return VINF_SUCCESS; 369 } 370 return VERR_BUFFER_OVERFLOW; 371 } 372 373 void vboxFormatOpsInit(PVBOXWDDMDISP_ADAPTER pAdapter) 374 { 375 gcVBoxFormatOps = 0; 376 if (pAdapter->pD3D9If) 377 { 378 memcpy (gVBoxFormatOps, gVBoxFormatOps3D, sizeof (gVBoxFormatOps3D)); 379 gcVBoxFormatOps = RT_ELEMENTS(gVBoxFormatOps3D); 380 } 381 382 if (gcVBoxFormatOps) 383 { 384 for (uint32_t i = 0; i < RT_ELEMENTS(gVBoxFormatOpsBase); ++i) 385 { 386 int rc = vboxFormatOpsMerge(gVBoxFormatOps, &gcVBoxFormatOps, RT_ELEMENTS(gVBoxFormatOps), &gVBoxFormatOpsBase[i]); 387 AssertRC(rc); 388 } 389 } 390 else 391 { 392 memcpy (gVBoxFormatOps, gVBoxFormatOpsBase, sizeof (gVBoxFormatOpsBase)); 393 gcVBoxFormatOps = RT_ELEMENTS(gVBoxFormatOpsBase); 394 } 395 396 #ifdef VBOX_WITH_VIDEOHWACCEL 397 FORMATOP fo = {D3DDDIFMT_UNKNOWN, 0, 0, 0, 0}; 398 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 399 { 400 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 401 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 402 { 403 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 404 { 405 fo.Format = pVhwa->Settings.aFormats[j]; 406 fo.Operations = FORMATOP_OVERLAY; 407 int rc = vboxFormatOpsMerge(gVBoxFormatOps, &gcVBoxFormatOps, RT_ELEMENTS(gVBoxFormatOps), &fo); 408 AssertRC(rc); 409 } 410 } 411 } 412 #endif 413 } 414 326 415 327 416 /** … … 1462 1551 pOpenData->DriverVersion = D3D_UMD_INTERFACE_VERSION; 1463 1552 1464 /* try enable the 3D */ 1465 hr = VBoxDispD3DOpen(&pAdapter->D3D); 1466 Assert(hr == S_OK); 1467 if (hr == S_OK) 1553 do 1468 1554 { 1469 hr = pAdapter->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pAdapter->pD3D9If); 1555 /* try enable the 3D */ 1556 hr = VBoxDispD3DOpen(&pAdapter->D3D); 1470 1557 Assert(hr == S_OK); 1471 1558 if (hr == S_OK) 1472 1559 { 1473 vboxVDbgPrint(("<== "__FUNCTION__", SUCCESS 3D Enabled, pAdapter (0x%p)\n", pAdapter)); 1474 return S_OK; 1560 hr = pAdapter->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pAdapter->pD3D9If); 1561 Assert(hr == S_OK); 1562 if (hr == S_OK) 1563 { 1564 vboxVDbgPrint((__FUNCTION__": SUCCESS 3D Enabled, pAdapter (0x%p)\n", pAdapter)); 1565 break; 1566 } 1567 else 1568 vboxVDbgPrintR((__FUNCTION__": pfnDirect3DCreate9Ex failed, hr (%d)\n", hr)); 1475 1569 } 1476 1570 else 1477 vboxVDbgPrintR((__FUNCTION__": pfnDirect3DCreate9Ex failed, hr (%d)\n", hr)); 1478 } 1479 else 1480 vboxVDbgPrintR((__FUNCTION__": VBoxDispD3DOpen failed, hr (%d)\n", hr)); 1481 1482 vboxVDbgPrint(("<== "__FUNCTION__", SUCCESS 3D DISABLED, pAdapter (0x%p)\n", pAdapter)); 1483 return S_OK; 1571 vboxVDbgPrintR((__FUNCTION__": VBoxDispD3DOpen failed, hr (%d)\n", hr)); 1572 } while (0); 1573 1574 vboxFormatOpsInit(pAdapter); 1575 hr = S_OK; 1484 1576 // RTMemFree(pAdapter); 1485 1577 } … … 1490 1582 } 1491 1583 1492 vboxVDbgPrint(("<== "__FUNCTION__", FAILURE,hr (%d)\n", hr));1584 vboxVDbgPrint(("<== "__FUNCTION__", hr (%d)\n", hr)); 1493 1585 1494 1586 return hr;
Note:
See TracChangeset
for help on using the changeset viewer.