Changeset 29772 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- May 25, 2010 9:25:58 AM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r29760 r29772 344 344 }; 345 345 346 static FORMATOP gVBoxFormatOps[RT_ELEMENTS(gVBoxFormatOpsBase) /* some base formats we report ?? */ 347 + RT_ELEMENTS(gVBoxFormatOps3D) 348 #ifdef VBOX_WITH_VIDEOHWACCEL 349 + VBOXVHWA_MAX_FORMATS 350 #endif 351 ]; 352 static uint32_t gcVBoxFormatOps; 353 #define VBOX_FORMATOP_COUNT() (gcVBoxFormatOps) 346 static DDSURFACEDESC gVBoxSurfDescsBase[] = { 347 { 348 sizeof (DDSURFACEDESC), /* DWORD dwSize; */ 349 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */ 350 0, /* DWORD dwHeight; */ 351 0, /* DWORD dwWidth; */ 352 { 353 0, /* Union */ 354 /* LONG lPitch; */ 355 /* DWORD dwLinearSize; */ 356 }, 357 0, /* DWORD dwBackBufferCount; */ 358 { 359 0, /* Union */ 360 /* DWORD dwMipMapCount; */ 361 /* DWORD dwZBufferBitDepth; */ 362 /* DWORD dwRefreshRate; */ 363 }, 364 0, /* DWORD dwAlphaBitDepth; */ 365 0, /* DWORD dwReserved; */ 366 NULL, /* LPVOID lpSurface; */ 367 { 368 0, /* DWORD dwColorSpaceLowValue; */ 369 0, /* DWORD dwColorSpaceHighValue; */ 370 }, /* DDCOLORKEY ddckCKDestOverlay; */ 371 { 372 0, /* DWORD dwColorSpaceLowValue; */ 373 0, /* DWORD dwColorSpaceHighValue; */ 374 }, /* DDCOLORKEY ddckCKDestBlt; */ 375 { 376 0, /* DWORD dwColorSpaceLowValue; */ 377 0, /* DWORD dwColorSpaceHighValue; */ 378 }, /* DDCOLORKEY ddckCKSrcOverlay; */ 379 { 380 0, /* DWORD dwColorSpaceLowValue; */ 381 0, /* DWORD dwColorSpaceHighValue; */ 382 }, /* DDCOLORKEY ddckCKSrcBlt; */ 383 { 384 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */ 385 DDPF_RGB, /* DWORD dwFlags; */ 386 0, /* DWORD dwFourCC; */ 387 { 388 32, /* union */ 389 /* DWORD dwRGBBitCount; */ 390 /* DWORD dwYUVBitCount; */ 391 /* DWORD dwZBufferBitDepth; */ 392 /* DWORD dwAlphaBitDepth; */ 393 /* DWORD dwLuminanceBitCount; */ 394 /* DWORD dwBumpBitCount; */ 395 }, 396 { 397 0xff0000, /* union */ 398 /* DWORD dwRBitMask; */ 399 /* DWORD dwYBitMask; */ 400 /* DWORD dwStencilBitDepth; */ 401 /* DWORD dwLuminanceBitMask; */ 402 /* DWORD dwBumpDuBitMask; */ 403 }, 404 { 405 0xff00, 406 /* DWORD dwGBitMask; */ 407 /* DWORD dwUBitMask; */ 408 /* DWORD dwZBitMask; */ 409 /* DWORD dwBumpDvBitMask; */ 410 }, 411 { 412 0xff, 413 /* DWORD dwBBitMask; */ 414 /* DWORD dwVBitMask; */ 415 /* DWORD dwStencilBitMask; */ 416 /* DWORD dwBumpLuminanceBitMask; */ 417 }, 418 { 419 0, 420 /* DWORD dwRGBAlphaBitMask; */ 421 /* DWORD dwYUVAlphaBitMask; */ 422 /* DWORD dwLuminanceAlphaBitMask; */ 423 /* DWORD dwRGBZBitMask; */ 424 /* DWORD dwYUVZBitMask; */ 425 }, 426 }, /* DDPIXELFORMAT ddpfPixelFormat; */ 427 { 428 DDSCAPS_BACKBUFFER 429 | DDSCAPS_COMPLEX 430 | DDSCAPS_FLIP 431 | DDSCAPS_FRONTBUFFER 432 | DDSCAPS_LOCALVIDMEM 433 | DDSCAPS_PRIMARYSURFACE 434 | DDSCAPS_VIDEOMEMORY 435 | DDSCAPS_VISIBLE /* DWORD dwCaps; */ 436 } /* DDSCAPS ddsCaps; */ 437 }, 438 { 439 sizeof (DDSURFACEDESC), /* DWORD dwSize; */ 440 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */ 441 0, /* DWORD dwHeight; */ 442 0, /* DWORD dwWidth; */ 443 { 444 0, /* Union */ 445 /* LONG lPitch; */ 446 /* DWORD dwLinearSize; */ 447 }, 448 0, /* DWORD dwBackBufferCount; */ 449 { 450 0, /* Union */ 451 /* DWORD dwMipMapCount; */ 452 /* DWORD dwZBufferBitDepth; */ 453 /* DWORD dwRefreshRate; */ 454 }, 455 0, /* DWORD dwAlphaBitDepth; */ 456 0, /* DWORD dwReserved; */ 457 NULL, /* LPVOID lpSurface; */ 458 { 459 0, /* DWORD dwColorSpaceLowValue; */ 460 0, /* DWORD dwColorSpaceHighValue; */ 461 }, /* DDCOLORKEY ddckCKDestOverlay; */ 462 { 463 0, /* DWORD dwColorSpaceLowValue; */ 464 0, /* DWORD dwColorSpaceHighValue; */ 465 }, /* DDCOLORKEY ddckCKDestBlt; */ 466 { 467 0, /* DWORD dwColorSpaceLowValue; */ 468 0, /* DWORD dwColorSpaceHighValue; */ 469 }, /* DDCOLORKEY ddckCKSrcOverlay; */ 470 { 471 0, /* DWORD dwColorSpaceLowValue; */ 472 0, /* DWORD dwColorSpaceHighValue; */ 473 }, /* DDCOLORKEY ddckCKSrcBlt; */ 474 { 475 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */ 476 DDPF_RGB, /* DWORD dwFlags; */ 477 0, /* DWORD dwFourCC; */ 478 { 479 24, /* union */ 480 /* DWORD dwRGBBitCount; */ 481 /* DWORD dwYUVBitCount; */ 482 /* DWORD dwZBufferBitDepth; */ 483 /* DWORD dwAlphaBitDepth; */ 484 /* DWORD dwLuminanceBitCount; */ 485 /* DWORD dwBumpBitCount; */ 486 }, 487 { 488 0xff0000, /* union */ 489 /* DWORD dwRBitMask; */ 490 /* DWORD dwYBitMask; */ 491 /* DWORD dwStencilBitDepth; */ 492 /* DWORD dwLuminanceBitMask; */ 493 /* DWORD dwBumpDuBitMask; */ 494 }, 495 { 496 0xff00, 497 /* DWORD dwGBitMask; */ 498 /* DWORD dwUBitMask; */ 499 /* DWORD dwZBitMask; */ 500 /* DWORD dwBumpDvBitMask; */ 501 }, 502 { 503 0xff, 504 /* DWORD dwBBitMask; */ 505 /* DWORD dwVBitMask; */ 506 /* DWORD dwStencilBitMask; */ 507 /* DWORD dwBumpLuminanceBitMask; */ 508 }, 509 { 510 0, 511 /* DWORD dwRGBAlphaBitMask; */ 512 /* DWORD dwYUVAlphaBitMask; */ 513 /* DWORD dwLuminanceAlphaBitMask; */ 514 /* DWORD dwRGBZBitMask; */ 515 /* DWORD dwYUVZBitMask; */ 516 }, 517 }, /* DDPIXELFORMAT ddpfPixelFormat; */ 518 { 519 DDSCAPS_BACKBUFFER 520 | DDSCAPS_COMPLEX 521 | DDSCAPS_FLIP 522 | DDSCAPS_FRONTBUFFER 523 | DDSCAPS_LOCALVIDMEM 524 | DDSCAPS_PRIMARYSURFACE 525 | DDSCAPS_VIDEOMEMORY 526 | DDSCAPS_VISIBLE /* DWORD dwCaps; */ 527 } /* DDSCAPS ddsCaps; */ 528 }, 529 { 530 sizeof (DDSURFACEDESC), /* DWORD dwSize; */ 531 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */ 532 0, /* DWORD dwHeight; */ 533 0, /* DWORD dwWidth; */ 534 { 535 0, /* Union */ 536 /* LONG lPitch; */ 537 /* DWORD dwLinearSize; */ 538 }, 539 0, /* DWORD dwBackBufferCount; */ 540 { 541 0, /* Union */ 542 /* DWORD dwMipMapCount; */ 543 /* DWORD dwZBufferBitDepth; */ 544 /* DWORD dwRefreshRate; */ 545 }, 546 0, /* DWORD dwAlphaBitDepth; */ 547 0, /* DWORD dwReserved; */ 548 NULL, /* LPVOID lpSurface; */ 549 { 550 0, /* DWORD dwColorSpaceLowValue; */ 551 0, /* DWORD dwColorSpaceHighValue; */ 552 }, /* DDCOLORKEY ddckCKDestOverlay; */ 553 { 554 0, /* DWORD dwColorSpaceLowValue; */ 555 0, /* DWORD dwColorSpaceHighValue; */ 556 }, /* DDCOLORKEY ddckCKDestBlt; */ 557 { 558 0, /* DWORD dwColorSpaceLowValue; */ 559 0, /* DWORD dwColorSpaceHighValue; */ 560 }, /* DDCOLORKEY ddckCKSrcOverlay; */ 561 { 562 0, /* DWORD dwColorSpaceLowValue; */ 563 0, /* DWORD dwColorSpaceHighValue; */ 564 }, /* DDCOLORKEY ddckCKSrcBlt; */ 565 { 566 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */ 567 DDPF_RGB, /* DWORD dwFlags; */ 568 0, /* DWORD dwFourCC; */ 569 { 570 16, /* union */ 571 /* DWORD dwRGBBitCount; */ 572 /* DWORD dwYUVBitCount; */ 573 /* DWORD dwZBufferBitDepth; */ 574 /* DWORD dwAlphaBitDepth; */ 575 /* DWORD dwLuminanceBitCount; */ 576 /* DWORD dwBumpBitCount; */ 577 }, 578 { 579 0xf800, /* union */ 580 /* DWORD dwRBitMask; */ 581 /* DWORD dwYBitMask; */ 582 /* DWORD dwStencilBitDepth; */ 583 /* DWORD dwLuminanceBitMask; */ 584 /* DWORD dwBumpDuBitMask; */ 585 }, 586 { 587 0x7e0, 588 /* DWORD dwGBitMask; */ 589 /* DWORD dwUBitMask; */ 590 /* DWORD dwZBitMask; */ 591 /* DWORD dwBumpDvBitMask; */ 592 }, 593 { 594 0x1f, 595 /* DWORD dwBBitMask; */ 596 /* DWORD dwVBitMask; */ 597 /* DWORD dwStencilBitMask; */ 598 /* DWORD dwBumpLuminanceBitMask; */ 599 }, 600 { 601 0, 602 /* DWORD dwRGBAlphaBitMask; */ 603 /* DWORD dwYUVAlphaBitMask; */ 604 /* DWORD dwLuminanceAlphaBitMask; */ 605 /* DWORD dwRGBZBitMask; */ 606 /* DWORD dwYUVZBitMask; */ 607 }, 608 }, /* DDPIXELFORMAT ddpfPixelFormat; */ 609 { 610 DDSCAPS_BACKBUFFER 611 | DDSCAPS_COMPLEX 612 | DDSCAPS_FLIP 613 | DDSCAPS_FRONTBUFFER 614 | DDSCAPS_LOCALVIDMEM 615 | DDSCAPS_PRIMARYSURFACE 616 | DDSCAPS_VIDEOMEMORY 617 | DDSCAPS_VISIBLE /* DWORD dwCaps; */ 618 } /* DDSCAPS ddsCaps; */ 619 }, 620 }; 354 621 355 622 #ifdef VBOX_WITH_VIDEOHWACCEL … … 379 646 } 380 647 648 static void vboxVhwaPopulateOverlayFourccSurfDesc(DDSURFACEDESC *pDesc, uint32_t fourcc) 649 { 650 memset(pDesc, 0, sizeof (DDSURFACEDESC)); 651 652 pDesc->dwSize = sizeof (DDSURFACEDESC); 653 pDesc->dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT; 654 pDesc->ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT); 655 pDesc->ddpfPixelFormat.dwFlags = DDPF_FOURCC; 656 pDesc->ddpfPixelFormat.dwFourCC = fourcc; 657 pDesc->ddsCaps.dwCaps = DDSCAPS_BACKBUFFER 658 | DDSCAPS_COMPLEX 659 | DDSCAPS_FLIP 660 | DDSCAPS_FRONTBUFFER 661 | DDSCAPS_LOCALVIDMEM 662 | DDSCAPS_OVERLAY 663 | DDSCAPS_VIDEOMEMORY 664 | DDSCAPS_VISIBLE; 665 } 666 381 667 #endif 668 669 static bool vboxPixFormatMatch(DDPIXELFORMAT *pFormat1, DDPIXELFORMAT *pFormat2) 670 { 671 return !memcmp(pFormat1, pFormat2, sizeof (DDPIXELFORMAT)); 672 } 673 674 int vboxSurfDescMerge(DDSURFACEDESC *paDescs, uint32_t *pcDescs, uint32_t cMaxDescs, DDSURFACEDESC *pDesc) 675 { 676 uint32_t cDescs = *pcDescs; 677 678 Assert(cMaxDescs >= cDescs); 679 Assert(pDesc->dwFlags == (DDSD_CAPS | DDSD_PIXELFORMAT)); 680 if (pDesc->dwFlags != (DDSD_CAPS | DDSD_PIXELFORMAT)) 681 return VERR_INVALID_PARAMETER; 682 683 for (uint32_t i = 0; i < cDescs; ++i) 684 { 685 DDSURFACEDESC *pCur = &paDescs[i]; 686 if (vboxPixFormatMatch(&pCur->ddpfPixelFormat, &pDesc->ddpfPixelFormat)) 687 { 688 if (pDesc->dwFlags & DDSD_CAPS) 689 { 690 pCur->dwFlags |= DDSD_CAPS; 691 pCur->ddsCaps.dwCaps |= pDesc->ddsCaps.dwCaps; 692 } 693 return VINF_SUCCESS; 694 } 695 } 696 697 if (cMaxDescs > cDescs) 698 { 699 paDescs[cDescs] = *pDesc; 700 ++cDescs; 701 *pcDescs = cDescs; 702 return VINF_SUCCESS; 703 } 704 return VERR_BUFFER_OVERFLOW; 705 } 382 706 383 707 int vboxFormatOpsMerge(FORMATOP *paOps, uint32_t *pcOps, uint32_t cMaxOps, FORMATOP *pOp) … … 410 734 } 411 735 412 void vboxFormatOpsInit(PVBOXWDDMDISP_ADAPTER pAdapter) 413 { 414 gcVBoxFormatOps = 0; 415 if (pAdapter->pD3D9If) 736 static uint32_t vboxFormatToFourcc(D3DDDIFORMAT format) 737 { 738 uint32_t uFormat = (uint32_t)format; 739 /* assume that in case both four bytes are non-zero, this is a fourcc */ 740 if ((format & 0xff000000) 741 && (format & 0x00ff0000) 742 && (format & 0x0000ff00) 743 && (format & 0x000000ff) 744 ) 745 return uFormat; 746 return 0; 747 } 748 749 int vboxCapsInit(PVBOXWDDMDISP_ADAPTER pAdapter) 750 { 751 pAdapter->cFormstOps = 0; 752 pAdapter->paFormstOps = NULL; 753 pAdapter->cSurfDescs = 0; 754 pAdapter->paSurfDescs = NULL; 755 756 if (pAdapter->uIfVersion > 7) 416 757 { 417 memcpy (gVBoxFormatOps, gVBoxFormatOps3D, sizeof (gVBoxFormatOps3D)); 418 gcVBoxFormatOps = RT_ELEMENTS(gVBoxFormatOps3D); 419 } 420 421 if (gcVBoxFormatOps) 422 { 423 for (uint32_t i = 0; i < RT_ELEMENTS(gVBoxFormatOpsBase); ++i) 758 if (pAdapter->pD3D9If) 424 759 { 425 int rc = vboxFormatOpsMerge(gVBoxFormatOps, &gcVBoxFormatOps, RT_ELEMENTS(gVBoxFormatOps), &gVBoxFormatOpsBase[i]); 426 AssertRC(rc); 760 pAdapter->paFormstOps = (FORMATOP*)RTMemAllocZ(sizeof (gVBoxFormatOps3D)); 761 Assert(pAdapter->paFormstOps); 762 if (pAdapter->paFormstOps) 763 { 764 memcpy (pAdapter->paFormstOps , gVBoxFormatOps3D, sizeof (gVBoxFormatOps3D)); 765 pAdapter->cFormstOps = RT_ELEMENTS(gVBoxFormatOps3D); 766 } 767 else 768 return VERR_OUT_OF_RESOURCES; 769 770 /* @todo: do we need surface caps here ? */ 427 771 } 428 772 } 773 #ifdef VBOX_WITH_VIDEOHWACCEL 429 774 else 430 775 { 431 memcpy (gVBoxFormatOps, gVBoxFormatOpsBase, sizeof (gVBoxFormatOpsBase)); 432 gcVBoxFormatOps = RT_ELEMENTS(gVBoxFormatOpsBase); 433 } 434 435 #ifdef VBOX_WITH_VIDEOHWACCEL 436 FORMATOP fo = {D3DDDIFMT_UNKNOWN, 0, 0, 0, 0}; 437 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 438 { 439 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 440 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 776 /* just calc the max number of formats */ 777 uint32_t cFormats = RT_ELEMENTS(gVBoxFormatOpsBase); 778 uint32_t cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase); 779 uint32_t cOverlayFormats = 0; 780 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 441 781 { 442 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 443 { 444 fo.Format = pVhwa->Settings.aFormats[j]; 445 fo.Operations = FORMATOP_OVERLAY; 446 int rc = vboxFormatOpsMerge(gVBoxFormatOps, &gcVBoxFormatOps, RT_ELEMENTS(gVBoxFormatOps), &fo); 447 AssertRC(rc); 782 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 783 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 784 { 785 cOverlayFormats += pVhwa->Settings.cFormats; 448 786 } 449 787 } 788 789 cFormats += cOverlayFormats; 790 cSurfDescs += cOverlayFormats; 791 792 uint32_t cbFormatOps = cFormats * sizeof (FORMATOP); 793 cbFormatOps = (cbFormatOps + 7) & ~3; 794 /* ensure the surf descs are 8 byte alligned */ 795 uint32_t offSurfDescs = (cbFormatOps + 7) & ~3; 796 uint32_t cbSurfDescs = cSurfDescs * sizeof (DDSURFACEDESC); 797 uint32_t cbBuf = offSurfDescs + cbSurfDescs; 798 uint8_t* pvBuf = (uint8_t*)RTMemAllocZ(cbBuf); 799 Assert(pvBuf); 800 if (pvBuf) 801 { 802 pAdapter->paFormstOps = (FORMATOP*)pvBuf; 803 memcpy (pAdapter->paFormstOps , gVBoxFormatOpsBase, sizeof (gVBoxFormatOpsBase)); 804 pAdapter->cFormstOps = RT_ELEMENTS(gVBoxFormatOpsBase); 805 806 FORMATOP fo = {D3DDDIFMT_UNKNOWN, 0, 0, 0, 0}; 807 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 808 { 809 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 810 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 811 { 812 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 813 { 814 fo.Format = pVhwa->Settings.aFormats[j]; 815 fo.Operations = FORMATOP_OVERLAY; 816 int rc = vboxFormatOpsMerge(pAdapter->paFormstOps, &pAdapter->cFormstOps, cFormats, &fo); 817 AssertRC(rc); 818 } 819 } 820 } 821 822 pAdapter->paSurfDescs = (DDSURFACEDESC*)(pvBuf + offSurfDescs); 823 memcpy (pAdapter->paSurfDescs , gVBoxSurfDescsBase, sizeof (gVBoxSurfDescsBase)); 824 pAdapter->cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase); 825 826 DDSURFACEDESC sd; 827 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 828 { 829 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 830 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 831 { 832 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 833 { 834 uint32_t fourcc = vboxFormatToFourcc(pVhwa->Settings.aFormats[j]); 835 if (fourcc) 836 { 837 vboxVhwaPopulateOverlayFourccSurfDesc(&sd, fourcc); 838 int rc = vboxSurfDescMerge(pAdapter->paSurfDescs, &pAdapter->cSurfDescs, cSurfDescs, &sd); 839 AssertRC(rc); 840 } 841 } 842 } 843 } 844 } 845 else 846 return VERR_OUT_OF_RESOURCES; 450 847 } 451 848 #endif 452 } 453 849 850 return VINF_SUCCESS; 851 } 852 853 void vboxCapsFree(PVBOXWDDMDISP_ADAPTER pAdapter) 854 { 855 if (pAdapter->paFormstOps) 856 RTMemFree(pAdapter->paFormstOps); 857 } 454 858 455 859 /** … … 505 909 { 506 910 DDRAW_CAPS *pCaps = (DDRAW_CAPS*)pData->pData; 507 pCaps->Caps |= DDRAW_CAPS_COLORKEY; 911 pCaps->Caps |= DDRAW_CAPS_COLORKEY 912 | DDRAW_CAPS2_DYNAMICTEXTURES 913 | DDRAW_CAPS2_FLIPNOVSYNC 914 ; 508 915 } 509 916 #endif … … 561 968 } 562 969 case D3DDDICAPS_GETFORMATCOUNT: 563 *((uint32_t*)pData->pData) = VBOX_FORMATOP_COUNT();970 *((uint32_t*)pData->pData) = pAdapter->cFormstOps; 564 971 break; 565 972 case D3DDDICAPS_GETFORMATDATA: 566 Assert(pData->DataSize >= VBOX_FORMATOP_COUNT() * sizeof(FORMATOP));567 memcpy(pData->pData, gVBoxFormatOps, VBOX_FORMATOP_COUNT()*sizeof(FORMATOP));973 Assert(pData->DataSize >= pAdapter->cFormstOps * sizeof (FORMATOP)); 974 memcpy(pData->pData, pAdapter->paFormstOps, pAdapter->cFormstOps * sizeof (FORMATOP)); 568 975 break; 569 976 case D3DDDICAPS_GETD3DQUERYCOUNT: 570 *((uint32_t*)pData->pData) = 0; 977 *((uint32_t*)pData->pData) = 0;//VBOX_QUERYTYPE_COUNT(); 978 break; 979 case D3DDDICAPS_GETD3DQUERYDATA: 980 AssertBreakpoint(); 981 memset(pData->pData, 0, pData->DataSize); 982 // Assert(pData->DataSize >= VBOX_QUERYTYPE_COUNT() * sizeof (D3DDDIQUERYTYPE)); 983 // memcpy(pData->pData, gVBoxQueryTypes, VBOX_QUERYTYPE_COUNT() * sizeof (D3DDDIQUERYTYPE)); 571 984 break; 572 985 case D3DDDICAPS_GETD3D3CAPS: … … 579 992 pCaps->hwCaps.dwSize = sizeof (D3DDEVICEDESC_V1); 580 993 pCaps->hwCaps.dwFlags = D3DDD_COLORMODEL 581 | D3DDD_DEVCAPS; 994 | D3DDD_DEVCAPS 995 | D3DDD_DEVICERENDERBITDEPTH; 582 996 583 997 pCaps->hwCaps.dcmColorModel = D3DCOLOR_RGB; 584 pCaps->hwCaps.dwDevCaps = 0; 998 pCaps->hwCaps.dwDevCaps = D3DDEVCAPS_CANRENDERAFTERFLIP 999 | D3DDEVCAPS_DRAWPRIMTLVERTEX 1000 | D3DDEVCAPS_EXECUTESYSTEMMEMORY 1001 | D3DDEVCAPS_FLOATTLVERTEX 1002 | D3DDEVCAPS_HWRASTERIZATION 1003 | D3DDEVCAPS_HWTRANSFORMANDLIGHT 1004 | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 1005 | D3DDEVCAPS_TEXTUREVIDEOMEMORY; 585 1006 pCaps->hwCaps.dtcTransformCaps.dwSize = sizeof (D3DTRANSFORMCAPS); 586 1007 pCaps->hwCaps.dtcTransformCaps.dwCaps = 0; … … 620 1041 pCaps->hwCaps.dpcTriCaps.dwStippleHeight = 0; 621 1042 pCaps->hwCaps.dwDeviceRenderBitDepth = 0; 622 pCaps->hwCaps.dwDeviceZBufferBitDepth = 0;1043 pCaps->hwCaps.dwDeviceZBufferBitDepth = DDBD_8 | DDBD_16 | DDBD_24 | DDBD_32; 623 1044 pCaps->hwCaps.dwMaxBufferSize = 0; 624 1045 pCaps->hwCaps.dwMaxVertexCount = 0; … … 627 1048 pCaps->dwNumVertices = 0; 628 1049 pCaps->dwNumClipVertices = 0; 629 pCaps->dwNumTextureFormats = 0;630 pCaps->lpTextureFormats = NULL;1050 pCaps->dwNumTextureFormats = pAdapter->cSurfDescs; 1051 pCaps->lpTextureFormats = pAdapter->paSurfDescs; 631 1052 } 632 1053 else … … 667 1088 break; 668 1089 case D3DDDICAPS_GETMULTISAMPLEQUALITYLEVELS: 669 case D3DDDICAPS_GETD3DQUERYDATA:670 1090 case D3DDDICAPS_GETD3D5CAPS: 671 1091 case D3DDDICAPS_GETD3D6CAPS: … … 1618 2038 } 1619 2039 2040 vboxCapsFree(pAdapter); 2041 1620 2042 RTMemFree(pAdapter); 1621 2043 … … 1664 2086 pAdapter->RtCallbacks = *pOpenData->pAdapterCallbacks; 1665 2087 1666 #ifdef VBOX_WITH_VIDEOHWACCEL1667 2088 pAdapter->cHeads = Query.cInfos; 1668 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 1669 { 1670 pAdapter->aHeads[i].Vhwa.Settings = Query.aInfos[i]; 1671 } 1672 #endif 2089 1673 2090 1674 2091 pOpenData->hAdapter = pAdapter; … … 1677 2094 pOpenData->pAdapterFuncs->pfnCloseAdapter = vboxWddmDispCloseAdapter; 1678 2095 pOpenData->DriverVersion = D3D_UMD_INTERFACE_VERSION; 1679 1680 do 2096 /* 2097 * here we detect whether we are called by the d3d or ddraw. 2098 * in the d3d case we init our d3d environment 2099 * in the ddraw case we init 2D acceleration 2100 * if interface version is > 7, this is D3D, treat it as so 2101 * otherwise treat it as ddraw 2102 * @todo: need a more clean way of doing this */ 2103 2104 if (pAdapter->uIfVersion > 7) 1681 2105 { 1682 /* try enable the 3D */ 1683 hr = VBoxDispD3DOpen(&pAdapter->D3D); 1684 Assert(hr == S_OK); 1685 if (hr == S_OK) 1686 { 1687 hr = pAdapter->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pAdapter->pD3D9If); 2106 do 2107 { 2108 /* try enable the 3D */ 2109 hr = VBoxDispD3DOpen(&pAdapter->D3D); 1688 2110 Assert(hr == S_OK); 1689 2111 if (hr == S_OK) 1690 2112 { 1691 vboxVDbgPrint((__FUNCTION__": SUCCESS 3D Enabled, pAdapter (0x%p)\n", pAdapter)); 1692 break; 2113 hr = pAdapter->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pAdapter->pD3D9If); 2114 Assert(hr == S_OK); 2115 if (hr == S_OK) 2116 { 2117 vboxVDbgPrint((__FUNCTION__": SUCCESS 3D Enabled, pAdapter (0x%p)\n", pAdapter)); 2118 break; 2119 } 2120 else 2121 vboxVDbgPrintR((__FUNCTION__": pfnDirect3DCreate9Ex failed, hr (%d)\n", hr)); 2122 VBoxDispD3DClose(&pAdapter->D3D); 1693 2123 } 1694 2124 else 1695 vboxVDbgPrintR((__FUNCTION__": pfnDirect3DCreate9Ex failed, hr (%d)\n", hr)); 1696 1697 VBoxDispD3DClose(&pAdapter->D3D); 2125 vboxVDbgPrintR((__FUNCTION__": VBoxDispD3DOpen failed, hr (%d)\n", hr)); 2126 } while (0); 2127 } 2128 #ifdef VBOX_WITH_VIDEOHWACCEL 2129 else 2130 { 2131 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 2132 { 2133 pAdapter->aHeads[i].Vhwa.Settings = Query.aInfos[i]; 1698 2134 } 1699 else 1700 vboxVDbgPrintR((__FUNCTION__": VBoxDispD3DOpen failed, hr (%d)\n", hr)); 1701 } while (0); 1702 1703 vboxFormatOpsInit(pAdapter); 2135 } 2136 #endif 2137 2138 vboxCapsInit(pAdapter); 1704 2139 hr = S_OK; 1705 2140 // RTMemFree(pAdapter); -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r29710 r29772 45 45 IDirect3D9Ex * pD3D9If; 46 46 D3DDDI_ADAPTERCALLBACKS RtCallbacks; 47 uint32_t cFormstOps; 48 FORMATOP *paFormstOps; 49 uint32_t cSurfDescs; 50 DDSURFACEDESC *paSurfDescs; 47 51 #ifdef VBOX_WITH_VIDEOHWACCEL 48 52 uint32_t cHeads;
Note:
See TracChangeset
for help on using the changeset viewer.