Changeset 93357 in vbox for trunk/src/VBox
- Timestamp:
- Jan 20, 2022 10:59:39 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp
r93115 r93357 44 44 #include <d3d11.h> 45 45 46 47 #ifdef RT_OS_WINDOWS 48 # define VBOX_D3D11_LIBRARY_NAME "d3d11" 49 #else 50 # define VBOX_D3D11_LIBRARY_NAME "VBoxDxVk" 51 #endif 52 53 /* This is not available on non Windows hosts. */ 54 #ifndef D3D_RELEASE 55 # define D3D_RELEASE(a_Ptr) do { if ((a_Ptr)) (a_Ptr)->Release(); (a_Ptr) = NULL; } while (0) 56 #endif 46 57 47 58 /** Fake ID for the backend DX context. The context creates all shared textures. */ … … 217 228 static int dxDeviceFlush(DXDEVICE *pDevice); 218 229 static DECLCALLBACK(void) vmsvga3dBackSurfaceDestroy(PVGASTATECC pThisCC, PVMSVGA3DSURFACE pSurface); 230 231 232 /* This is not available with the DXVK headers for some reason. */ 233 #ifndef RT_OS_WINDOWS 234 typedef enum D3D11_TEXTURECUBE_FACE { 235 D3D11_TEXTURECUBE_FACE_POSITIVE_X, 236 D3D11_TEXTURECUBE_FACE_NEGATIVE_X, 237 D3D11_TEXTURECUBE_FACE_POSITIVE_Y, 238 D3D11_TEXTURECUBE_FACE_NEGATIVE_Y, 239 D3D11_TEXTURECUBE_FACE_POSITIVE_Z, 240 D3D11_TEXTURECUBE_FACE_NEGATIVE_Z 241 } D3D11_TEXTURECUBE_FACE; 242 #endif 219 243 220 244 … … 1000 1024 AssertReturn(pState, VERR_INVALID_STATE); 1001 1025 1002 for ( inti = 0; i < RT_ELEMENTS(pDXContext->svgaDXContext.renderState.renderTargetViewIds); ++i)1026 for (unsigned long i = 0; i < RT_ELEMENTS(pDXContext->svgaDXContext.renderState.renderTargetViewIds); ++i) 1003 1027 { 1004 1028 uint32_t const renderTargetViewId = pDXContext->svgaDXContext.renderState.renderTargetViewIds[i]; … … 2316 2340 } 2317 2341 2342 #if 0 /*unused*/ 2318 2343 /** @todo Not needed */ 2319 2344 static int vmsvga3dBackSurfaceCreateConstantBuffer(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, PVMSVGA3DSURFACE pSurface) … … 2481 2506 return VERR_NO_MEMORY; 2482 2507 } 2508 #endif 2483 2509 2484 2510 … … 2524 2550 RT_NOREF(pDevIns, pThis); 2525 2551 2552 int rc; 2553 #ifdef RT_OS_LINUX /** @todo Remove, this is currently needed for loading the X11 library in order to call XInitThreads(). */ 2554 rc = glLdrInit(pDevIns); 2555 if (RT_FAILURE(rc)) 2556 { 2557 LogRel(("VMSVGA3d: Error loading OpenGL library and resolving necessary functions: %Rrc\n", rc)); 2558 return rc; 2559 } 2560 #endif 2561 2526 2562 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)RTMemAllocZ(sizeof(VMSVGA3DSTATE)); 2527 2563 AssertReturn(pState, VERR_NO_MEMORY); … … 2532 2568 pState->pBackend = pBackend; 2533 2569 2534 int rc = RTLdrLoadSystem("d3d11", /* fNoUnload = */ true, &pBackend->hD3D11);2570 rc = RTLdrLoadSystem(VBOX_D3D11_LIBRARY_NAME, /* fNoUnload = */ true, &pBackend->hD3D11); 2535 2571 AssertRC(rc); 2536 2572 if (RT_SUCCESS(rc)) … … 2602 2638 2603 2639 2640 /** @todo Such structures must be in VBoxVideo3D.h */ 2641 typedef struct VBOX3DNOTIFYDEFINESCREEN 2642 { 2643 VBOX3DNOTIFY Core; 2644 uint32_t cWidth; 2645 uint32_t cHeight; 2646 int32_t xRoot; 2647 int32_t yRoot; 2648 uint32_t fPrimary; 2649 uint32_t cDpi; 2650 } VBOX3DNOTIFYDEFINESCREEN; 2651 2652 2604 2653 static int vmsvga3dDrvNotifyDefineScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen) 2605 2654 { 2606 /** @todo Such structures must be in VBoxVideo3D.h */2607 typedef struct VBOX3DNOTIFYDEFINESCREEN2608 {2609 VBOX3DNOTIFY Core;2610 uint32_t cWidth;2611 uint32_t cHeight;2612 int32_t xRoot;2613 int32_t yRoot;2614 uint32_t fPrimary;2615 uint32_t cDpi;2616 } VBOX3DNOTIFYDEFINESCREEN;2617 2618 2655 VBOX3DNOTIFYDEFINESCREEN n; 2619 2656 n.Core.enmNotification = VBOX3D_NOTIFY_TYPE_HW_SCREEN_CREATED; … … 2659 2696 2660 2697 2698 typedef struct VBOX3DNOTIFYUPDATE 2699 { 2700 VBOX3DNOTIFY Core; 2701 uint32_t x; 2702 uint32_t y; 2703 uint32_t w; 2704 uint32_t h; 2705 } VBOX3DNOTIFYUPDATE; 2706 2707 2661 2708 static int vmsvga3dDrvNotifyUpdate(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen, 2662 2709 uint32_t x, uint32_t y, uint32_t w, uint32_t h) 2663 2710 { 2664 typedef struct VBOX3DNOTIFYUPDATE2665 {2666 VBOX3DNOTIFY Core;2667 uint32_t x;2668 uint32_t y;2669 uint32_t w;2670 uint32_t h;2671 } VBOX3DNOTIFYUPDATE;2672 2673 2711 VBOX3DNOTIFYUPDATE n; 2674 2712 n.Core.enmNotification = VBOX3D_NOTIFY_TYPE_HW_SCREEN_UPDATE_END; … … 3310 3348 /* Copy the screen texture to the shared surface. */ 3311 3349 DWORD result = pHwScreen->pDXGIKeyedMutex->AcquireSync(0, 10000); 3312 if (result == WAIT_OBJECT_0)3350 if (result == S_OK) 3313 3351 { 3314 3352 pBackend->device.pImmediateContext->CopyResource(pHwScreen->pTexture, pBackendSurface->u.pTexture2D); … … 4020 4058 4021 4059 4060 #if 0 /*unused*/ 4022 4061 /** 4023 4062 * Create a new 3d context … … 4285 4324 return VINF_SUCCESS; 4286 4325 } 4326 #endif 4287 4327 4288 4328 … … 4583 4623 4584 4624 4625 #if 0 /*unused*/ 4585 4626 static DECLCALLBACK(int) vmsvga3dBackOcclusionQueryCreate(PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext) 4586 4627 { … … 4622 4663 return VINF_SUCCESS; 4623 4664 } 4665 #endif 4624 4666 4625 4667 … … 5572 5614 5573 5615 pDXContext->svgaDXContext.renderState.blendStateId = blendId; 5574 memcpy(pDXContext->svgaDXContext.renderState.blendFactor, blendFactor, sizeof(blendFactor)); 5616 pDXContext->svgaDXContext.renderState.blendFactor[0] = blendFactor[0]; 5617 pDXContext->svgaDXContext.renderState.blendFactor[1] = blendFactor[1]; 5618 pDXContext->svgaDXContext.renderState.blendFactor[2] = blendFactor[2]; 5619 pDXContext->svgaDXContext.renderState.blendFactor[3] = blendFactor[3]; 5575 5620 pDXContext->svgaDXContext.renderState.sampleMask = sampleMask; 5576 5621
Note:
See TracChangeset
for help on using the changeset viewer.