VirtualBox

Changeset 95149 in vbox for trunk/src


Ignore:
Timestamp:
May 31, 2022 5:01:25 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151643
Message:

Devices/Graphics: PresentBlt. bugref:9830

Location:
trunk/src/VBox/Devices/Graphics
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp

    r95101 r95149  
    27342734{
    27352735#ifdef VMSVGA3D_DX
    2736     DEBUG_BREAKPOINT_TEST();
    2737     PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
    2738     RT_NOREF(pSvgaR3State, pCmd, cbCmd);
    2739     return vmsvga3dDXPresentBlt(pThisCC, idDXContext);
     2736    //DEBUG_BREAKPOINT_TEST();
     2737    RT_NOREF(cbCmd);
     2738    return vmsvga3dDXPresentBlt(pThisCC, idDXContext, pCmd);
    27402739#else
    27412740    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp

    r95136 r95149  
    13841384
    13851385
    1386 int vmsvga3dDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext)
     1386int vmsvga3dDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPresentBlt const *pCmd)
    13871387{
    13881388    int rc;
     
    13961396    AssertRCReturn(rc, rc);
    13971397
    1398     rc = pSvgaR3State->pFuncsDX->pfnDXPresentBlt(pThisCC, pDXContext);
     1398    rc = pSvgaR3State->pFuncsDX->pfnDXPresentBlt(pThisCC, pDXContext,
     1399                                                 pCmd->dstSid, pCmd->destSubResource, &pCmd->boxDest,
     1400                                                 pCmd->srcSid, pCmd->srcSubResource, &pCmd->boxSrc, pCmd->mode);
    13991401    return rc;
    14001402}
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp

    r95137 r95149  
    7070} while (0)
    7171
     72typedef struct D3D11BLITTER
     73{
     74    ID3D11Device           *pDevice;
     75    ID3D11DeviceContext    *pImmediateContext;
     76
     77    ID3D11VertexShader     *pVertexShader;
     78    ID3D11PixelShader      *pPixelShader;
     79    ID3D11SamplerState     *pSamplerState;
     80    ID3D11RasterizerState  *pRasterizerState;
     81    ID3D11BlendState       *pBlendState;
     82} D3D11BLITTER;
     83
    7284typedef struct DXDEVICE
    7385{
     
    8092    ID3D11Buffer              *pStagingBuffer;         /* The staging buffer resource. */
    8193    uint32_t                   cbStagingBuffer;        /* Current size of the staging buffer resource. */
     94
     95    D3D11BLITTER               Blitter;                /* Blits one texture to another. */
    8296} DXDEVICE;
    8397
     
    310324static int dxDestroyShader(DXSHADER *pDXShader);
    311325static int dxDestroyQuery(DXQUERY *pDXQuery);
     326
     327static HRESULT BlitInit(D3D11BLITTER *pBlitter, ID3D11Device *pDevice, ID3D11DeviceContext *pImmediateContext);
     328static void BlitRelease(D3D11BLITTER *pBlitter);
    312329
    313330
     
    841858        pDXDevice->cbStagingBuffer = 0;
    842859
     860        BlitInit(&pDXDevice->Blitter, pDXDevice->pDevice, pDXDevice->pImmediateContext);
    843861        return rc;
    844862    }
     
    937955    }
    938956
    939     if (FAILED(hr))
     957    if (SUCCEEDED(hr))
     958        BlitInit(&pDXDevice->Blitter, pDXDevice->pDevice, pDXDevice->pImmediateContext);
     959    else
    940960        rc = VERR_NOT_SUPPORTED;
    941961
     
    947967{
    948968    RT_NOREF(pBackend);
     969
     970    BlitRelease(&pDevice->Blitter);
    949971
    950972    D3D_RELEASE(pDevice->pStagingBuffer);
     
    72987320
    72997321
    7300 static DECLCALLBACK(int) vmsvga3dBackDXPresentBlt(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
    7301 {
    7302     PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
    7303 
    7304     RT_NOREF(pBackend, pDXContext);
    7305     AssertFailed(); /** @todo Implement */
    7306     return VERR_NOT_IMPLEMENTED;
     7322#include "shaders/d3d11blitter.hlsl.vs.h"
     7323#include "shaders/d3d11blitter.hlsl.ps.h"
     7324
     7325#define HTEST(stmt) \
     7326    hr = stmt; \
     7327    AssertReturn(SUCCEEDED(hr), hr)
     7328
     7329
     7330static void BlitRelease(D3D11BLITTER *pBlitter)
     7331{
     7332    D3D_RELEASE(pBlitter->pVertexShader);
     7333    D3D_RELEASE(pBlitter->pPixelShader);
     7334    D3D_RELEASE(pBlitter->pSamplerState);
     7335    D3D_RELEASE(pBlitter->pRasterizerState);
     7336    D3D_RELEASE(pBlitter->pBlendState);
     7337    RT_ZERO(*pBlitter);
     7338}
     7339
     7340
     7341static HRESULT BlitInit(D3D11BLITTER *pBlitter, ID3D11Device *pDevice, ID3D11DeviceContext *pImmediateContext)
     7342{
     7343    HRESULT hr;
     7344
     7345    RT_ZERO(*pBlitter);
     7346
     7347    pBlitter->pDevice = pDevice;
     7348    pBlitter->pImmediateContext = pImmediateContext;
     7349
     7350    HTEST(pBlitter->pDevice->CreateVertexShader(g_vs_blitter, sizeof(g_vs_blitter), NULL, &pBlitter->pVertexShader));
     7351    HTEST(pBlitter->pDevice->CreatePixelShader(g_ps_blitter, sizeof(g_ps_blitter), NULL, &pBlitter->pPixelShader));
     7352
     7353    D3D11_SAMPLER_DESC SamplerDesc;
     7354    SamplerDesc.Filter         = D3D11_FILTER_ANISOTROPIC;
     7355    SamplerDesc.AddressU       = D3D11_TEXTURE_ADDRESS_WRAP;
     7356    SamplerDesc.AddressV       = D3D11_TEXTURE_ADDRESS_WRAP;
     7357    SamplerDesc.AddressW       = D3D11_TEXTURE_ADDRESS_WRAP;
     7358    SamplerDesc.MipLODBias     = 0.0f;
     7359    SamplerDesc.MaxAnisotropy  = 4;
     7360    SamplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
     7361    SamplerDesc.BorderColor[0] = 0.0f;
     7362    SamplerDesc.BorderColor[1] = 0.0f;
     7363    SamplerDesc.BorderColor[2] = 0.0f;
     7364    SamplerDesc.BorderColor[3] = 0.0f;
     7365    SamplerDesc.MinLOD         = 0.0f;
     7366    SamplerDesc.MaxLOD         = 0.0f;
     7367    HTEST(pBlitter->pDevice->CreateSamplerState(&SamplerDesc, &pBlitter->pSamplerState));
     7368
     7369    D3D11_RASTERIZER_DESC RasterizerDesc;
     7370    RasterizerDesc.FillMode              = D3D11_FILL_SOLID;
     7371    RasterizerDesc.CullMode              = D3D11_CULL_NONE;
     7372    RasterizerDesc.FrontCounterClockwise = FALSE;
     7373    RasterizerDesc.DepthBias             = 0;
     7374    RasterizerDesc.DepthBiasClamp        = 0.0f;
     7375    RasterizerDesc.SlopeScaledDepthBias  = 0.0f;
     7376    RasterizerDesc.DepthClipEnable       = FALSE;
     7377    RasterizerDesc.ScissorEnable         = FALSE;
     7378    RasterizerDesc.MultisampleEnable     = FALSE;
     7379    RasterizerDesc.AntialiasedLineEnable = FALSE;
     7380    HTEST(pBlitter->pDevice->CreateRasterizerState(&RasterizerDesc, &pBlitter->pRasterizerState));
     7381
     7382    D3D11_BLEND_DESC BlendDesc;
     7383    BlendDesc.AlphaToCoverageEnable = FALSE;
     7384    BlendDesc.IndependentBlendEnable = FALSE;
     7385    for (unsigned i = 0; i < RT_ELEMENTS(BlendDesc.RenderTarget); ++i)
     7386    {
     7387        BlendDesc.RenderTarget[i].BlendEnable           = FALSE;
     7388        BlendDesc.RenderTarget[i].SrcBlend              = D3D11_BLEND_SRC_COLOR;
     7389        BlendDesc.RenderTarget[i].DestBlend             = D3D11_BLEND_ZERO;
     7390        BlendDesc.RenderTarget[i].BlendOp               = D3D11_BLEND_OP_ADD;
     7391        BlendDesc.RenderTarget[i].SrcBlendAlpha         = D3D11_BLEND_SRC_ALPHA;
     7392        BlendDesc.RenderTarget[i].DestBlendAlpha        = D3D11_BLEND_ZERO;
     7393        BlendDesc.RenderTarget[i].BlendOpAlpha          = D3D11_BLEND_OP_ADD;
     7394        BlendDesc.RenderTarget[i].RenderTargetWriteMask = 0xF;
     7395    }
     7396    HTEST(pBlitter->pDevice->CreateBlendState(&BlendDesc, &pBlitter->pBlendState));
     7397
     7398    return S_OK;
     7399}
     7400
     7401
     7402static HRESULT BlitFromTexture(D3D11BLITTER *pBlitter, ID3D11RenderTargetView *pDstRenderTargetView,
     7403                               float cDstWidth, float cDstHeight, D3D11_RECT const &rectDst,
     7404                               ID3D11ShaderResourceView *pSrcShaderResourceView)
     7405{
     7406    HRESULT hr;
     7407
     7408    /*
     7409     * Save pipeline state.
     7410     */
     7411    struct
     7412    {
     7413        D3D11_PRIMITIVE_TOPOLOGY    Topology;
     7414        ID3D11InputLayout          *pInputLayout;
     7415        ID3D11Buffer               *pConstantBuffer;
     7416        ID3D11VertexShader         *pVertexShader;
     7417        ID3D11ShaderResourceView   *pShaderResourceView;
     7418        ID3D11PixelShader          *pPixelShader;
     7419        ID3D11SamplerState         *pSamplerState;
     7420        ID3D11RasterizerState      *pRasterizerState;
     7421        ID3D11BlendState           *pBlendState;
     7422        FLOAT                       BlendFactor[4];
     7423        UINT                        SampleMask;
     7424        ID3D11RenderTargetView     *apRenderTargetView[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
     7425        ID3D11DepthStencilView     *pDepthStencilView;
     7426        UINT                        NumViewports;
     7427        D3D11_VIEWPORT              aViewport[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
     7428    } SavedState;
     7429
     7430    pBlitter->pImmediateContext->IAGetPrimitiveTopology(&SavedState.Topology);
     7431    pBlitter->pImmediateContext->IAGetInputLayout(&SavedState.pInputLayout);
     7432    pBlitter->pImmediateContext->VSGetConstantBuffers(0, 1, &SavedState.pConstantBuffer);
     7433    pBlitter->pImmediateContext->VSGetShader(&SavedState.pVertexShader, NULL, NULL);
     7434    pBlitter->pImmediateContext->PSGetShaderResources(0, 1, &SavedState.pShaderResourceView);
     7435    pBlitter->pImmediateContext->PSGetShader(&SavedState.pPixelShader, NULL, NULL);
     7436    pBlitter->pImmediateContext->PSGetSamplers(0, 1, &SavedState.pSamplerState);
     7437    pBlitter->pImmediateContext->RSGetState(&SavedState.pRasterizerState);
     7438    pBlitter->pImmediateContext->OMGetBlendState(&SavedState.pBlendState, SavedState.BlendFactor, &SavedState.SampleMask);
     7439    pBlitter->pImmediateContext->OMGetRenderTargets(RT_ELEMENTS(SavedState.apRenderTargetView), SavedState.apRenderTargetView, &SavedState.pDepthStencilView);
     7440    SavedState.NumViewports = RT_ELEMENTS(SavedState.aViewport);
     7441    pBlitter->pImmediateContext->RSGetViewports(&SavedState.NumViewports, &SavedState.aViewport[0]);
     7442
     7443    /*
     7444     * Setup pipeline for the blitter.
     7445     */
     7446
     7447    /* Render target is first.
     7448     * If the source texture is bound as a render target, then this call will unbind it
     7449     * and allow to use it as the shader resource.
     7450     */
     7451    pBlitter->pImmediateContext->OMSetRenderTargets(1, &pDstRenderTargetView, NULL);
     7452
     7453    /* Input assembler. */
     7454    pBlitter->pImmediateContext->IASetInputLayout(NULL);
     7455    pBlitter->pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
     7456
     7457    /* Constant buffer. */
     7458    struct
     7459    {
     7460        float scaleX;
     7461        float scaleY;
     7462        float offsetX;
     7463        float offsetY;
     7464    } VSConstantBuffer;
     7465    VSConstantBuffer.scaleX = (float)(rectDst.right - rectDst.left) / cDstWidth;
     7466    VSConstantBuffer.scaleY = (float)(rectDst.bottom - rectDst.top) / cDstHeight;
     7467    VSConstantBuffer.offsetX = (float)(rectDst.right + rectDst.left) / cDstWidth - 1.0f;
     7468    VSConstantBuffer.offsetY = -((float)(rectDst.bottom + rectDst.top) / cDstHeight - 1.0f);
     7469
     7470    D3D11_SUBRESOURCE_DATA initialData;
     7471    initialData.pSysMem          = &VSConstantBuffer;
     7472    initialData.SysMemPitch      = sizeof(VSConstantBuffer);
     7473    initialData.SysMemSlicePitch = sizeof(VSConstantBuffer);
     7474
     7475    D3D11_BUFFER_DESC bd;
     7476    RT_ZERO(bd);
     7477    bd.ByteWidth           = sizeof(VSConstantBuffer);
     7478    bd.Usage               = D3D11_USAGE_IMMUTABLE;
     7479    bd.BindFlags           = D3D11_BIND_CONSTANT_BUFFER;
     7480
     7481    ID3D11Buffer *pConstantBuffer;
     7482    HTEST(pBlitter->pDevice->CreateBuffer(&bd, &initialData, &pConstantBuffer));
     7483    pBlitter->pImmediateContext->VSSetConstantBuffers(0, 1, &pConstantBuffer);
     7484    D3D_RELEASE(pConstantBuffer); /* xSSetConstantBuffers "will hold a reference to the interfaces passed in." */
     7485
     7486    /* Vertex shader. */
     7487    pBlitter->pImmediateContext->VSSetShader(pBlitter->pVertexShader, NULL, 0);
     7488
     7489    /* Shader resource view. */
     7490    pBlitter->pImmediateContext->PSSetShaderResources(0, 1, &pSrcShaderResourceView);
     7491
     7492    /* Pixel shader. */
     7493    pBlitter->pImmediateContext->PSSetShader(pBlitter->pPixelShader, NULL, 0);
     7494
     7495    /* Sampler. */
     7496    pBlitter->pImmediateContext->PSSetSamplers(0, 1, &pBlitter->pSamplerState);
     7497
     7498    /* Rasterizer. */
     7499    pBlitter->pImmediateContext->RSSetState(pBlitter->pRasterizerState);
     7500
     7501    /* Blend state. */
     7502    static FLOAT const BlendFactor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
     7503    pBlitter->pImmediateContext->OMSetBlendState(pBlitter->pBlendState, BlendFactor, 0xffffffff);
     7504
     7505    /* Viewport. */
     7506    D3D11_VIEWPORT Viewport;
     7507    Viewport.TopLeftX = 0;
     7508    Viewport.TopLeftY = 0;
     7509    Viewport.Width    = cDstWidth;
     7510    Viewport.Height   = cDstHeight;
     7511    Viewport.MinDepth = 0.0f;
     7512    Viewport.MaxDepth = 1.0f;
     7513    pBlitter->pImmediateContext->RSSetViewports(1, &Viewport);
     7514
     7515    /* Draw. */
     7516    pBlitter->pImmediateContext->Draw(4, 0);
     7517
     7518    /*
     7519     * Restore pipeline state.
     7520     */
     7521    pBlitter->pImmediateContext->IASetPrimitiveTopology(SavedState.Topology);
     7522    pBlitter->pImmediateContext->IASetInputLayout(SavedState.pInputLayout);
     7523    D3D_RELEASE(SavedState.pInputLayout);
     7524    pBlitter->pImmediateContext->VSSetConstantBuffers(0, 1, &SavedState.pConstantBuffer);
     7525    D3D_RELEASE(SavedState.pConstantBuffer);
     7526    pBlitter->pImmediateContext->VSSetShader(SavedState.pVertexShader, NULL, NULL);
     7527    D3D_RELEASE(SavedState.pVertexShader);
     7528    pBlitter->pImmediateContext->PSSetShaderResources(0, 1, &SavedState.pShaderResourceView);
     7529    D3D_RELEASE(SavedState.pShaderResourceView);
     7530    pBlitter->pImmediateContext->PSSetShader(SavedState.pPixelShader, NULL, NULL);
     7531    D3D_RELEASE(SavedState.pPixelShader);
     7532    pBlitter->pImmediateContext->PSSetSamplers(0, 1, &SavedState.pSamplerState);
     7533    D3D_RELEASE(SavedState.pSamplerState);
     7534    pBlitter->pImmediateContext->RSSetState(SavedState.pRasterizerState);
     7535    D3D_RELEASE(SavedState.pRasterizerState);
     7536    pBlitter->pImmediateContext->OMSetBlendState(SavedState.pBlendState, SavedState.BlendFactor, SavedState.SampleMask);
     7537    D3D_RELEASE(SavedState.pBlendState);
     7538    pBlitter->pImmediateContext->OMSetRenderTargets(RT_ELEMENTS(SavedState.apRenderTargetView), SavedState.apRenderTargetView, SavedState.pDepthStencilView);
     7539    DX_RELEASE_ARRAY(RT_ELEMENTS(SavedState.apRenderTargetView), SavedState.apRenderTargetView);
     7540    D3D_RELEASE(SavedState.pDepthStencilView);
     7541    pBlitter->pImmediateContext->RSSetViewports(SavedState.NumViewports, &SavedState.aViewport[0]);
     7542
     7543    return S_OK;
     7544}
     7545
     7546
     7547static DECLCALLBACK(int) vmsvga3dBackDXPresentBlt(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext,
     7548                                                  SVGA3dSurfaceId dstSid, uint32_t dstSubResource, SVGA3dBox const *pBoxDst,
     7549                                                  SVGA3dSurfaceId srcSid, uint32_t srcSubResource, SVGA3dBox const *pBoxSrc,
     7550                                                  SVGA3dDXPresentBltMode mode)
     7551{
     7552    RT_NOREF(mode);
     7553
     7554    ASSERT_GUEST_RETURN(pBoxDst->z == 0 && pBoxDst->d == 1, VERR_INVALID_PARAMETER);
     7555    ASSERT_GUEST_RETURN(pBoxSrc->z == 0 && pBoxSrc->d == 1, VERR_INVALID_PARAMETER);
     7556
     7557    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
     7558    RT_NOREF(pBackend);
     7559
     7560    DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     7561    AssertReturn(pDevice->pDevice, VERR_INVALID_STATE);
     7562
     7563    PVMSVGA3DSURFACE pSrcSurface;
     7564    int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, srcSid, &pSrcSurface);
     7565    AssertRCReturn(rc, rc);
     7566
     7567    PVMSVGA3DSURFACE pDstSurface;
     7568    rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, dstSid, &pDstSurface);
     7569    AssertRCReturn(rc, rc);
     7570
     7571    if (pSrcSurface->pBackendSurface == NULL)
     7572    {
     7573        /* Create the resource. */
     7574        if (pSrcSurface->format != SVGA3D_BUFFER)
     7575            rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDXContext, pSrcSurface);
     7576        else
     7577            rc = vmsvga3dBackSurfaceCreateResource(pThisCC, pDXContext, pSrcSurface);
     7578        AssertRCReturn(rc, rc);
     7579    }
     7580
     7581    if (pDstSurface->pBackendSurface == NULL)
     7582    {
     7583        /* Create the resource. */
     7584        if (pSrcSurface->format != SVGA3D_BUFFER)
     7585            rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDXContext, pDstSurface);
     7586        else
     7587            rc = vmsvga3dBackSurfaceCreateResource(pThisCC, pDXContext, pDstSurface);
     7588        AssertRCReturn(rc, rc);
     7589    }
     7590
     7591    LogFunc(("cid %d: src cid %d%s -> dst cid %d%s\n",
     7592             pDXContext->cid, pSrcSurface->idAssociatedContext,
     7593             (pSrcSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : "",
     7594             pDstSurface->idAssociatedContext,
     7595             (pDstSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET) ? " st" : ""));
     7596
     7597    /* Clip the box. */
     7598    /** @todo Use [src|dst]SubResource to index p[Src|Dst]Surface->paMipmapLevels array directly. */
     7599    uint32_t iSrcFace;
     7600    uint32_t iSrcMipmap;
     7601    vmsvga3dCalcMipmapAndFace(pSrcSurface->cLevels, srcSubResource, &iSrcMipmap, &iSrcFace);
     7602
     7603    uint32_t iDstFace;
     7604    uint32_t iDstMipmap;
     7605    vmsvga3dCalcMipmapAndFace(pDstSurface->cLevels, dstSubResource, &iDstMipmap, &iDstFace);
     7606
     7607    PVMSVGA3DMIPMAPLEVEL pSrcMipLevel;
     7608    rc = vmsvga3dMipmapLevel(pSrcSurface, iSrcFace, iSrcMipmap, &pSrcMipLevel);
     7609    ASSERT_GUEST_RETURN(RT_SUCCESS(rc), rc);
     7610
     7611    PVMSVGA3DMIPMAPLEVEL pDstMipLevel;
     7612    rc = vmsvga3dMipmapLevel(pDstSurface, iDstFace, iDstMipmap, &pDstMipLevel);
     7613    ASSERT_GUEST_RETURN(RT_SUCCESS(rc), rc);
     7614
     7615    SVGA3dBox clipBoxSrc = *pBoxSrc;
     7616    vmsvgaR3ClipBox(&pSrcMipLevel->mipmapSize, &clipBoxSrc);
     7617
     7618    SVGA3dBox clipBoxDst = *pBoxDst;
     7619    vmsvgaR3ClipBox(&pDstMipLevel->mipmapSize, &clipBoxDst);
     7620
     7621    ID3D11Resource *pDstResource = dxResource(pThisCC->svga.p3dState, pDstSurface, pDXContext);
     7622    ID3D11Resource *pSrcResource = dxResource(pThisCC->svga.p3dState, pSrcSurface, pDXContext);
     7623
     7624    D3D11_RENDER_TARGET_VIEW_DESC RTVDesc;
     7625    RT_ZERO(RTVDesc);
     7626    RTVDesc.Format = vmsvgaDXSurfaceFormat2Dxgi(pDstSurface->format);;
     7627    RTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
     7628    RTVDesc.Texture2D.MipSlice = dstSubResource;
     7629
     7630    ID3D11RenderTargetView *pDstRenderTargetView;
     7631    HRESULT hr = pDevice->pDevice->CreateRenderTargetView(pDstResource, &RTVDesc, &pDstRenderTargetView);
     7632    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     7633
     7634    D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc;
     7635    RT_ZERO(SRVDesc);
     7636    SRVDesc.Format = vmsvgaDXSurfaceFormat2Dxgi(pSrcSurface->format);
     7637    SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
     7638    SRVDesc.Texture2D.MostDetailedMip = srcSubResource;
     7639    SRVDesc.Texture2D.MipLevels = 1;
     7640
     7641    ID3D11ShaderResourceView *pSrcShaderResourceView;
     7642    hr = pDevice->pDevice->CreateShaderResourceView(pSrcResource, &SRVDesc, &pSrcShaderResourceView);
     7643    AssertReturnStmt(SUCCEEDED(hr), D3D_RELEASE(pDstRenderTargetView), VERR_NOT_SUPPORTED);
     7644
     7645    D3D11_RECT rectDst;
     7646    rectDst.left   = pBoxDst->x;
     7647    rectDst.top    = pBoxDst->y;
     7648    rectDst.right  = pBoxDst->x + pBoxDst->w;
     7649    rectDst.bottom = pBoxDst->y + pBoxDst->h;
     7650
     7651    BlitFromTexture(&pDevice->Blitter, pDstRenderTargetView, (float)pDstMipLevel->mipmapSize.width, (float)pDstMipLevel->mipmapSize.height,
     7652                    rectDst, pSrcShaderResourceView);
     7653
     7654    D3D_RELEASE(pSrcShaderResourceView);
     7655    D3D_RELEASE(pDstRenderTargetView);
     7656
     7657    pDstSurface->pBackendSurface->cidDrawing = pDXContext->cid;
     7658    return VINF_SUCCESS;
    73077659}
    73087660
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h

    r95085 r95149  
    457457    DECLCALLBACKMEMBER(int, pfnDXPredCopyRegion,            (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSurfaceId dstSid, uint32_t dstSubResource, SVGA3dSurfaceId srcSid, uint32_t srcSubResource, SVGA3dCopyBox const *pBox));
    458458    DECLCALLBACKMEMBER(int, pfnDXPredCopy,                  (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSurfaceId dstSid, SVGA3dSurfaceId srcSid));
    459     DECLCALLBACKMEMBER(int, pfnDXPresentBlt,                (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
     459    DECLCALLBACKMEMBER(int, pfnDXPresentBlt,                (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSurfaceId dstSid, uint32_t dstSubResource, SVGA3dBox const *pBoxDst, SVGA3dSurfaceId srcSid, uint32_t srcSubResource, SVGA3dBox const *pBoxSrc, SVGA3dDXPresentBltMode mode));
    460460    DECLCALLBACKMEMBER(int, pfnDXGenMips,                   (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderResourceViewId shaderResourceViewId));
    461461    DECLCALLBACKMEMBER(int, pfnDXDefineShaderResourceView,  (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderResourceViewId shaderResourceViewId, SVGACOTableDXSRViewEntry const *pEntry));
     
    578578int vmsvga3dDXPredCopyRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopyRegion const *pCmd);
    579579int vmsvga3dDXPredCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopy const *pCmd);
    580 int vmsvga3dDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext);
     580int vmsvga3dDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPresentBlt const *pCmd);
    581581int vmsvga3dDXGenMips(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXGenMips const *pCmd);
    582582int vmsvga3dDXDefineShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShaderResourceView const *pCmd);
Note: See TracChangeset for help on using the changeset viewer.

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