VirtualBox

Changeset 93357 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 20, 2022 10:59:39 AM (3 years ago)
Author:
vboxsync
Message:

Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp: Some compile fixes on non Windows hosts, bugref:10013

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp

    r93115 r93357  
    4444#include <d3d11.h>
    4545
     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
    4657
    4758/** Fake ID for the backend DX context. The context creates all shared textures. */
     
    217228static int dxDeviceFlush(DXDEVICE *pDevice);
    218229static 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
     234typedef 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
    219243
    220244
     
    10001024    AssertReturn(pState, VERR_INVALID_STATE);
    10011025
    1002     for (int i = 0; i < RT_ELEMENTS(pDXContext->svgaDXContext.renderState.renderTargetViewIds); ++i)
     1026    for (unsigned long i = 0; i < RT_ELEMENTS(pDXContext->svgaDXContext.renderState.renderTargetViewIds); ++i)
    10031027    {
    10041028        uint32_t const renderTargetViewId = pDXContext->svgaDXContext.renderState.renderTargetViewIds[i];
     
    23162340}
    23172341
     2342#if 0 /*unused*/
    23182343/** @todo Not needed */
    23192344static int vmsvga3dBackSurfaceCreateConstantBuffer(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, PVMSVGA3DSURFACE pSurface)
     
    24812506    return VERR_NO_MEMORY;
    24822507}
     2508#endif
    24832509
    24842510
     
    25242550    RT_NOREF(pDevIns, pThis);
    25252551
     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
    25262562    PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)RTMemAllocZ(sizeof(VMSVGA3DSTATE));
    25272563    AssertReturn(pState, VERR_NO_MEMORY);
     
    25322568    pState->pBackend = pBackend;
    25332569
    2534     int rc = RTLdrLoadSystem("d3d11", /* fNoUnload = */ true, &pBackend->hD3D11);
     2570    rc = RTLdrLoadSystem(VBOX_D3D11_LIBRARY_NAME, /* fNoUnload = */ true, &pBackend->hD3D11);
    25352571    AssertRC(rc);
    25362572    if (RT_SUCCESS(rc))
     
    26022638
    26032639
     2640/** @todo Such structures must be in VBoxVideo3D.h */
     2641typedef 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
    26042653static int vmsvga3dDrvNotifyDefineScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen)
    26052654{
    2606     /** @todo Such structures must be in VBoxVideo3D.h */
    2607     typedef struct VBOX3DNOTIFYDEFINESCREEN
    2608     {
    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 
    26182655    VBOX3DNOTIFYDEFINESCREEN n;
    26192656    n.Core.enmNotification = VBOX3D_NOTIFY_TYPE_HW_SCREEN_CREATED;
     
    26592696
    26602697
     2698typedef 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
    26612708static int vmsvga3dDrvNotifyUpdate(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen,
    26622709                                   uint32_t x, uint32_t y, uint32_t w, uint32_t h)
    26632710{
    2664     typedef struct VBOX3DNOTIFYUPDATE
    2665     {
    2666         VBOX3DNOTIFY Core;
    2667         uint32_t x;
    2668         uint32_t y;
    2669         uint32_t w;
    2670         uint32_t h;
    2671     } VBOX3DNOTIFYUPDATE;
    2672 
    26732711    VBOX3DNOTIFYUPDATE n;
    26742712    n.Core.enmNotification = VBOX3D_NOTIFY_TYPE_HW_SCREEN_UPDATE_END;
     
    33103348    /* Copy the screen texture to the shared surface. */
    33113349    DWORD result = pHwScreen->pDXGIKeyedMutex->AcquireSync(0, 10000);
    3312     if (result == WAIT_OBJECT_0)
     3350    if (result == S_OK)
    33133351    {
    33143352        pBackend->device.pImmediateContext->CopyResource(pHwScreen->pTexture, pBackendSurface->u.pTexture2D);
     
    40204058
    40214059
     4060#if 0 /*unused*/
    40224061/**
    40234062 * Create a new 3d context
     
    42854324    return VINF_SUCCESS;
    42864325}
     4326#endif
    42874327
    42884328
     
    45834623
    45844624
     4625#if 0 /*unused*/
    45854626static DECLCALLBACK(int) vmsvga3dBackOcclusionQueryCreate(PVGASTATECC pThisCC, PVMSVGA3DCONTEXT pContext)
    45864627{
     
    46224663    return VINF_SUCCESS;
    46234664}
     4665#endif
    46244666
    46254667
     
    55725614
    55735615    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];
    55755620    pDXContext->svgaDXContext.renderState.sampleMask = sampleMask;
    55765621
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette