VirtualBox

Changeset 102532 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 7, 2023 5:56:09 PM (14 months ago)
Author:
vboxsync
Message:

Devices/Graphics: use 11.1 interfaces.

File:
1 edited

Legend:

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

    r102520 r102532  
    9090typedef struct D3D11BLITTER
    9191{
    92     ID3D11Device           *pDevice;
    93     ID3D11DeviceContext    *pImmediateContext;
     92    ID3D11Device1          *pDevice;
     93    ID3D11DeviceContext1   *pImmediateContext;
    9494
    9595    ID3D11VertexShader     *pVertexShader;
    9696    ID3D11PixelShader      *pPixelShader;
    9797    ID3D11SamplerState     *pSamplerState;
    98     ID3D11RasterizerState  *pRasterizerState;
    99     ID3D11BlendState       *pBlendState;
     98    ID3D11RasterizerState1 *pRasterizerState;
     99    ID3D11BlendState1      *pBlendState;
    100100} D3D11BLITTER;
    101101
     
    349349    uint32_t                   cStreamOutput;          /* paStreamOutput */
    350350    uint32_t                   cUnorderedAccessView;   /* paUnorderedAccessView */
    351     ID3D11BlendState         **papBlendState;
     351    ID3D11BlendState1        **papBlendState;
    352352    ID3D11DepthStencilState  **papDepthStencilState;
    353353    ID3D11SamplerState       **papSamplerState;
    354     ID3D11RasterizerState    **papRasterizerState;
     354    ID3D11RasterizerState1   **papRasterizerState;
    355355    DXELEMENTLAYOUT           *paElementLayout;
    356356    DXVIEW                    *paRenderTargetView;
     
    420420static void dxDestroyVideoDecoder(DXVIDEODECODER *pDXVideoDecoder);
    421421
    422 static HRESULT BlitInit(D3D11BLITTER *pBlitter, ID3D11Device *pDevice, ID3D11DeviceContext *pImmediateContext);
     422static HRESULT BlitInit(D3D11BLITTER *pBlitter, ID3D11Device1 *pDevice, ID3D11DeviceContext1 *pImmediateContext);
    423423static void BlitRelease(D3D11BLITTER *pBlitter);
    424424
     
    19121912
    19131913
     1914static D3D11_LOGIC_OP dxLogicOp(uint8_t svgaLogicEq)
     1915{
     1916    return (D3D11_LOGIC_OP)svgaLogicEq;
     1917}
     1918
     1919
    19141920/** @todo AssertCompile for types like D3D11_COMPARISON_FUNC and SVGA3dComparisonFunc */
    1915 static HRESULT dxBlendStateCreate(DXDEVICE *pDevice, SVGACOTableDXBlendStateEntry const *pEntry, ID3D11BlendState **pp)
    1916 {
    1917     D3D11_BLEND_DESC BlendDesc;
     1921static HRESULT dxBlendStateCreate(DXDEVICE *pDevice, SVGACOTableDXBlendStateEntry const *pEntry, ID3D11BlendState1 **pp)
     1922{
     1923    D3D11_BLEND_DESC1 BlendDesc;
    19181924    BlendDesc.AlphaToCoverageEnable = RT_BOOL(pEntry->alphaToCoverageEnable);
    19191925    BlendDesc.IndependentBlendEnable = RT_BOOL(pEntry->independentBlendEnable);
     
    19211927    {
    19221928        BlendDesc.RenderTarget[i].BlendEnable           = RT_BOOL(pEntry->perRT[i].blendEnable);
     1929        BlendDesc.RenderTarget[i].LogicOpEnable         = RT_BOOL(pEntry->perRT[i].logicOpEnable);
    19231930        BlendDesc.RenderTarget[i].SrcBlend              = dxBlendFactorColor(pEntry->perRT[i].srcBlend);
    19241931        BlendDesc.RenderTarget[i].DestBlend             = dxBlendFactorColor(pEntry->perRT[i].destBlend);
     
    19271934        BlendDesc.RenderTarget[i].DestBlendAlpha        = dxBlendFactorAlpha(pEntry->perRT[i].destBlendAlpha);
    19281935        BlendDesc.RenderTarget[i].BlendOpAlpha          = dxBlendOp         (pEntry->perRT[i].blendOpAlpha);
     1936        BlendDesc.RenderTarget[i].LogicOp               = dxLogicOp         (pEntry->perRT[i].logicOp);
    19291937        BlendDesc.RenderTarget[i].RenderTargetWriteMask = pEntry->perRT[i].renderTargetWriteMask;
    1930         /** @todo logicOpEnable and logicOp */
    1931     }
    1932 
    1933     HRESULT hr = pDevice->pDevice->CreateBlendState(&BlendDesc, pp);
     1938    }
     1939
     1940    HRESULT hr = pDevice->pDevice->CreateBlendState1(&BlendDesc, pp);
    19341941    Assert(SUCCEEDED(hr));
    19351942    return hr;
     
    19992006
    20002007
    2001 static HRESULT dxRasterizerStateCreate(DXDEVICE *pDevice, SVGACOTableDXRasterizerStateEntry const *pEntry, ID3D11RasterizerState **pp)
    2002 {
    2003     D3D11_RASTERIZER_DESC desc;
     2008static D3D11_CULL_MODE dxCullMode(uint8_t svgaCullMode)
     2009{
     2010    return (D3D11_CULL_MODE)svgaCullMode;
     2011}
     2012
     2013
     2014static HRESULT dxRasterizerStateCreate(DXDEVICE *pDevice, SVGACOTableDXRasterizerStateEntry const *pEntry, ID3D11RasterizerState1 **pp)
     2015{
     2016    D3D11_RASTERIZER_DESC1 desc;
    20042017    desc.FillMode              = dxFillMode(pEntry->fillMode);
    2005     desc.CullMode              = (D3D11_CULL_MODE)pEntry->cullMode;
     2018    desc.CullMode              = dxCullMode(pEntry->cullMode);
    20062019    desc.FrontCounterClockwise = pEntry->frontCounterClockwise;
    20072020    /** @todo provokingVertexLast */
     
    20132026    desc.MultisampleEnable     = pEntry->multisampleEnable;
    20142027    desc.AntialiasedLineEnable = pEntry->antialiasedLineEnable;
    2015     /** @todo lineWidth lineStippleEnable lineStippleFactor lineStipplePattern forcedSampleCount */
    2016 
    2017     HRESULT hr = pDevice->pDevice->CreateRasterizerState(&desc, pp);
     2028    desc.ForcedSampleCount     = pEntry->forcedSampleCount;
     2029    /** @todo lineWidth lineStippleEnable lineStippleFactor lineStipplePattern */
     2030
     2031    HRESULT hr = pDevice->pDevice->CreateRasterizerState1(&desc, pp);
    20182032    Assert(SUCCEEDED(hr));
    20192033    return hr;
     
    78457859    if (blendId != SVGA3D_INVALID_ID)
    78467860    {
    7847         ID3D11BlendState *pBlendState = pDXContext->pBackendDXContext->papBlendState[blendId];
     7861        ID3D11BlendState1 *pBlendState = pDXContext->pBackendDXContext->papBlendState[blendId];
    78487862        pDevice->pImmediateContext->OMSetBlendState(pBlendState, blendFactor, sampleMask);
    78497863    }
     
    78857899    if (rasterizerId != SVGA3D_INVALID_ID)
    78867900    {
    7887         ID3D11RasterizerState *pRasterizerState = pDXContext->pBackendDXContext->papRasterizerState[rasterizerId];
     7901        ID3D11RasterizerState1 *pRasterizerState = pDXContext->pBackendDXContext->papRasterizerState[rasterizerId];
    78887902        pDevice->pImmediateContext->RSSetState(pRasterizerState);
    78897903    }
     
    84978511
    84988512
    8499 static HRESULT BlitInit(D3D11BLITTER *pBlitter, ID3D11Device *pDevice, ID3D11DeviceContext *pImmediateContext)
     8513static HRESULT BlitInit(D3D11BLITTER *pBlitter, ID3D11Device1 *pDevice, ID3D11DeviceContext1 *pImmediateContext)
    85008514{
    85018515    HRESULT hr;
     
    85258539    HTEST(pBlitter->pDevice->CreateSamplerState(&SamplerDesc, &pBlitter->pSamplerState));
    85268540
    8527     D3D11_RASTERIZER_DESC RasterizerDesc;
     8541    D3D11_RASTERIZER_DESC1 RasterizerDesc;
    85288542    RasterizerDesc.FillMode              = D3D11_FILL_SOLID;
    85298543    RasterizerDesc.CullMode              = D3D11_CULL_NONE;
     
    85368550    RasterizerDesc.MultisampleEnable     = FALSE;
    85378551    RasterizerDesc.AntialiasedLineEnable = FALSE;
    8538     HTEST(pBlitter->pDevice->CreateRasterizerState(&RasterizerDesc, &pBlitter->pRasterizerState));
    8539 
    8540     D3D11_BLEND_DESC BlendDesc;
     8552    RasterizerDesc.ForcedSampleCount     = 0;
     8553    HTEST(pBlitter->pDevice->CreateRasterizerState1(&RasterizerDesc, &pBlitter->pRasterizerState));
     8554
     8555    D3D11_BLEND_DESC1 BlendDesc;
    85418556    BlendDesc.AlphaToCoverageEnable = FALSE;
    85428557    BlendDesc.IndependentBlendEnable = FALSE;
     
    85448559    {
    85458560        BlendDesc.RenderTarget[i].BlendEnable           = FALSE;
     8561        BlendDesc.RenderTarget[i].LogicOpEnable         = FALSE;
    85468562        BlendDesc.RenderTarget[i].SrcBlend              = D3D11_BLEND_SRC_COLOR;
    85478563        BlendDesc.RenderTarget[i].DestBlend             = D3D11_BLEND_ZERO;
     
    85508566        BlendDesc.RenderTarget[i].DestBlendAlpha        = D3D11_BLEND_ZERO;
    85518567        BlendDesc.RenderTarget[i].BlendOpAlpha          = D3D11_BLEND_OP_ADD;
     8568        BlendDesc.RenderTarget[i].LogicOp               = D3D11_LOGIC_OP_CLEAR;
    85528569        BlendDesc.RenderTarget[i].RenderTargetWriteMask = 0xF;
    85538570    }
    8554     HTEST(pBlitter->pDevice->CreateBlendState(&BlendDesc, &pBlitter->pBlendState));
     8571    HTEST(pBlitter->pDevice->CreateBlendState1(&BlendDesc, &pBlitter->pBlendState));
    85558572
    85568573    return S_OK;
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