VirtualBox

Changeset 81904 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Nov 17, 2019 2:39:45 PM (5 years ago)
Author:
vboxsync
Message:

WDDM: SetRenderTarget resets the viewport and the scissor rectangle, restore them

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h

    r80488 r81904  
    167167    VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
    168168    VBOXWDDMDISP_INDICES_INFO IndiciesInfo;
    169     /* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
    170      * is split into two calls : SetViewport & SetZRange */
     169    /* Need to cache the ViewPort data because IDirect3DDevice9::SetViewport
     170     * is split into two calls: SetViewport & SetZRange.
     171     * Also the viewport must be restored after IDirect3DDevice9::SetRenderTarget.
     172     */
    171173    D3DVIEWPORT9 ViewPort;
     174    /* The scissor rectangle must be restored after IDirect3DDevice9::SetRenderTarget. */
     175    RECT ScissorRect;
     176    /* Whether the ViewPort field is valid, i.e. GaDdiSetViewport has been called. */
     177    bool fViewPort : 1;
     178    /* Whether the ScissorRect field is valid, i.e. GaDdiSetScissorRect has been called. */
     179    bool fScissorRect : 1;
    172180    VBOXWDDMDISP_CONTEXT DefaultContext;
    173181
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/GaDdi.cpp

    r81632 r81904  
    31703170    pDevice->ViewPort.Width  = pData->Width;
    31713171    pDevice->ViewPort.Height = pData->Height;
     3172    pDevice->fViewPort = true;
    31723173
    31733174    HRESULT hr = pDevice9If->SetViewport(&pDevice->ViewPort);
     
    31893190    pDevice->ViewPort.MinZ = pData->MinZ;
    31903191    pDevice->ViewPort.MaxZ = pData->MaxZ;
     3192    pDevice->fViewPort = true;
    31913193
    31923194    HRESULT hr = pDevice9If->SetViewport(&pDevice->ViewPort);
     
    34573459    IDirect3DDevice9 *pDevice9If = VBOXDISP_D3DEV(pDevice);
    34583460
     3461    pDevice->ScissorRect = *pRect;
     3462    pDevice->fScissorRect = true;
     3463
    34593464    HRESULT hr = pDevice9If->SetScissorRect(pRect);
    34603465    Assert(hr == S_OK);
     
    38333838    {
    38343839        pDevice->apRTs[pData->RenderTargetIndex] = pAlloc;
     3840
     3841        /* IDirect3DDevice9::SetRenderTarget method resets the viewport and the scissor rectangle. */
     3842        if (pDevice->fViewPort)
     3843        {
     3844            pDevice9If->SetViewport(&pDevice->ViewPort);
     3845        }
     3846        if (pDevice->fScissorRect)
     3847        {
     3848            pDevice9If->SetScissorRect(&pDevice->ScissorRect);
     3849        }
    38353850    }
    38363851
     
    45834598        pDevice->ViewPort.MinZ   = 0.;
    45844599        pDevice->ViewPort.MaxZ   = 1.;
     4600        pDevice->fViewPort = false;
     4601        pDevice->fScissorRect = false;
    45854602
    45864603        /*
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