Changeset 42557 in vbox
- Timestamp:
- Aug 2, 2012 8:31:05 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r42518 r42557 195 195 196 196 //#define VBOXWDDMOVERLAY_TEST 197 198 static FORMATOP gVBoxFormatOps3D[] = {199 {D3DDDIFMT_A8R8G8B8,200 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|201 FORMATOP_SAME_FORMAT_RENDERTARGET|202 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|203 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|204 FORMATOP_MEMBEROFGROUP_ARGB|205 FORMATOP_SRGBWRITE|FORMATOP_VERTEXTEXTURE, 0, 0, 0},206 207 {D3DDDIFMT_X8R8G8B8,208 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|209 FORMATOP_SAME_FORMAT_RENDERTARGET|210 FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION|211 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|212 FORMATOP_MEMBEROFGROUP_ARGB|213 FORMATOP_SRGBWRITE|FORMATOP_VERTEXTEXTURE, 0, 0, 0},214 215 {D3DDDIFMT_A2R10G10B10,216 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|217 FORMATOP_SAME_FORMAT_RENDERTARGET|218 0|219 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|220 FORMATOP_MEMBEROFGROUP_ARGB|221 FORMATOP_VERTEXTEXTURE, 0, 0, 0},222 223 {D3DDDIFMT_X1R5G5B5,224 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|225 FORMATOP_SAME_FORMAT_RENDERTARGET|226 0|227 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|228 FORMATOP_MEMBEROFGROUP_ARGB|229 FORMATOP_VERTEXTEXTURE, 0, 0, 0},230 231 {D3DDDIFMT_A1R5G5B5,232 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|233 FORMATOP_SAME_FORMAT_RENDERTARGET|234 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|235 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|236 FORMATOP_MEMBEROFGROUP_ARGB|237 FORMATOP_VERTEXTEXTURE, 0, 0, 0},238 239 {D3DDDIFMT_A4R4G4B4,240 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|241 FORMATOP_SAME_FORMAT_RENDERTARGET|242 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|243 FORMATOP_OFFSCREENPLAIN|244 0|245 FORMATOP_VERTEXTEXTURE, 0, 0, 0},246 247 {D3DDDIFMT_R5G6B5,248 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|249 FORMATOP_SAME_FORMAT_RENDERTARGET|250 FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION|251 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|252 FORMATOP_MEMBEROFGROUP_ARGB|253 FORMATOP_VERTEXTEXTURE, 0, 0, 0},254 255 {D3DDDIFMT_L16,256 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|257 0|258 0|259 FORMATOP_OFFSCREENPLAIN|260 0|261 FORMATOP_VERTEXTEXTURE, 0, 0, 0},262 263 {D3DDDIFMT_A8L8,264 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|265 0|266 0|267 FORMATOP_OFFSCREENPLAIN|268 0|269 FORMATOP_VERTEXTEXTURE, 0, 0, 0},270 271 {D3DDDIFMT_A8,272 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|273 0|274 0|275 FORMATOP_OFFSCREENPLAIN|276 0|277 FORMATOP_VERTEXTEXTURE, 0, 0, 0},278 279 {D3DDDIFMT_L8,280 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|281 0|282 0|283 FORMATOP_OFFSCREENPLAIN|284 0|285 FORMATOP_VERTEXTEXTURE, 0, 0, 0},286 287 {D3DDDIFMT_D16, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},288 {D3DDDIFMT_D24S8, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},289 {D3DDDIFMT_D24X8, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},290 {D3DDDIFMT_D16_LOCKABLE, FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},291 {D3DDDIFMT_X8D24, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},292 {D3DDDIFMT_D32F_LOCKABLE, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},293 {D3DDDIFMT_S8D24, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0},294 295 {D3DDDIFMT_DXT1,296 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|297 0|298 0|299 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|300 0|301 FORMATOP_VERTEXTEXTURE, 0, 0, 0},302 303 {D3DDDIFMT_DXT2,304 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|305 0|306 0|307 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|308 0|309 FORMATOP_VERTEXTEXTURE, 0, 0, 0},310 311 {D3DDDIFMT_DXT3,312 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|313 0|314 0|315 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|316 0|317 FORMATOP_VERTEXTEXTURE, 0, 0, 0},318 319 {D3DDDIFMT_DXT4,320 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|321 0|322 0|323 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|324 0|325 FORMATOP_VERTEXTEXTURE, 0, 0, 0},326 327 {D3DDDIFMT_DXT5,328 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE|329 0|330 0|331 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|332 0|333 FORMATOP_VERTEXTEXTURE, 0, 0, 0},334 335 {D3DDDIFMT_X8L8V8U8,336 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|337 0|338 0|339 0|340 FORMATOP_BUMPMAP|341 FORMATOP_VERTEXTEXTURE, 0, 0, 0},342 343 {D3DDDIFMT_A2W10V10U10,344 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|345 0|346 0|347 0|348 FORMATOP_BUMPMAP|349 FORMATOP_VERTEXTEXTURE, 0, 0, 0},350 351 {D3DDDIFMT_V8U8,352 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|353 0|354 0|355 0|356 FORMATOP_BUMPMAP|357 FORMATOP_VERTEXTEXTURE, 0, 0, 0},358 359 {D3DDDIFMT_Q8W8V8U8,360 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|361 0|362 0|363 FORMATOP_OFFSCREENPLAIN|364 FORMATOP_BUMPMAP|365 FORMATOP_VERTEXTEXTURE, 0, 0, 0},366 367 {D3DDDIFMT_CxV8U8, FORMATOP_NOFILTER|FORMATOP_NOALPHABLEND|FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0},368 369 {D3DDDIFMT_R16F,370 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|371 FORMATOP_SAME_FORMAT_RENDERTARGET|372 0|373 FORMATOP_OFFSCREENPLAIN|374 0|375 FORMATOP_VERTEXTEXTURE, 0, 0, 0},376 377 {D3DDDIFMT_R32F,378 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|379 FORMATOP_SAME_FORMAT_RENDERTARGET|380 0|381 FORMATOP_OFFSCREENPLAIN|382 0|383 FORMATOP_VERTEXTEXTURE, 0, 0, 0},384 385 {D3DDDIFMT_G16R16F,386 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|387 FORMATOP_SAME_FORMAT_RENDERTARGET|388 0|389 FORMATOP_OFFSCREENPLAIN|390 0|391 FORMATOP_VERTEXTEXTURE, 0, 0, 0},392 393 {D3DDDIFMT_G32R32F,394 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|395 FORMATOP_SAME_FORMAT_RENDERTARGET|396 0|397 FORMATOP_OFFSCREENPLAIN|398 0|399 FORMATOP_VERTEXTEXTURE, 0, 0, 0},400 401 {D3DDDIFMT_A16B16G16R16F,402 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|403 FORMATOP_SAME_FORMAT_RENDERTARGET|404 0|405 FORMATOP_OFFSCREENPLAIN|406 0|407 FORMATOP_VERTEXTEXTURE, 0, 0, 0},408 409 {D3DDDIFMT_A32B32G32R32F,410 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|411 FORMATOP_SAME_FORMAT_RENDERTARGET|412 0|413 FORMATOP_OFFSCREENPLAIN|414 0|415 FORMATOP_VERTEXTEXTURE, 0, 0, 0},416 417 {D3DDDIFMT_G16R16,418 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|419 FORMATOP_SAME_FORMAT_RENDERTARGET|420 0|421 FORMATOP_OFFSCREENPLAIN|422 0|423 FORMATOP_VERTEXTEXTURE, 0, 0, 0},424 425 {D3DDDIFMT_A16B16G16R16,426 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|427 FORMATOP_SAME_FORMAT_RENDERTARGET|428 0|429 FORMATOP_OFFSCREENPLAIN|430 0|431 FORMATOP_VERTEXTEXTURE, 0, 0, 0},432 433 {D3DDDIFMT_V16U16,434 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|435 0|436 0|437 0|438 FORMATOP_BUMPMAP|439 FORMATOP_VERTEXTEXTURE, 0, 0, 0},440 441 {D3DDDIFMT_P8, FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION|FORMATOP_OFFSCREENPLAIN, 0, 0, 0},442 443 {D3DDDIFMT_UYVY,444 0|445 0|446 0|447 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|448 FORMATOP_NOFILTER|449 FORMATOP_NOALPHABLEND|450 FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0},451 452 {D3DDDIFMT_YUY2,453 0|454 0|455 0|456 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|457 FORMATOP_NOFILTER|458 FORMATOP_NOALPHABLEND|459 FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0},460 461 {D3DDDIFMT_Q16W16V16U16,462 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|463 FORMATOP_SAME_FORMAT_RENDERTARGET|464 0|465 FORMATOP_OFFSCREENPLAIN|466 FORMATOP_BUMPMAP|FORMATOP_DMAP|467 FORMATOP_VERTEXTEXTURE, 0, 0, 0},468 469 {D3DDDIFMT_X8B8G8R8,470 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|471 FORMATOP_SAME_FORMAT_RENDERTARGET|472 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET|473 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD|474 FORMATOP_DMAP|FORMATOP_MEMBEROFGROUP_ARGB|475 FORMATOP_SRGBWRITE|FORMATOP_AUTOGENMIPMAP|FORMATOP_VERTEXTEXTURE|476 FORMATOP_OVERLAY, 0, 0, 0},477 478 {D3DDDIFMT_BINARYBUFFER, FORMATOP_OFFSCREENPLAIN, 0, 0, 0},479 480 {D3DDDIFMT_A4L4,481 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|482 0|483 0|484 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|485 FORMATOP_DMAP|486 FORMATOP_VERTEXTEXTURE, 0, 0, 0},487 488 {D3DDDIFMT_A2B10G10R10,489 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET|490 FORMATOP_SAME_FORMAT_RENDERTARGET|491 0|492 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|493 FORMATOP_DMAP|FORMATOP_MEMBEROFGROUP_ARGB|494 FORMATOP_AUTOGENMIPMAP|FORMATOP_VERTEXTEXTURE, 0, 0, 0},495 };496 497 static FORMATOP gVBoxFormatOpsBase[] = {498 {D3DDDIFMT_X8R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0},499 500 {D3DDDIFMT_R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0},501 502 {D3DDDIFMT_R5G6B5, FORMATOP_DISPLAYMODE, 0, 0, 0},503 504 {D3DDDIFMT_P8, FORMATOP_DISPLAYMODE, 0, 0, 0},505 };506 507 static DDSURFACEDESC gVBoxSurfDescsBase[] = {508 {509 sizeof (DDSURFACEDESC), /* DWORD dwSize; */510 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */511 0, /* DWORD dwHeight; */512 0, /* DWORD dwWidth; */513 {514 0, /* Union */515 /* LONG lPitch; */516 /* DWORD dwLinearSize; */517 },518 0, /* DWORD dwBackBufferCount; */519 {520 0, /* Union */521 /* DWORD dwMipMapCount; */522 /* DWORD dwZBufferBitDepth; */523 /* DWORD dwRefreshRate; */524 },525 0, /* DWORD dwAlphaBitDepth; */526 0, /* DWORD dwReserved; */527 NULL, /* LPVOID lpSurface; */528 {529 0, /* DWORD dwColorSpaceLowValue; */530 0, /* DWORD dwColorSpaceHighValue; */531 }, /* DDCOLORKEY ddckCKDestOverlay; */532 {533 0, /* DWORD dwColorSpaceLowValue; */534 0, /* DWORD dwColorSpaceHighValue; */535 }, /* DDCOLORKEY ddckCKDestBlt; */536 {537 0, /* DWORD dwColorSpaceLowValue; */538 0, /* DWORD dwColorSpaceHighValue; */539 }, /* DDCOLORKEY ddckCKSrcOverlay; */540 {541 0, /* DWORD dwColorSpaceLowValue; */542 0, /* DWORD dwColorSpaceHighValue; */543 }, /* DDCOLORKEY ddckCKSrcBlt; */544 {545 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */546 DDPF_RGB, /* DWORD dwFlags; */547 0, /* DWORD dwFourCC; */548 {549 32, /* union */550 /* DWORD dwRGBBitCount; */551 /* DWORD dwYUVBitCount; */552 /* DWORD dwZBufferBitDepth; */553 /* DWORD dwAlphaBitDepth; */554 /* DWORD dwLuminanceBitCount; */555 /* DWORD dwBumpBitCount; */556 },557 {558 0xff0000, /* union */559 /* DWORD dwRBitMask; */560 /* DWORD dwYBitMask; */561 /* DWORD dwStencilBitDepth; */562 /* DWORD dwLuminanceBitMask; */563 /* DWORD dwBumpDuBitMask; */564 },565 {566 0xff00,567 /* DWORD dwGBitMask; */568 /* DWORD dwUBitMask; */569 /* DWORD dwZBitMask; */570 /* DWORD dwBumpDvBitMask; */571 },572 {573 0xff,574 /* DWORD dwBBitMask; */575 /* DWORD dwVBitMask; */576 /* DWORD dwStencilBitMask; */577 /* DWORD dwBumpLuminanceBitMask; */578 },579 {580 0,581 /* DWORD dwRGBAlphaBitMask; */582 /* DWORD dwYUVAlphaBitMask; */583 /* DWORD dwLuminanceAlphaBitMask; */584 /* DWORD dwRGBZBitMask; */585 /* DWORD dwYUVZBitMask; */586 },587 }, /* DDPIXELFORMAT ddpfPixelFormat; */588 {589 DDSCAPS_BACKBUFFER590 | DDSCAPS_COMPLEX591 | DDSCAPS_FLIP592 | DDSCAPS_FRONTBUFFER593 | DDSCAPS_LOCALVIDMEM594 | DDSCAPS_PRIMARYSURFACE595 | DDSCAPS_VIDEOMEMORY596 | DDSCAPS_VISIBLE /* DWORD dwCaps; */597 } /* DDSCAPS ddsCaps; */598 },599 {600 sizeof (DDSURFACEDESC), /* DWORD dwSize; */601 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */602 0, /* DWORD dwHeight; */603 0, /* DWORD dwWidth; */604 {605 0, /* Union */606 /* LONG lPitch; */607 /* DWORD dwLinearSize; */608 },609 0, /* DWORD dwBackBufferCount; */610 {611 0, /* Union */612 /* DWORD dwMipMapCount; */613 /* DWORD dwZBufferBitDepth; */614 /* DWORD dwRefreshRate; */615 },616 0, /* DWORD dwAlphaBitDepth; */617 0, /* DWORD dwReserved; */618 NULL, /* LPVOID lpSurface; */619 {620 0, /* DWORD dwColorSpaceLowValue; */621 0, /* DWORD dwColorSpaceHighValue; */622 }, /* DDCOLORKEY ddckCKDestOverlay; */623 {624 0, /* DWORD dwColorSpaceLowValue; */625 0, /* DWORD dwColorSpaceHighValue; */626 }, /* DDCOLORKEY ddckCKDestBlt; */627 {628 0, /* DWORD dwColorSpaceLowValue; */629 0, /* DWORD dwColorSpaceHighValue; */630 }, /* DDCOLORKEY ddckCKSrcOverlay; */631 {632 0, /* DWORD dwColorSpaceLowValue; */633 0, /* DWORD dwColorSpaceHighValue; */634 }, /* DDCOLORKEY ddckCKSrcBlt; */635 {636 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */637 DDPF_RGB, /* DWORD dwFlags; */638 0, /* DWORD dwFourCC; */639 {640 24, /* union */641 /* DWORD dwRGBBitCount; */642 /* DWORD dwYUVBitCount; */643 /* DWORD dwZBufferBitDepth; */644 /* DWORD dwAlphaBitDepth; */645 /* DWORD dwLuminanceBitCount; */646 /* DWORD dwBumpBitCount; */647 },648 {649 0xff0000, /* union */650 /* DWORD dwRBitMask; */651 /* DWORD dwYBitMask; */652 /* DWORD dwStencilBitDepth; */653 /* DWORD dwLuminanceBitMask; */654 /* DWORD dwBumpDuBitMask; */655 },656 {657 0xff00,658 /* DWORD dwGBitMask; */659 /* DWORD dwUBitMask; */660 /* DWORD dwZBitMask; */661 /* DWORD dwBumpDvBitMask; */662 },663 {664 0xff,665 /* DWORD dwBBitMask; */666 /* DWORD dwVBitMask; */667 /* DWORD dwStencilBitMask; */668 /* DWORD dwBumpLuminanceBitMask; */669 },670 {671 0,672 /* DWORD dwRGBAlphaBitMask; */673 /* DWORD dwYUVAlphaBitMask; */674 /* DWORD dwLuminanceAlphaBitMask; */675 /* DWORD dwRGBZBitMask; */676 /* DWORD dwYUVZBitMask; */677 },678 }, /* DDPIXELFORMAT ddpfPixelFormat; */679 {680 DDSCAPS_BACKBUFFER681 | DDSCAPS_COMPLEX682 | DDSCAPS_FLIP683 | DDSCAPS_FRONTBUFFER684 | DDSCAPS_LOCALVIDMEM685 | DDSCAPS_PRIMARYSURFACE686 | DDSCAPS_VIDEOMEMORY687 | DDSCAPS_VISIBLE /* DWORD dwCaps; */688 } /* DDSCAPS ddsCaps; */689 },690 {691 sizeof (DDSURFACEDESC), /* DWORD dwSize; */692 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */693 0, /* DWORD dwHeight; */694 0, /* DWORD dwWidth; */695 {696 0, /* Union */697 /* LONG lPitch; */698 /* DWORD dwLinearSize; */699 },700 0, /* DWORD dwBackBufferCount; */701 {702 0, /* Union */703 /* DWORD dwMipMapCount; */704 /* DWORD dwZBufferBitDepth; */705 /* DWORD dwRefreshRate; */706 },707 0, /* DWORD dwAlphaBitDepth; */708 0, /* DWORD dwReserved; */709 NULL, /* LPVOID lpSurface; */710 {711 0, /* DWORD dwColorSpaceLowValue; */712 0, /* DWORD dwColorSpaceHighValue; */713 }, /* DDCOLORKEY ddckCKDestOverlay; */714 {715 0, /* DWORD dwColorSpaceLowValue; */716 0, /* DWORD dwColorSpaceHighValue; */717 }, /* DDCOLORKEY ddckCKDestBlt; */718 {719 0, /* DWORD dwColorSpaceLowValue; */720 0, /* DWORD dwColorSpaceHighValue; */721 }, /* DDCOLORKEY ddckCKSrcOverlay; */722 {723 0, /* DWORD dwColorSpaceLowValue; */724 0, /* DWORD dwColorSpaceHighValue; */725 }, /* DDCOLORKEY ddckCKSrcBlt; */726 {727 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */728 DDPF_RGB, /* DWORD dwFlags; */729 0, /* DWORD dwFourCC; */730 {731 16, /* union */732 /* DWORD dwRGBBitCount; */733 /* DWORD dwYUVBitCount; */734 /* DWORD dwZBufferBitDepth; */735 /* DWORD dwAlphaBitDepth; */736 /* DWORD dwLuminanceBitCount; */737 /* DWORD dwBumpBitCount; */738 },739 {740 0xf800, /* union */741 /* DWORD dwRBitMask; */742 /* DWORD dwYBitMask; */743 /* DWORD dwStencilBitDepth; */744 /* DWORD dwLuminanceBitMask; */745 /* DWORD dwBumpDuBitMask; */746 },747 {748 0x7e0,749 /* DWORD dwGBitMask; */750 /* DWORD dwUBitMask; */751 /* DWORD dwZBitMask; */752 /* DWORD dwBumpDvBitMask; */753 },754 {755 0x1f,756 /* DWORD dwBBitMask; */757 /* DWORD dwVBitMask; */758 /* DWORD dwStencilBitMask; */759 /* DWORD dwBumpLuminanceBitMask; */760 },761 {762 0,763 /* DWORD dwRGBAlphaBitMask; */764 /* DWORD dwYUVAlphaBitMask; */765 /* DWORD dwLuminanceAlphaBitMask; */766 /* DWORD dwRGBZBitMask; */767 /* DWORD dwYUVZBitMask; */768 },769 }, /* DDPIXELFORMAT ddpfPixelFormat; */770 {771 DDSCAPS_BACKBUFFER772 | DDSCAPS_COMPLEX773 | DDSCAPS_FLIP774 | DDSCAPS_FRONTBUFFER775 | DDSCAPS_LOCALVIDMEM776 | DDSCAPS_PRIMARYSURFACE777 | DDSCAPS_VIDEOMEMORY778 | DDSCAPS_VISIBLE /* DWORD dwCaps; */779 } /* DDSCAPS ddsCaps; */780 },781 };782 197 783 198 static D3DDDIQUERYTYPE gVBoxQueryTypes[] = { … … 1027 442 } 1028 443 1029 static void vboxVhwaPopulateOverlayFourccSurfDesc(DDSURFACEDESC *pDesc, uint32_t fourcc) 1030 { 1031 memset(pDesc, 0, sizeof (DDSURFACEDESC)); 1032 1033 pDesc->dwSize = sizeof (DDSURFACEDESC); 1034 pDesc->dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT; 1035 pDesc->ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT); 1036 pDesc->ddpfPixelFormat.dwFlags = DDPF_FOURCC; 1037 pDesc->ddpfPixelFormat.dwFourCC = fourcc; 1038 pDesc->ddsCaps.dwCaps = DDSCAPS_BACKBUFFER 1039 | DDSCAPS_COMPLEX 1040 | DDSCAPS_FLIP 1041 | DDSCAPS_FRONTBUFFER 1042 | DDSCAPS_LOCALVIDMEM 1043 | DDSCAPS_OVERLAY 1044 | DDSCAPS_VIDEOMEMORY 1045 | DDSCAPS_VISIBLE; 1046 } 1047 1048 #endif 1049 1050 static bool vboxPixFormatMatch(DDPIXELFORMAT *pFormat1, DDPIXELFORMAT *pFormat2) 1051 { 1052 return !memcmp(pFormat1, pFormat2, sizeof (DDPIXELFORMAT)); 1053 } 1054 1055 int vboxSurfDescMerge(DDSURFACEDESC *paDescs, uint32_t *pcDescs, uint32_t cMaxDescs, DDSURFACEDESC *pDesc) 1056 { 1057 uint32_t cDescs = *pcDescs; 1058 1059 Assert(cMaxDescs >= cDescs); 1060 Assert(pDesc->dwFlags == (DDSD_CAPS | DDSD_PIXELFORMAT)); 1061 if (pDesc->dwFlags != (DDSD_CAPS | DDSD_PIXELFORMAT)) 1062 return VERR_INVALID_PARAMETER; 1063 1064 for (uint32_t i = 0; i < cDescs; ++i) 1065 { 1066 DDSURFACEDESC *pCur = &paDescs[i]; 1067 if (vboxPixFormatMatch(&pCur->ddpfPixelFormat, &pDesc->ddpfPixelFormat)) 1068 { 1069 if (pDesc->dwFlags & DDSD_CAPS) 1070 { 1071 pCur->dwFlags |= DDSD_CAPS; 1072 pCur->ddsCaps.dwCaps |= pDesc->ddsCaps.dwCaps; 1073 } 1074 return VINF_SUCCESS; 1075 } 1076 } 1077 1078 if (cMaxDescs > cDescs) 1079 { 1080 paDescs[cDescs] = *pDesc; 1081 ++cDescs; 1082 *pcDescs = cDescs; 1083 return VINF_SUCCESS; 1084 } 1085 return VERR_BUFFER_OVERFLOW; 1086 } 1087 1088 int vboxFormatOpsMerge(FORMATOP *paOps, uint32_t *pcOps, uint32_t cMaxOps, FORMATOP *pOp) 1089 { 1090 uint32_t cOps = *pcOps; 1091 1092 Assert(cMaxOps >= cOps); 1093 1094 for (uint32_t i = 0; i < cOps; ++i) 1095 { 1096 FORMATOP *pCur = &paOps[i]; 1097 if (pCur->Format == pOp->Format) 1098 { 1099 pCur->Operations |= pOp->Operations; 1100 Assert(pCur->FlipMsTypes == pOp->FlipMsTypes); 1101 Assert(pCur->BltMsTypes == pOp->BltMsTypes); 1102 Assert(pCur->PrivateFormatBitCount == pOp->PrivateFormatBitCount); 1103 return VINF_SUCCESS; 1104 } 1105 } 1106 1107 if (cMaxOps > cOps) 1108 { 1109 paOps[cOps] = *pOp; 1110 ++cOps; 1111 *pcOps = cOps; 1112 return VINF_SUCCESS; 1113 } 1114 return VERR_BUFFER_OVERFLOW; 1115 } 1116 1117 int vboxCapsInit(PVBOXWDDMDISP_ADAPTER pAdapter) 1118 { 1119 pAdapter->cFormstOps = 0; 1120 pAdapter->paFormstOps = NULL; 1121 pAdapter->cSurfDescs = 0; 1122 pAdapter->paSurfDescs = NULL; 1123 1124 if (VBOXDISPMODE_IS_3D(pAdapter)) 1125 { 1126 pAdapter->paFormstOps = (FORMATOP*)RTMemAllocZ(sizeof (gVBoxFormatOps3D)); 1127 Assert(pAdapter->paFormstOps); 1128 if (pAdapter->paFormstOps) 1129 { 1130 memcpy (pAdapter->paFormstOps , gVBoxFormatOps3D, sizeof (gVBoxFormatOps3D)); 1131 pAdapter->cFormstOps = RT_ELEMENTS(gVBoxFormatOps3D); 1132 } 1133 else 1134 return VERR_OUT_OF_RESOURCES; 1135 } 1136 #ifdef VBOX_WITH_VIDEOHWACCEL 1137 else 1138 { 1139 /* just calc the max number of formats */ 1140 uint32_t cFormats = RT_ELEMENTS(gVBoxFormatOpsBase); 1141 uint32_t cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase); 1142 uint32_t cOverlayFormats = 0; 1143 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 1144 { 1145 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 1146 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 1147 { 1148 cOverlayFormats += pVhwa->Settings.cFormats; 1149 } 1150 } 1151 1152 cFormats += cOverlayFormats; 1153 cSurfDescs += cOverlayFormats; 1154 1155 uint32_t cbFormatOps = cFormats * sizeof (FORMATOP); 1156 cbFormatOps = (cbFormatOps + 7) & ~3; 1157 /* ensure the surf descs are 8 byte aligned */ 1158 uint32_t offSurfDescs = (cbFormatOps + 7) & ~3; 1159 uint32_t cbSurfDescs = cSurfDescs * sizeof (DDSURFACEDESC); 1160 uint32_t cbBuf = offSurfDescs + cbSurfDescs; 1161 uint8_t* pvBuf = (uint8_t*)RTMemAllocZ(cbBuf); 1162 Assert(pvBuf); 1163 if (pvBuf) 1164 { 1165 pAdapter->paFormstOps = (FORMATOP*)pvBuf; 1166 memcpy (pAdapter->paFormstOps , gVBoxFormatOpsBase, sizeof (gVBoxFormatOpsBase)); 1167 pAdapter->cFormstOps = RT_ELEMENTS(gVBoxFormatOpsBase); 1168 1169 FORMATOP fo = {D3DDDIFMT_UNKNOWN, 0, 0, 0, 0}; 1170 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 1171 { 1172 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 1173 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 1174 { 1175 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 1176 { 1177 fo.Format = pVhwa->Settings.aFormats[j]; 1178 fo.Operations = FORMATOP_OVERLAY; 1179 int rc = vboxFormatOpsMerge(pAdapter->paFormstOps, &pAdapter->cFormstOps, cFormats, &fo); 1180 AssertRC(rc); 1181 } 1182 } 1183 } 1184 1185 pAdapter->paSurfDescs = (DDSURFACEDESC*)(pvBuf + offSurfDescs); 1186 memcpy (pAdapter->paSurfDescs , gVBoxSurfDescsBase, sizeof (gVBoxSurfDescsBase)); 1187 pAdapter->cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase); 1188 1189 DDSURFACEDESC sd; 1190 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 1191 { 1192 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 1193 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 1194 { 1195 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 1196 { 1197 uint32_t fourcc = vboxWddmFormatToFourcc(pVhwa->Settings.aFormats[j]); 1198 if (fourcc) 1199 { 1200 vboxVhwaPopulateOverlayFourccSurfDesc(&sd, fourcc); 1201 int rc = vboxSurfDescMerge(pAdapter->paSurfDescs, &pAdapter->cSurfDescs, cSurfDescs, &sd); 1202 AssertRC(rc); 1203 } 1204 } 1205 } 1206 } 1207 } 1208 else 1209 return VERR_OUT_OF_RESOURCES; 1210 } 1211 #endif 1212 1213 return VINF_SUCCESS; 1214 } 1215 1216 void vboxCapsFree(PVBOXWDDMDISP_ADAPTER pAdapter) 1217 { 1218 if (pAdapter->paFormstOps) 1219 RTMemFree(pAdapter->paFormstOps); 1220 } 444 #endif 1221 445 1222 446 static void vboxResourceFree(PVBOXWDDMDISP_RESOURCE pRc) … … 2496 1720 { 2497 1721 Params.pHgsmi = &pDevice->Uhgsmi.BasePrivate.Base; 2498 hr = pAdapter-> pD3D9If->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, fFlags, &Params.Base, &pDevice9If);1722 hr = pAdapter->D3D.pD3D9If->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, fFlags, &Params.Base, &pDevice9If); 2499 1723 Assert(hr == S_OK); 2500 1724 if (hr == S_OK) … … 2790 2014 if (FAILED(hr)) 2791 2015 return hr; 2792 hr = pDevice->pAdapter->D3D. pfnVBoxWineExD3DSwapchain9Present(pSwapchain->pSwapChainIf, pSurf);2016 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DSwapchain9Present(pSwapchain->pSwapChainIf, pSurf); 2793 2017 Assert(hr == S_OK); 2794 2018 pSurf->Release(); … … 2816 2040 VBOXVDBG_ASSERT_IS_DWM(FALSE); 2817 2041 2818 HRESULT hr = pDevice->pAdapter->D3D. pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If);2042 HRESULT hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If); 2819 2043 Assert(hr == S_OK); 2820 2044 … … 3027 2251 if (hr == S_OK) 3028 2252 { 2253 VBoxDispD3DGlobalInit(); 3029 2254 vboxVDbgPrint(("VBoxDispD3D: DLL loaded OK\n")); 3030 2255 return TRUE; … … 3056 2281 // VbglR3Term(); 3057 2282 /// @todo RTR3Term(); 2283 VBoxDispD3DGlobalTerm(); 3058 2284 return TRUE; 3059 2285 } … … 3067 2293 } 3068 2294 return FALSE; 3069 }3070 3071 static HRESULT vboxWddmGetD3D9Caps(PVBOXWDDMDISP_ADAPTER pAdapter, D3DCAPS9 *pCaps)3072 {3073 HRESULT hr = pAdapter->pD3D9If->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pCaps);3074 if (FAILED(hr))3075 {3076 WARN(("GetDeviceCaps failed hr(0x%x)",hr));3077 return hr;3078 }3079 3080 vboxDispDumpD3DCAPS9(pCaps);3081 3082 return S_OK;3083 2295 } 3084 2296 … … 3179 2391 } 3180 2392 case D3DDDICAPS_GETFORMATCOUNT: 3181 *((uint32_t*)pData->pData) = pAdapter-> cFormstOps;2393 *((uint32_t*)pData->pData) = pAdapter->Formats.cFormstOps; 3182 2394 break; 3183 2395 case D3DDDICAPS_GETFORMATDATA: 3184 Assert(pData->DataSize == pAdapter-> cFormstOps * sizeof (FORMATOP));3185 memcpy(pData->pData, pAdapter-> paFormstOps, pAdapter->cFormstOps * sizeof (FORMATOP));2396 Assert(pData->DataSize == pAdapter->Formats.cFormstOps * sizeof (FORMATOP)); 2397 memcpy(pData->pData, pAdapter->Formats.paFormstOps, pAdapter->Formats.cFormstOps * sizeof (FORMATOP)); 3186 2398 break; 3187 2399 case D3DDDICAPS_GETD3DQUERYCOUNT: … … 3290 2502 { 3291 2503 Assert(pData->DataSize == sizeof (D3DCAPS9)); 3292 // Assert(0);3293 2504 if (pData->DataSize >= sizeof (D3DCAPS9)) 3294 2505 { … … 3296 2507 if (VBOXDISPMODE_IS_3D(pAdapter)) 3297 2508 { 3298 D3DCAPS9* pCaps = (D3DCAPS9*)pData->pData; 3299 hr = vboxWddmGetD3D9Caps(pAdapter, pCaps); 3300 Assert(hr == S_OK); 3301 if (hr == S_OK) 3302 break; 3303 3304 vboxVDbgPrintR((__FUNCTION__": GetDeviceCaps Failed hr(%d)\n", hr)); 3305 /* let's fall back to the 3D disabled case */ 2509 memcpy(pData->pData, &pAdapter->D3D.Caps, sizeof (D3DCAPS9)); 3306 2510 hr = S_OK; 2511 break; 3307 2512 } 3308 2513 … … 3321 2526 if (VBOXDISPMODE_IS_3D(pAdapter)) 3322 2527 { 3323 D3DCAPS9 Caps9; 3324 hr = vboxWddmGetD3D9Caps(pAdapter, &Caps9); 3325 Assert(hr == S_OK); 3326 if (hr == S_OK) 3327 { 3328 memcpy(pData->pData, &Caps9, RT_OFFSETOF(D3DCAPS9, DevCaps2)); 3329 break; 3330 } 3331 3332 vboxVDbgPrintR((__FUNCTION__": GetDeviceCaps Failed hr(%d)\n", hr)); 3333 /* let's fall back to the 3D disabled case */ 2528 memcpy(pData->pData, &pAdapter->D3D.Caps, RT_OFFSETOF(D3DCAPS9, DevCaps2)); 3334 2529 hr = S_OK; 3335 }3336 2530 break; 2531 } 3337 2532 } 3338 2533 else … … 5255 4450 if (hr == S_OK) 5256 4451 { 5257 hr = pDevice->pAdapter->D3D. pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If,4452 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If, 5258 4453 pAllocation->D3DWidth, 5259 4454 pSurf->Height, … … 5325 4520 if (hr == S_OK) 5326 4521 { 5327 hr = pDevice->pAdapter->D3D. pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,4522 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If, 5328 4523 pAllocation->SurfDesc.width, 5329 4524 VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc), … … 5802 4997 { 5803 4998 5804 hr = pDevice->pAdapter->D3D. pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If);4999 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If); 5805 5000 Assert(hr == S_OK); 5806 5001 … … 6625 5820 * Release may not work in case of some leaking, which will leave the crOgl context refering the destroyed VBOXUHGSMI */ 6626 5821 if (pDevice->pDevice9If) 6627 pDevice->pAdapter->D3D. pfnVBoxWineExD3DDev9Term((IDirect3DDevice9Ex *)pDevice->pDevice9If);5822 pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9Term((IDirect3DDevice9Ex *)pDevice->pDevice9If); 6628 5823 } 6629 5824 … … 6996 6191 { 6997 6192 IDirect3DTexture9 *pD3DIfTex; 6998 hr = pDevice->pAdapter->D3D. pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If,6193 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If, 6999 6194 pAllocation->SurfDesc.width, 7000 6195 pAllocation->SurfDesc.height, … … 7032 6227 hr = E_INVALIDARG; 7033 6228 } 7034 hr = pDevice->pAdapter->D3D. pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,6229 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If, 7035 6230 pAllocation->SurfDesc.width, 7036 6231 VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc), … … 7129 6324 PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)hAdapter; 7130 6325 7131 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_DEVICE, apRTs[pAdapter-> cMaxSimRTs]));6326 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_DEVICE, apRTs[pAdapter->D3D.cMaxSimRTs])); 7132 6327 if (pDevice) 7133 6328 { 7134 pDevice->cRTs = pAdapter-> cMaxSimRTs;6329 pDevice->cRTs = pAdapter->D3D.cMaxSimRTs; 7135 6330 pDevice->hDevice = pCreateData->hDevice; 7136 6331 pDevice->pAdapter = pAdapter; … … 7361 6556 { 7362 6557 VBOXDISPCRHGSMI_SCOPE_SET_GLOBAL(); 7363 pAdapter->pD3D9If->Release(); 7364 VBoxDispD3DClose(&pAdapter->D3D); 7365 } 7366 7367 vboxCapsFree(pAdapter); 6558 VBoxDispD3DGlobalClose(&pAdapter->D3D, &pAdapter->Formats); 6559 } 6560 #ifdef VBOX_WITH_VIDEOHWACCEL 6561 else 6562 { 6563 VBoxDispD3DGlobal2DFormatsTerm(pAdapter); 6564 } 6565 #endif 7368 6566 7369 6567 VBOXDISPPROFILE_DDI_TERM(pAdapter); … … 7493 6691 VBOXDISPCRHGSMI_SCOPE_SET_GLOBAL(); 7494 6692 /* try enable the 3D */ 7495 #if 1 7496 hr = VBoxDispD3DOpen(&pAdapter->D3D); 7497 Assert(hr == S_OK); 7498 #else 7499 hr = E_FAIL; 7500 #endif 6693 hr = VBoxDispD3DGlobalOpen(&pAdapter->D3D, &pAdapter->Formats); 7501 6694 if (hr == S_OK) 7502 6695 { 7503 // Assert(0); 7504 hr = pAdapter->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pAdapter->pD3D9If); 7505 Assert(hr == S_OK); 7506 if (hr == S_OK) 7507 { 7508 D3DCAPS9 Caps; 7509 memset(&Caps, 0, sizeof (Caps)); 7510 hr = vboxWddmGetD3D9Caps(pAdapter, &Caps); 7511 Assert(hr == S_OK); 7512 if (hr == S_OK) 7513 { 7514 pAdapter->cMaxSimRTs = Caps.NumSimultaneousRTs; 7515 Assert(pAdapter->cMaxSimRTs); 7516 Assert(pAdapter->cMaxSimRTs < UINT32_MAX/2); 7517 vboxVDbgPrint((__FUNCTION__": SUCCESS 3D Enabled, pAdapter (0x%p)\n", pAdapter)); 7518 break; 7519 } 7520 pAdapter->pD3D9If->Release(); 7521 } 7522 else 7523 vboxVDbgPrintR((__FUNCTION__": pfnDirect3DCreate9Ex failed, hr (%d)\n", hr)); 7524 VBoxDispD3DClose(&pAdapter->D3D); 6696 LOG(("SUCCESS 3D Enabled, pAdapter (0x%p)", pAdapter)); 6697 break; 7525 6698 } 7526 6699 else 7527 vboxVDbgPrintR((__FUNCTION__": VBoxDispD3DOpen failed, hr (%d)\n", hr));6700 WARN(("VBoxDispD3DOpen failed, hr (%d)", hr)); 7528 6701 7529 6702 } … … 7537 6710 pAdapter->aHeads[i].Vhwa.Settings = Query.aInfos[i]; 7538 6711 } 7539 } 7540 #endif 7541 7542 vboxCapsInit(pAdapter); 7543 hr = S_OK; 7544 // RTMemFree(pAdapter); 7545 7546 VBOXDISPPROFILE_DDI_INIT_ADP(pAdapter); 6712 hr = VBoxDispD3DGlobal2DFormatsInit(pAdapter); 6713 if (!SUCCEEDED(hr)) 6714 { 6715 WARN(("VBoxDispD3DGlobal2DFormatsInit failed hr 0x%x", hr)); 6716 } 6717 } 6718 #endif 6719 6720 if (SUCCEEDED(hr)) 6721 { 6722 VBOXDISPPROFILE_DDI_INIT_ADP(pAdapter); 6723 hr = S_OK; 6724 break; 6725 } 6726 else 6727 { 6728 WARN(("OpenAdapter failed hr 0x%x", hr)); 6729 } 6730 6731 RTMemFree(pAdapter); 7547 6732 } 7548 6733 else -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h
r42499 r42557 76 76 UINT uIfVersion; 77 77 UINT uRtVersion; 78 VBOXDISPD3D D3D;79 IDirect3D9Ex * pD3D9If;80 78 D3DDDI_ADAPTERCALLBACKS RtCallbacks; 81 uint32_t cFormstOps; 82 FORMATOP *paFormstOps; 83 uint32_t cSurfDescs; 84 DDSURFACEDESC *paSurfDescs; 85 UINT cMaxSimRTs; 79 VBOXWDDMDISP_D3D D3D; 80 VBOXWDDMDISP_FORMATS Formats; 86 81 #ifdef VBOX_WDDMDISP_WITH_PROFILE 87 82 VBoxDispProfileFpsCounter ProfileDdiFps; … … 404 399 HRESULT vboxWddmUnlockRect(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc); 405 400 406 #define VBOXDISPMODE_IS_3D(_p) (!!((_p)-> pD3D9If))401 #define VBOXDISPMODE_IS_3D(_p) (!!((_p)->D3D.pD3D9If)) 407 402 #ifdef VBOXDISP_EARLYCREATEDEVICE 408 403 #define VBOXDISP_D3DEV(_p) (_p)->pDevice9If -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp
r42518 r42557 109 109 return E_FAIL; 110 110 } 111 112 113 114 static FORMATOP gVBoxFormatOps3D[] = { 115 {D3DDDIFMT_A8R8G8B8, 116 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 117 FORMATOP_SAME_FORMAT_RENDERTARGET| 118 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET| 119 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 120 FORMATOP_MEMBEROFGROUP_ARGB| 121 FORMATOP_SRGBWRITE|FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 122 123 {D3DDDIFMT_X8R8G8B8, 124 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 125 FORMATOP_SAME_FORMAT_RENDERTARGET| 126 FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION| 127 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 128 FORMATOP_MEMBEROFGROUP_ARGB| 129 FORMATOP_SRGBWRITE|FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 130 131 {D3DDDIFMT_A2R10G10B10, 132 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 133 FORMATOP_SAME_FORMAT_RENDERTARGET| 134 0| 135 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 136 FORMATOP_MEMBEROFGROUP_ARGB| 137 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 138 139 {D3DDDIFMT_X1R5G5B5, 140 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 141 FORMATOP_SAME_FORMAT_RENDERTARGET| 142 0| 143 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 144 FORMATOP_MEMBEROFGROUP_ARGB| 145 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 146 147 {D3DDDIFMT_A1R5G5B5, 148 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 149 FORMATOP_SAME_FORMAT_RENDERTARGET| 150 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET| 151 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 152 FORMATOP_MEMBEROFGROUP_ARGB| 153 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 154 155 {D3DDDIFMT_A4R4G4B4, 156 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 157 FORMATOP_SAME_FORMAT_RENDERTARGET| 158 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET| 159 FORMATOP_OFFSCREENPLAIN| 160 0| 161 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 162 163 {D3DDDIFMT_R5G6B5, 164 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 165 FORMATOP_SAME_FORMAT_RENDERTARGET| 166 FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION| 167 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 168 FORMATOP_MEMBEROFGROUP_ARGB| 169 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 170 171 {D3DDDIFMT_L16, 172 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 173 0| 174 0| 175 FORMATOP_OFFSCREENPLAIN| 176 0| 177 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 178 179 {D3DDDIFMT_A8L8, 180 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 181 0| 182 0| 183 FORMATOP_OFFSCREENPLAIN| 184 0| 185 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 186 187 {D3DDDIFMT_A8, 188 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 189 0| 190 0| 191 FORMATOP_OFFSCREENPLAIN| 192 0| 193 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 194 195 {D3DDDIFMT_L8, 196 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 197 0| 198 0| 199 FORMATOP_OFFSCREENPLAIN| 200 0| 201 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 202 203 {D3DDDIFMT_D16, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0}, 204 {D3DDDIFMT_D24S8, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0}, 205 {D3DDDIFMT_D24X8, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0}, 206 {D3DDDIFMT_D16_LOCKABLE, FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0}, 207 {D3DDDIFMT_X8D24, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0}, 208 {D3DDDIFMT_D32F_LOCKABLE, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0}, 209 {D3DDDIFMT_S8D24, FORMATOP_TEXTURE|FORMATOP_ZSTENCIL|FORMATOP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH, 0, 0, 0}, 210 211 {D3DDDIFMT_DXT1, 212 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE| 213 0| 214 0| 215 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 216 0| 217 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 218 219 {D3DDDIFMT_DXT2, 220 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE| 221 0| 222 0| 223 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 224 0| 225 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 226 227 {D3DDDIFMT_DXT3, 228 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE| 229 0| 230 0| 231 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 232 0| 233 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 234 235 {D3DDDIFMT_DXT4, 236 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE| 237 0| 238 0| 239 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 240 0| 241 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 242 243 {D3DDDIFMT_DXT5, 244 FORMATOP_TEXTURE|FORMATOP_CUBETEXTURE| 245 0| 246 0| 247 FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 248 0| 249 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 250 251 {D3DDDIFMT_X8L8V8U8, 252 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 253 0| 254 0| 255 0| 256 FORMATOP_BUMPMAP| 257 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 258 259 {D3DDDIFMT_A2W10V10U10, 260 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 261 0| 262 0| 263 0| 264 FORMATOP_BUMPMAP| 265 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 266 267 {D3DDDIFMT_V8U8, 268 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 269 0| 270 0| 271 0| 272 FORMATOP_BUMPMAP| 273 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 274 275 {D3DDDIFMT_Q8W8V8U8, 276 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 277 0| 278 0| 279 FORMATOP_OFFSCREENPLAIN| 280 FORMATOP_BUMPMAP| 281 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 282 283 {D3DDDIFMT_CxV8U8, FORMATOP_NOFILTER|FORMATOP_NOALPHABLEND|FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0}, 284 285 {D3DDDIFMT_R16F, 286 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 287 FORMATOP_SAME_FORMAT_RENDERTARGET| 288 0| 289 FORMATOP_OFFSCREENPLAIN| 290 0| 291 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 292 293 {D3DDDIFMT_R32F, 294 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 295 FORMATOP_SAME_FORMAT_RENDERTARGET| 296 0| 297 FORMATOP_OFFSCREENPLAIN| 298 0| 299 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 300 301 {D3DDDIFMT_G16R16F, 302 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 303 FORMATOP_SAME_FORMAT_RENDERTARGET| 304 0| 305 FORMATOP_OFFSCREENPLAIN| 306 0| 307 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 308 309 {D3DDDIFMT_G32R32F, 310 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 311 FORMATOP_SAME_FORMAT_RENDERTARGET| 312 0| 313 FORMATOP_OFFSCREENPLAIN| 314 0| 315 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 316 317 {D3DDDIFMT_A16B16G16R16F, 318 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 319 FORMATOP_SAME_FORMAT_RENDERTARGET| 320 0| 321 FORMATOP_OFFSCREENPLAIN| 322 0| 323 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 324 325 {D3DDDIFMT_A32B32G32R32F, 326 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 327 FORMATOP_SAME_FORMAT_RENDERTARGET| 328 0| 329 FORMATOP_OFFSCREENPLAIN| 330 0| 331 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 332 333 {D3DDDIFMT_G16R16, 334 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 335 FORMATOP_SAME_FORMAT_RENDERTARGET| 336 0| 337 FORMATOP_OFFSCREENPLAIN| 338 0| 339 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 340 341 {D3DDDIFMT_A16B16G16R16, 342 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 343 FORMATOP_SAME_FORMAT_RENDERTARGET| 344 0| 345 FORMATOP_OFFSCREENPLAIN| 346 0| 347 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 348 349 {D3DDDIFMT_V16U16, 350 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 351 0| 352 0| 353 0| 354 FORMATOP_BUMPMAP| 355 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 356 357 {D3DDDIFMT_P8, FORMATOP_DISPLAYMODE|FORMATOP_3DACCELERATION|FORMATOP_OFFSCREENPLAIN, 0, 0, 0}, 358 359 {D3DDDIFMT_UYVY, 360 0| 361 0| 362 0| 363 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 364 FORMATOP_NOFILTER| 365 FORMATOP_NOALPHABLEND| 366 FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0}, 367 368 {D3DDDIFMT_YUY2, 369 0| 370 0| 371 0| 372 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 373 FORMATOP_NOFILTER| 374 FORMATOP_NOALPHABLEND| 375 FORMATOP_NOTEXCOORDWRAPNORMIP, 0, 0, 0}, 376 377 {D3DDDIFMT_Q16W16V16U16, 378 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 379 FORMATOP_SAME_FORMAT_RENDERTARGET| 380 0| 381 FORMATOP_OFFSCREENPLAIN| 382 FORMATOP_BUMPMAP|FORMATOP_DMAP| 383 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 384 385 {D3DDDIFMT_X8B8G8R8, 386 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 387 FORMATOP_SAME_FORMAT_RENDERTARGET| 388 FORMATOP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET| 389 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN|FORMATOP_SRGBREAD| 390 FORMATOP_DMAP|FORMATOP_MEMBEROFGROUP_ARGB| 391 FORMATOP_SRGBWRITE|FORMATOP_AUTOGENMIPMAP|FORMATOP_VERTEXTEXTURE| 392 FORMATOP_OVERLAY, 0, 0, 0}, 393 394 {D3DDDIFMT_BINARYBUFFER, FORMATOP_OFFSCREENPLAIN, 0, 0, 0}, 395 396 {D3DDDIFMT_A4L4, 397 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE| 398 0| 399 0| 400 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 401 FORMATOP_DMAP| 402 FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 403 404 {D3DDDIFMT_A2B10G10R10, 405 FORMATOP_TEXTURE|FORMATOP_VOLUMETEXTURE|FORMATOP_CUBETEXTURE|FORMATOP_OFFSCREEN_RENDERTARGET| 406 FORMATOP_SAME_FORMAT_RENDERTARGET| 407 0| 408 FORMATOP_CONVERT_TO_ARGB|FORMATOP_OFFSCREENPLAIN| 409 FORMATOP_DMAP|FORMATOP_MEMBEROFGROUP_ARGB| 410 FORMATOP_AUTOGENMIPMAP|FORMATOP_VERTEXTEXTURE, 0, 0, 0}, 411 }; 412 413 static FORMATOP gVBoxFormatOpsBase[] = { 414 {D3DDDIFMT_X8R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0}, 415 416 {D3DDDIFMT_R8G8B8, FORMATOP_DISPLAYMODE, 0, 0, 0}, 417 418 {D3DDDIFMT_R5G6B5, FORMATOP_DISPLAYMODE, 0, 0, 0}, 419 420 {D3DDDIFMT_P8, FORMATOP_DISPLAYMODE, 0, 0, 0}, 421 }; 422 423 static DDSURFACEDESC gVBoxSurfDescsBase[] = { 424 { 425 sizeof (DDSURFACEDESC), /* DWORD dwSize; */ 426 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */ 427 0, /* DWORD dwHeight; */ 428 0, /* DWORD dwWidth; */ 429 { 430 0, /* Union */ 431 /* LONG lPitch; */ 432 /* DWORD dwLinearSize; */ 433 }, 434 0, /* DWORD dwBackBufferCount; */ 435 { 436 0, /* Union */ 437 /* DWORD dwMipMapCount; */ 438 /* DWORD dwZBufferBitDepth; */ 439 /* DWORD dwRefreshRate; */ 440 }, 441 0, /* DWORD dwAlphaBitDepth; */ 442 0, /* DWORD dwReserved; */ 443 NULL, /* LPVOID lpSurface; */ 444 { 445 0, /* DWORD dwColorSpaceLowValue; */ 446 0, /* DWORD dwColorSpaceHighValue; */ 447 }, /* DDCOLORKEY ddckCKDestOverlay; */ 448 { 449 0, /* DWORD dwColorSpaceLowValue; */ 450 0, /* DWORD dwColorSpaceHighValue; */ 451 }, /* DDCOLORKEY ddckCKDestBlt; */ 452 { 453 0, /* DWORD dwColorSpaceLowValue; */ 454 0, /* DWORD dwColorSpaceHighValue; */ 455 }, /* DDCOLORKEY ddckCKSrcOverlay; */ 456 { 457 0, /* DWORD dwColorSpaceLowValue; */ 458 0, /* DWORD dwColorSpaceHighValue; */ 459 }, /* DDCOLORKEY ddckCKSrcBlt; */ 460 { 461 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */ 462 DDPF_RGB, /* DWORD dwFlags; */ 463 0, /* DWORD dwFourCC; */ 464 { 465 32, /* union */ 466 /* DWORD dwRGBBitCount; */ 467 /* DWORD dwYUVBitCount; */ 468 /* DWORD dwZBufferBitDepth; */ 469 /* DWORD dwAlphaBitDepth; */ 470 /* DWORD dwLuminanceBitCount; */ 471 /* DWORD dwBumpBitCount; */ 472 }, 473 { 474 0xff0000, /* union */ 475 /* DWORD dwRBitMask; */ 476 /* DWORD dwYBitMask; */ 477 /* DWORD dwStencilBitDepth; */ 478 /* DWORD dwLuminanceBitMask; */ 479 /* DWORD dwBumpDuBitMask; */ 480 }, 481 { 482 0xff00, 483 /* DWORD dwGBitMask; */ 484 /* DWORD dwUBitMask; */ 485 /* DWORD dwZBitMask; */ 486 /* DWORD dwBumpDvBitMask; */ 487 }, 488 { 489 0xff, 490 /* DWORD dwBBitMask; */ 491 /* DWORD dwVBitMask; */ 492 /* DWORD dwStencilBitMask; */ 493 /* DWORD dwBumpLuminanceBitMask; */ 494 }, 495 { 496 0, 497 /* DWORD dwRGBAlphaBitMask; */ 498 /* DWORD dwYUVAlphaBitMask; */ 499 /* DWORD dwLuminanceAlphaBitMask; */ 500 /* DWORD dwRGBZBitMask; */ 501 /* DWORD dwYUVZBitMask; */ 502 }, 503 }, /* DDPIXELFORMAT ddpfPixelFormat; */ 504 { 505 DDSCAPS_BACKBUFFER 506 | DDSCAPS_COMPLEX 507 | DDSCAPS_FLIP 508 | DDSCAPS_FRONTBUFFER 509 | DDSCAPS_LOCALVIDMEM 510 | DDSCAPS_PRIMARYSURFACE 511 | DDSCAPS_VIDEOMEMORY 512 | DDSCAPS_VISIBLE /* DWORD dwCaps; */ 513 } /* DDSCAPS ddsCaps; */ 514 }, 515 { 516 sizeof (DDSURFACEDESC), /* DWORD dwSize; */ 517 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */ 518 0, /* DWORD dwHeight; */ 519 0, /* DWORD dwWidth; */ 520 { 521 0, /* Union */ 522 /* LONG lPitch; */ 523 /* DWORD dwLinearSize; */ 524 }, 525 0, /* DWORD dwBackBufferCount; */ 526 { 527 0, /* Union */ 528 /* DWORD dwMipMapCount; */ 529 /* DWORD dwZBufferBitDepth; */ 530 /* DWORD dwRefreshRate; */ 531 }, 532 0, /* DWORD dwAlphaBitDepth; */ 533 0, /* DWORD dwReserved; */ 534 NULL, /* LPVOID lpSurface; */ 535 { 536 0, /* DWORD dwColorSpaceLowValue; */ 537 0, /* DWORD dwColorSpaceHighValue; */ 538 }, /* DDCOLORKEY ddckCKDestOverlay; */ 539 { 540 0, /* DWORD dwColorSpaceLowValue; */ 541 0, /* DWORD dwColorSpaceHighValue; */ 542 }, /* DDCOLORKEY ddckCKDestBlt; */ 543 { 544 0, /* DWORD dwColorSpaceLowValue; */ 545 0, /* DWORD dwColorSpaceHighValue; */ 546 }, /* DDCOLORKEY ddckCKSrcOverlay; */ 547 { 548 0, /* DWORD dwColorSpaceLowValue; */ 549 0, /* DWORD dwColorSpaceHighValue; */ 550 }, /* DDCOLORKEY ddckCKSrcBlt; */ 551 { 552 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */ 553 DDPF_RGB, /* DWORD dwFlags; */ 554 0, /* DWORD dwFourCC; */ 555 { 556 24, /* union */ 557 /* DWORD dwRGBBitCount; */ 558 /* DWORD dwYUVBitCount; */ 559 /* DWORD dwZBufferBitDepth; */ 560 /* DWORD dwAlphaBitDepth; */ 561 /* DWORD dwLuminanceBitCount; */ 562 /* DWORD dwBumpBitCount; */ 563 }, 564 { 565 0xff0000, /* union */ 566 /* DWORD dwRBitMask; */ 567 /* DWORD dwYBitMask; */ 568 /* DWORD dwStencilBitDepth; */ 569 /* DWORD dwLuminanceBitMask; */ 570 /* DWORD dwBumpDuBitMask; */ 571 }, 572 { 573 0xff00, 574 /* DWORD dwGBitMask; */ 575 /* DWORD dwUBitMask; */ 576 /* DWORD dwZBitMask; */ 577 /* DWORD dwBumpDvBitMask; */ 578 }, 579 { 580 0xff, 581 /* DWORD dwBBitMask; */ 582 /* DWORD dwVBitMask; */ 583 /* DWORD dwStencilBitMask; */ 584 /* DWORD dwBumpLuminanceBitMask; */ 585 }, 586 { 587 0, 588 /* DWORD dwRGBAlphaBitMask; */ 589 /* DWORD dwYUVAlphaBitMask; */ 590 /* DWORD dwLuminanceAlphaBitMask; */ 591 /* DWORD dwRGBZBitMask; */ 592 /* DWORD dwYUVZBitMask; */ 593 }, 594 }, /* DDPIXELFORMAT ddpfPixelFormat; */ 595 { 596 DDSCAPS_BACKBUFFER 597 | DDSCAPS_COMPLEX 598 | DDSCAPS_FLIP 599 | DDSCAPS_FRONTBUFFER 600 | DDSCAPS_LOCALVIDMEM 601 | DDSCAPS_PRIMARYSURFACE 602 | DDSCAPS_VIDEOMEMORY 603 | DDSCAPS_VISIBLE /* DWORD dwCaps; */ 604 } /* DDSCAPS ddsCaps; */ 605 }, 606 { 607 sizeof (DDSURFACEDESC), /* DWORD dwSize; */ 608 DDSD_CAPS | DDSD_PIXELFORMAT, /* DWORD dwFlags; */ 609 0, /* DWORD dwHeight; */ 610 0, /* DWORD dwWidth; */ 611 { 612 0, /* Union */ 613 /* LONG lPitch; */ 614 /* DWORD dwLinearSize; */ 615 }, 616 0, /* DWORD dwBackBufferCount; */ 617 { 618 0, /* Union */ 619 /* DWORD dwMipMapCount; */ 620 /* DWORD dwZBufferBitDepth; */ 621 /* DWORD dwRefreshRate; */ 622 }, 623 0, /* DWORD dwAlphaBitDepth; */ 624 0, /* DWORD dwReserved; */ 625 NULL, /* LPVOID lpSurface; */ 626 { 627 0, /* DWORD dwColorSpaceLowValue; */ 628 0, /* DWORD dwColorSpaceHighValue; */ 629 }, /* DDCOLORKEY ddckCKDestOverlay; */ 630 { 631 0, /* DWORD dwColorSpaceLowValue; */ 632 0, /* DWORD dwColorSpaceHighValue; */ 633 }, /* DDCOLORKEY ddckCKDestBlt; */ 634 { 635 0, /* DWORD dwColorSpaceLowValue; */ 636 0, /* DWORD dwColorSpaceHighValue; */ 637 }, /* DDCOLORKEY ddckCKSrcOverlay; */ 638 { 639 0, /* DWORD dwColorSpaceLowValue; */ 640 0, /* DWORD dwColorSpaceHighValue; */ 641 }, /* DDCOLORKEY ddckCKSrcBlt; */ 642 { 643 sizeof (DDPIXELFORMAT), /* DWORD dwSize; */ 644 DDPF_RGB, /* DWORD dwFlags; */ 645 0, /* DWORD dwFourCC; */ 646 { 647 16, /* union */ 648 /* DWORD dwRGBBitCount; */ 649 /* DWORD dwYUVBitCount; */ 650 /* DWORD dwZBufferBitDepth; */ 651 /* DWORD dwAlphaBitDepth; */ 652 /* DWORD dwLuminanceBitCount; */ 653 /* DWORD dwBumpBitCount; */ 654 }, 655 { 656 0xf800, /* union */ 657 /* DWORD dwRBitMask; */ 658 /* DWORD dwYBitMask; */ 659 /* DWORD dwStencilBitDepth; */ 660 /* DWORD dwLuminanceBitMask; */ 661 /* DWORD dwBumpDuBitMask; */ 662 }, 663 { 664 0x7e0, 665 /* DWORD dwGBitMask; */ 666 /* DWORD dwUBitMask; */ 667 /* DWORD dwZBitMask; */ 668 /* DWORD dwBumpDvBitMask; */ 669 }, 670 { 671 0x1f, 672 /* DWORD dwBBitMask; */ 673 /* DWORD dwVBitMask; */ 674 /* DWORD dwStencilBitMask; */ 675 /* DWORD dwBumpLuminanceBitMask; */ 676 }, 677 { 678 0, 679 /* DWORD dwRGBAlphaBitMask; */ 680 /* DWORD dwYUVAlphaBitMask; */ 681 /* DWORD dwLuminanceAlphaBitMask; */ 682 /* DWORD dwRGBZBitMask; */ 683 /* DWORD dwYUVZBitMask; */ 684 }, 685 }, /* DDPIXELFORMAT ddpfPixelFormat; */ 686 { 687 DDSCAPS_BACKBUFFER 688 | DDSCAPS_COMPLEX 689 | DDSCAPS_FLIP 690 | DDSCAPS_FRONTBUFFER 691 | DDSCAPS_LOCALVIDMEM 692 | DDSCAPS_PRIMARYSURFACE 693 | DDSCAPS_VIDEOMEMORY 694 | DDSCAPS_VISIBLE /* DWORD dwCaps; */ 695 } /* DDSCAPS ddsCaps; */ 696 }, 697 }; 698 699 #ifdef VBOX_WITH_VIDEOHWACCEL 700 701 static void vboxVhwaPopulateOverlayFourccSurfDesc(DDSURFACEDESC *pDesc, uint32_t fourcc) 702 { 703 memset(pDesc, 0, sizeof (DDSURFACEDESC)); 704 705 pDesc->dwSize = sizeof (DDSURFACEDESC); 706 pDesc->dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT; 707 pDesc->ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT); 708 pDesc->ddpfPixelFormat.dwFlags = DDPF_FOURCC; 709 pDesc->ddpfPixelFormat.dwFourCC = fourcc; 710 pDesc->ddsCaps.dwCaps = DDSCAPS_BACKBUFFER 711 | DDSCAPS_COMPLEX 712 | DDSCAPS_FLIP 713 | DDSCAPS_FRONTBUFFER 714 | DDSCAPS_LOCALVIDMEM 715 | DDSCAPS_OVERLAY 716 | DDSCAPS_VIDEOMEMORY 717 | DDSCAPS_VISIBLE; 718 } 719 720 static bool vboxPixFormatMatch(DDPIXELFORMAT *pFormat1, DDPIXELFORMAT *pFormat2) 721 { 722 return !memcmp(pFormat1, pFormat2, sizeof (DDPIXELFORMAT)); 723 } 724 725 HRESULT vboxSurfDescMerge(DDSURFACEDESC *paDescs, uint32_t *pcDescs, uint32_t cMaxDescs, DDSURFACEDESC *pDesc) 726 { 727 uint32_t cDescs = *pcDescs; 728 729 Assert(cMaxDescs >= cDescs); 730 Assert(pDesc->dwFlags == (DDSD_CAPS | DDSD_PIXELFORMAT)); 731 if (pDesc->dwFlags != (DDSD_CAPS | DDSD_PIXELFORMAT)) 732 return E_INVALIDARG; 733 734 for (uint32_t i = 0; i < cDescs; ++i) 735 { 736 DDSURFACEDESC *pCur = &paDescs[i]; 737 if (vboxPixFormatMatch(&pCur->ddpfPixelFormat, &pDesc->ddpfPixelFormat)) 738 { 739 if (pDesc->dwFlags & DDSD_CAPS) 740 { 741 pCur->dwFlags |= DDSD_CAPS; 742 pCur->ddsCaps.dwCaps |= pDesc->ddsCaps.dwCaps; 743 } 744 return S_OK; 745 } 746 } 747 748 if (cMaxDescs > cDescs) 749 { 750 paDescs[cDescs] = *pDesc; 751 ++cDescs; 752 *pcDescs = cDescs; 753 return VINF_SUCCESS; 754 } 755 return E_FAIL; 756 } 757 758 HRESULT vboxFormatOpsMerge(FORMATOP *paOps, uint32_t *pcOps, uint32_t cMaxOps, FORMATOP *pOp) 759 { 760 uint32_t cOps = *pcOps; 761 762 Assert(cMaxOps >= cOps); 763 764 for (uint32_t i = 0; i < cOps; ++i) 765 { 766 FORMATOP *pCur = &paOps[i]; 767 if (pCur->Format == pOp->Format) 768 { 769 pCur->Operations |= pOp->Operations; 770 Assert(pCur->FlipMsTypes == pOp->FlipMsTypes); 771 Assert(pCur->BltMsTypes == pOp->BltMsTypes); 772 Assert(pCur->PrivateFormatBitCount == pOp->PrivateFormatBitCount); 773 return S_OK; 774 } 775 } 776 777 if (cMaxOps > cOps) 778 { 779 paOps[cOps] = *pOp; 780 ++cOps; 781 *pcOps = cOps; 782 return VINF_SUCCESS; 783 } 784 return E_FAIL; 785 } 786 787 HRESULT VBoxDispD3DGlobal2DFormatsInit(PVBOXWDDMDISP_ADAPTER pAdapter) 788 { 789 HRESULT hr = S_OK; 790 memset(&pAdapter->D3D, 0, sizeof (pAdapter->D3D)); 791 memset(&pAdapter->Formats, 0, sizeof (pAdapter->Formats)); 792 793 /* just calc the max number of formats */ 794 uint32_t cFormats = RT_ELEMENTS(gVBoxFormatOpsBase); 795 uint32_t cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase); 796 uint32_t cOverlayFormats = 0; 797 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 798 { 799 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 800 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 801 { 802 cOverlayFormats += pVhwa->Settings.cFormats; 803 } 804 } 805 806 cFormats += cOverlayFormats; 807 cSurfDescs += cOverlayFormats; 808 809 uint32_t cbFormatOps = cFormats * sizeof (FORMATOP); 810 cbFormatOps = (cbFormatOps + 7) & ~3; 811 /* ensure the surf descs are 8 byte aligned */ 812 uint32_t offSurfDescs = (cbFormatOps + 7) & ~3; 813 uint32_t cbSurfDescs = cSurfDescs * sizeof (DDSURFACEDESC); 814 uint32_t cbBuf = offSurfDescs + cbSurfDescs; 815 uint8_t* pvBuf = (uint8_t*)RTMemAllocZ(cbBuf); 816 if (pvBuf) 817 { 818 pAdapter->Formats.paFormstOps = (FORMATOP*)pvBuf; 819 memcpy ((void*)pAdapter->Formats.paFormstOps , gVBoxFormatOpsBase, sizeof (gVBoxFormatOpsBase)); 820 pAdapter->Formats.cFormstOps = RT_ELEMENTS(gVBoxFormatOpsBase); 821 822 FORMATOP fo = {D3DDDIFMT_UNKNOWN, 0, 0, 0, 0}; 823 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 824 { 825 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 826 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 827 { 828 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 829 { 830 fo.Format = pVhwa->Settings.aFormats[j]; 831 fo.Operations = FORMATOP_OVERLAY; 832 hr = vboxFormatOpsMerge((FORMATOP *)pAdapter->Formats.paFormstOps, &pAdapter->Formats.cFormstOps, cFormats, &fo); 833 if (FAILED(hr)) 834 { 835 WARN(("vboxFormatOpsMerge failed, hr 0x%x", hr)); 836 } 837 } 838 } 839 } 840 841 pAdapter->Formats.paSurfDescs = (DDSURFACEDESC*)(pvBuf + offSurfDescs); 842 memcpy ((void*)pAdapter->Formats.paSurfDescs , gVBoxSurfDescsBase, sizeof (gVBoxSurfDescsBase)); 843 pAdapter->Formats.cSurfDescs = RT_ELEMENTS(gVBoxSurfDescsBase); 844 845 DDSURFACEDESC sd; 846 for (uint32_t i = 0; i < pAdapter->cHeads; ++i) 847 { 848 VBOXDISPVHWA_INFO *pVhwa = &pAdapter->aHeads[i].Vhwa; 849 if (pVhwa->Settings.fFlags & VBOXVHWA_F_ENABLED) 850 { 851 for (uint32_t j = 0; j < pVhwa->Settings.cFormats; ++j) 852 { 853 uint32_t fourcc = vboxWddmFormatToFourcc(pVhwa->Settings.aFormats[j]); 854 if (fourcc) 855 { 856 vboxVhwaPopulateOverlayFourccSurfDesc(&sd, fourcc); 857 hr = vboxSurfDescMerge((DDSURFACEDESC *)pAdapter->Formats.paSurfDescs, &pAdapter->Formats.cSurfDescs, cSurfDescs, &sd); 858 if (FAILED(hr)) 859 { 860 WARN(("vboxFormatOpsMerge failed, hr 0x%x", hr)); 861 } 862 } 863 } 864 } 865 } 866 } 867 else 868 { 869 WARN(("RTMemAllocZ failed")); 870 return E_FAIL; 871 } 872 return S_OK; 873 } 874 875 void VBoxDispD3DGlobal2DFormatsTerm(PVBOXWDDMDISP_ADAPTER pAdapter) 876 { 877 if (pAdapter->Formats.paFormstOps) 878 RTMemFree((void *)pAdapter->Formats.paFormstOps); 879 } 880 881 #endif 882 883 static CRITICAL_SECTION g_VBoxDispD3DGlobalCritSect; 884 static VBOXWDDMDISP_D3D g_VBoxDispD3DGlobalD3D; 885 static VBOXWDDMDISP_FORMATS g_VBoxDispD3DGlobalD3DFormats; 886 static uint32_t g_cVBoxDispD3DGlobalOpens; 887 888 void vboxDispD3DGlobalLock() 889 { 890 EnterCriticalSection(&g_VBoxDispD3DGlobalCritSect); 891 } 892 893 void vboxDispD3DGlobalUnlock() 894 { 895 LeaveCriticalSection(&g_VBoxDispD3DGlobalCritSect); 896 } 897 898 void VBoxDispD3DGlobalInit() 899 { 900 g_cVBoxDispD3DGlobalOpens = 0; 901 InitializeCriticalSection(&g_VBoxDispD3DGlobalCritSect); 902 } 903 904 void VBoxDispD3DGlobalTerm() 905 { 906 DeleteCriticalSection(&g_VBoxDispD3DGlobalCritSect); 907 } 908 909 static void vboxDispD3DGlobalD3DFormatsInit(PVBOXWDDMDISP_FORMATS pFormats) 910 { 911 memset(pFormats, 0, sizeof (pFormats)); 912 pFormats->paFormstOps = gVBoxFormatOps3D; 913 pFormats->cFormstOps = RT_ELEMENTS(gVBoxFormatOps3D); 914 } 915 916 static HRESULT vboxWddmGetD3D9Caps(PVBOXWDDMDISP_D3D pD3D, D3DCAPS9 *pCaps) 917 { 918 HRESULT hr = pD3D->pD3D9If->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pCaps); 919 if (FAILED(hr)) 920 { 921 WARN(("GetDeviceCaps failed hr(0x%x)",hr)); 922 return hr; 923 } 924 925 vboxDispDumpD3DCAPS9(pCaps); 926 927 return S_OK; 928 } 929 930 static void vboxDispD3DGlobalDoClose(PVBOXWDDMDISP_D3D pD3D) 931 { 932 pD3D->pD3D9If->Release(); 933 VBoxDispD3DClose(&pD3D->D3D); 934 } 935 936 static HRESULT vboxDispD3DGlobalDoOpen(PVBOXWDDMDISP_D3D pD3D) 937 { 938 memset(pD3D, 0, sizeof (*pD3D)); 939 HRESULT hr = VBoxDispD3DOpen(&pD3D->D3D); 940 if (SUCCEEDED(hr)) 941 { 942 hr = pD3D->D3D.pfnDirect3DCreate9Ex(D3D_SDK_VERSION, &pD3D->pD3D9If); 943 if (SUCCEEDED(hr)) 944 { 945 hr = vboxWddmGetD3D9Caps(pD3D, &pD3D->Caps); 946 if (SUCCEEDED(hr)) 947 { 948 pD3D->cMaxSimRTs = pD3D->Caps.NumSimultaneousRTs; 949 Assert(pD3D->cMaxSimRTs); 950 Assert(pD3D->cMaxSimRTs < UINT32_MAX/2); 951 LOG(("SUCCESS 3D Enabled, pD3D (0x%p)", pD3D)); 952 return S_OK; 953 } 954 else 955 { 956 WARN(("vboxWddmGetD3D9Caps failed hr = 0x%x", hr)); 957 } 958 pD3D->pD3D9If->Release(); 959 } 960 else 961 { 962 WARN(("pfnDirect3DCreate9Ex failed hr = 0x%x", hr)); 963 } 964 VBoxDispD3DClose(&pD3D->D3D); 965 } 966 else 967 { 968 WARN(("VBoxDispD3DOpen failed hr = 0x%x", hr)); 969 } 970 return hr; 971 } 972 973 HRESULT VBoxDispD3DGlobalOpen(PVBOXWDDMDISP_D3D pD3D, PVBOXWDDMDISP_FORMATS pFormats) 974 { 975 vboxDispD3DGlobalLock(); 976 if (!g_cVBoxDispD3DGlobalOpens) 977 { 978 HRESULT hr = vboxDispD3DGlobalDoOpen(&g_VBoxDispD3DGlobalD3D); 979 if (!SUCCEEDED(hr)) 980 { 981 WARN(("vboxDispD3DGlobalDoOpen failed hr = 0x%x", hr)); 982 return hr; 983 } 984 985 vboxDispD3DGlobalD3DFormatsInit(&g_VBoxDispD3DGlobalD3DFormats); 986 } 987 ++g_cVBoxDispD3DGlobalOpens; 988 vboxDispD3DGlobalUnlock(); 989 990 *pD3D = g_VBoxDispD3DGlobalD3D; 991 *pFormats = g_VBoxDispD3DGlobalD3DFormats; 992 return S_OK; 993 } 994 995 void VBoxDispD3DGlobalClose(PVBOXWDDMDISP_D3D pD3D, PVBOXWDDMDISP_FORMATS pFormats) 996 { 997 vboxDispD3DGlobalLock(); 998 --g_cVBoxDispD3DGlobalOpens; 999 if (!g_cVBoxDispD3DGlobalOpens) 1000 { 1001 vboxDispD3DGlobalDoClose(&g_VBoxDispD3DGlobalD3D); 1002 } 1003 vboxDispD3DGlobalUnlock(); 1004 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h
r42518 r42557 73 73 } VBOXDISPD3D; 74 74 75 typedef struct VBOXWDDMDISP_FORMATS 76 { 77 uint32_t cFormstOps; 78 const struct _FORMATOP* paFormstOps; 79 uint32_t cSurfDescs; 80 struct _DDSURFACEDESC *paSurfDescs; 81 } VBOXWDDMDISP_FORMATS, *PVBOXWDDMDISP_FORMATS; 82 83 typedef struct VBOXWDDMDISP_D3D 84 { 85 VBOXDISPD3D D3D; 86 IDirect3D9Ex * pD3D9If; 87 D3DCAPS9 Caps; 88 UINT cMaxSimRTs; 89 } VBOXWDDMDISP_D3D, *PVBOXWDDMDISP_D3D; 90 91 void VBoxDispD3DGlobalInit(); 92 void VBoxDispD3DGlobalTerm(); 93 HRESULT VBoxDispD3DGlobalOpen(PVBOXWDDMDISP_D3D pD3D, PVBOXWDDMDISP_FORMATS pFormats); 94 void VBoxDispD3DGlobalClose(PVBOXWDDMDISP_D3D pD3D, PVBOXWDDMDISP_FORMATS pFormats); 95 75 96 HRESULT VBoxDispD3DOpen(VBOXDISPD3D *pD3D); 76 97 void VBoxDispD3DClose(VBOXDISPD3D *pD3D); 77 98 99 #ifdef VBOX_WITH_VIDEOHWACCEL 100 HRESULT VBoxDispD3DGlobal2DFormatsInit(struct VBOXWDDMDISP_ADAPTER *pAdapter); 101 void VBoxDispD3DGlobal2DFormatsTerm(struct VBOXWDDMDISP_ADAPTER *pAdapter); 102 #endif 103 78 104 #endif /* ifndef ___VBoxDispD3DIf_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.