VirtualBox

Changeset 102808 in vbox for trunk/src


Ignore:
Timestamp:
Jan 10, 2024 8:16:30 AM (13 months ago)
Author:
vboxsync
Message:

Devices/Graphics: multisampling.

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

Legend:

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

    r102616 r102808  
    12991299
    13001300    /* Create the surface. */
     1301    SVGA3dMSPattern const multisamplePattern = pCmd->multisampleCount > 1 ? SVGA3D_MS_PATTERN_STANDARD : SVGA3D_MS_PATTERN_NONE;
     1302    SVGA3dMSQualityLevel const qualityLevel = pCmd->multisampleCount > 1 ? SVGA3D_MS_QUALITY_FULL : SVGA3D_MS_QUALITY_NONE;
    13011303    vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
    1302                           pCmd->multisampleCount, pCmd->autogenFilter,
    1303                           pCmd->face[0].numMipLevels, &paMipLevelSizes[0], /* arraySize = */ 0, /* fAllocMipLevels = */ true);
     1304                          pCmd->multisampleCount, multisamplePattern, qualityLevel, pCmd->autogenFilter,
     1305                          pCmd->face[0].numMipLevels, &paMipLevelSizes[0], /* arraySize = */ 0, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ true);
    13041306}
    13051307
     
    13751377    // entry.arraySize = 0;
    13761378    // entry.mobPitch = 0;
     1379    // entry.surface2Flags = 0;
     1380    // entry.multisamplePattern = 0;
     1381    // entry.qualityLevel = 0;
     1382    // entry.bufferByteStride = 0;
     1383    // entry.minLOD = 0;
    13771384    int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
    13781385                                 pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
     
    13801387    {
    13811388        /* Create the host surface. */
     1389        SVGA3dMSPattern const multisamplePattern = pCmd->multisampleCount > 1 ? SVGA3D_MS_PATTERN_STANDARD : SVGA3D_MS_PATTERN_NONE;
     1390        SVGA3dMSQualityLevel const qualityLevel = pCmd->multisampleCount > 1 ? SVGA3D_MS_QUALITY_FULL : SVGA3D_MS_QUALITY_NONE;
    13821391        vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
    1383                               pCmd->multisampleCount, pCmd->autogenFilter,
    1384                               pCmd->numMipLevels, &pCmd->size, /* arraySize = */ 0, /* fAllocMipLevels = */ false);
     1392                              pCmd->multisampleCount, multisamplePattern, qualityLevel, pCmd->autogenFilter,
     1393                              pCmd->numMipLevels, &pCmd->size, /* arraySize = */ 0, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ false);
    13851394    }
    13861395}
     
    16571666                                        SVGA3dTransferType enmTransfer)
    16581667{
     1668    if (vmsvga3dIsMultisampleSurface(pThisCC, pImage->sid))
     1669    {
     1670        /* Multisample surfaces can't be accessed. Skip. */
     1671        return VINF_SUCCESS;
     1672    }
     1673
    16591674    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
    16601675
     
    20672082    entry.arraySize = pCmd->arraySize;
    20682083    // entry.mobPitch = 0;
    2069     // entry.mobPitch = 0;
    20702084    // entry.surface2Flags = 0;
    20712085    // entry.multisamplePattern = 0;
     
    20792093    {
    20802094        /* Create the host surface. */
    2081         /** @todo SVGAOTableSurfaceEntry as input parameter? */
     2095        SVGA3dMSPattern const multisamplePattern = pCmd->multisampleCount > 1 ? SVGA3D_MS_PATTERN_STANDARD : SVGA3D_MS_PATTERN_NONE;
     2096        SVGA3dMSQualityLevel const qualityLevel = pCmd->multisampleCount > 1 ? SVGA3D_MS_QUALITY_FULL : SVGA3D_MS_QUALITY_NONE;
    20822097        vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
    2083                               pCmd->multisampleCount, pCmd->autogenFilter,
    2084                               pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* fAllocMipLevels = */ false);
     2098                              pCmd->multisampleCount, multisamplePattern, qualityLevel, pCmd->autogenFilter,
     2099                              pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ false);
    20852100    }
    20862101}
     
    37533768    entry.arraySize = pCmd->arraySize;
    37543769    // entry.mobPitch = 0;
    3755     // entry.mobPitch = 0;
    37563770    entry.surface2Flags = (uint32_t)(pCmd->surfaceFlags >> UINT64_C(32));
    3757     // entry.multisamplePattern = 0;
    3758     // entry.qualityLevel = 0;
     3771    entry.multisamplePattern = pCmd->multisamplePattern;
     3772    entry.qualityLevel = pCmd->qualityLevel;
    37593773    // entry.bufferByteStride = 0;
    37603774    // entry.minLOD = 0;
     
    37653779    {
    37663780        /* Create the host surface. */
    3767         /** @todo SVGAOTableSurfaceEntry as input parameter? */
    37683781        vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
    3769                               pCmd->multisampleCount, pCmd->autogenFilter,
    3770                               pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* fAllocMipLevels = */ false);
     3782                              pCmd->multisampleCount, pCmd->multisamplePattern, pCmd->qualityLevel, pCmd->autogenFilter,
     3783                              pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ false);
    37713784    }
    37723785    return rc;
     
    37823795{
    37833796#ifdef VMSVGA3D_DX
    3784     DEBUG_BREAKPOINT_TEST();
    3785     PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
    3786     RT_NOREF(pSvgaR3State, pCmd, cbCmd);
    3787     return vmsvga3dDXResolveCopy(pThisCC, idDXContext);
     3797    //DEBUG_BREAKPOINT_TEST();
     3798    RT_NOREF(cbCmd);
     3799    return vmsvga3dDXResolveCopy(pThisCC, idDXContext, pCmd);
    37883800#else
    37893801    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     
    41634175    entry.arraySize = pCmd->arraySize;
    41644176    // entry.mobPitch = 0;
    4165     // entry.mobPitch = 0;
    41664177    entry.surface2Flags = (uint32_t)(pCmd->surfaceFlags >> UINT64_C(32));
    4167     // entry.multisamplePattern = 0;
    4168     // entry.qualityLevel = 0;
     4178    entry.multisamplePattern = pCmd->multisamplePattern;
     4179    entry.qualityLevel = pCmd->qualityLevel;
    41694180    entry.bufferByteStride = pCmd->bufferByteStride;
    41704181    // entry.minLOD = 0;
     
    41754186    {
    41764187        /* Create the host surface. */
    4177         /** @todo SVGAOTableSurfaceEntry as input parameter? */
    41784188        vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
    4179                               pCmd->multisampleCount, pCmd->autogenFilter,
    4180                               pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* fAllocMipLevels = */ false);
     4189                              pCmd->multisampleCount, pCmd->multisamplePattern, pCmd->qualityLevel, pCmd->autogenFilter,
     4190                              pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, pCmd->bufferByteStride, /* fAllocMipLevels = */ false);
    41814191    }
    41824192    return rc;
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h

    r102520 r102808  
    361361    /** Whether the VirtualBox extensions for VMSVGA device (new commands and caps) are enabled. */
    362362    bool                        fVBoxExtensions;
    363     bool                        afPadding[3];
     363    /** Whether MSAA support is enabled. */
     364    bool                        fVMSVGA3dMSAA;
     365    bool                        afPadding[2];
    364366    uint32_t                    uWidth;
    365367    uint32_t                    uHeight;
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp

    r102715 r102808  
    106106    IDXGIFactory               *pDxgiFactory;          /* DXGI Factory. */
    107107    D3D_FEATURE_LEVEL           FeatureLevel;
     108
     109    uint32_t                    MultisampleCountMask;  /* 1 << (MSCount - 1) for MSCount = 2, 4, 8, 16, 32 */
    108110
    109111    ID3D11VideoDevice          *pVideoDevice;
     
    909911                *pu32DevCap |= SVGA3D_DXFMT_DX_VERTEX_BUFFER;
    910912
    911             UINT NumQualityLevels;
    912             hr = pDevice->CheckMultisampleQualityLevels(dxgiFormat, 2, &NumQualityLevels);
    913             if (SUCCEEDED(hr) && NumQualityLevels != 0)
    914                 *pu32DevCap |= SVGA3D_DXFMT_MULTISAMPLE;
     913            if (pState->pBackend->dxDevice.MultisampleCountMask != 0)
     914            {
     915                UINT NumQualityLevels;
     916                hr = pDevice->CheckMultisampleQualityLevels(dxgiFormat, 2, &NumQualityLevels);
     917                if (SUCCEEDED(hr) && NumQualityLevels != 0)
     918                    *pu32DevCap |= SVGA3D_DXFMT_MULTISAMPLE;
     919            }
    915920        }
    916921        else
     
    13571362        rc = VERR_NOT_SUPPORTED;
    13581363
     1364    if (SUCCEEDED(hr))
     1365    {
     1366        /* Query multisample support for a common format. */
     1367        DXGI_FORMAT const dxgiFormat = DXGI_FORMAT_B8G8R8A8_UNORM;
     1368
     1369        for (uint32_t i = 2; i <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; i *= 2)
     1370        {
     1371            UINT NumQualityLevels = 0;
     1372            HRESULT hr2 = pDXDevice->pDevice->CheckMultisampleQualityLevels(dxgiFormat, i, &NumQualityLevels);
     1373            if (SUCCEEDED(hr2) && NumQualityLevels > 0)
     1374                pDXDevice->MultisampleCountMask |= UINT32_C(1) << (i - 1);
     1375        }
     1376    }
    13591377    return rc;
    13601378}
     
    20262044            if (pSurface->surfaceDesc.numArrayElements <= 1)
    20272045            {
    2028                 desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
     2046                desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1
     2047                                   ? D3D11_RTV_DIMENSION_TEXTURE2DMS
     2048                                   : D3D11_RTV_DIMENSION_TEXTURE2D;
    20292049                desc.Texture2D.MipSlice = pEntry->desc.tex.mipSlice;
    20302050            }
    20312051            else
    20322052            {
    2033                 desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
     2053                desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1
     2054                                   ? D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY
     2055                                   : D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
    20342056                desc.Texture2DArray.MipSlice = pEntry->desc.tex.mipSlice;
    20352057                desc.Texture2DArray.FirstArraySlice = pEntry->desc.tex.firstArraySlice;
     
    21022124            if (pSurface->surfaceDesc.numArrayElements <= 1)
    21032125            {
    2104                 desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
     2126                desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1
     2127                                   ? D3D11_SRV_DIMENSION_TEXTURE2DMS
     2128                                   : D3D11_SRV_DIMENSION_TEXTURE2D;
    21052129                desc.Texture2D.MostDetailedMip = pEntry->desc.tex.mostDetailedMip;
    21062130                desc.Texture2D.MipLevels = pEntry->desc.tex.mipLevels;
     
    21082132            else
    21092133            {
    2110                 desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
     2134                desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1
     2135                                   ? D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY
     2136                                   : D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
    21112137                desc.Texture2DArray.MostDetailedMip = pEntry->desc.tex.mostDetailedMip;
    21122138                desc.Texture2DArray.MipLevels = pEntry->desc.tex.mipLevels;
     
    22452271            if (pSurface->surfaceDesc.numArrayElements <= 1)
    22462272            {
    2247                 desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
     2273                desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1
     2274                                   ? D3D11_DSV_DIMENSION_TEXTURE2DMS
     2275                                   : D3D11_DSV_DIMENSION_TEXTURE2D;
    22482276                desc.Texture2D.MipSlice = pEntry->mipSlice;
    22492277            }
    22502278            else
    22512279            {
    2252                 desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
     2280                desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1
     2281                                   ? D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY
     2282                                   : D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
    22532283                desc.Texture2DArray.MipSlice = pEntry->mipSlice;
    22542284                desc.Texture2DArray.FirstArraySlice = pEntry->firstArraySlice;
     
    27022732     */
    27032733    D3D11_SUBRESOURCE_DATA *paInitialData = NULL;
    2704     if (pSurface->paMipmapLevels[0].pSurfaceData)
     2734    if (pSurface->paMipmapLevels[0].pSurfaceData && pSurface->surfaceDesc.multisampleCount <= 1)
    27052735    {
    27062736        /* Can happen for a non GBO surface or if GBO texture was updated prior to creation of the hardware resource. */
     
    29122942            td.ArraySize          = pSurface->surfaceDesc.numArrayElements;
    29132943            td.Format             = dxgiFormat;
    2914             td.SampleDesc.Count   = 1;
     2944            td.SampleDesc.Count   = pSurface->surfaceDesc.multisampleCount;
    29152945            td.SampleDesc.Quality = 0;
    29162946            td.Usage              = D3D11_USAGE_DEFAULT;
     
    29302960                td.MipLevels      = 1; /* Must be for D3D11_USAGE_DYNAMIC. */
    29312961                td.ArraySize      = 1; /* Must be for D3D11_USAGE_DYNAMIC. */
     2962                td.SampleDesc.Count   = 1;
     2963                td.SampleDesc.Quality = 0;
    29322964                td.Usage          = D3D11_USAGE_DYNAMIC;
    29332965                td.BindFlags      = D3D11_BIND_SHADER_RESOURCE; /* Have to specify a supported flag, otherwise E_INVALIDARG will be returned. */
     
    34833515    LogRelMax(1, ("VMSVGA: Single DX device mode: %s\n", pBackend->fSingleDevice ? "enabled" : "disabled"));
    34843516
    3485     vmsvga3dDXInitContextMobData(&pBackend->svgaDXContext); /** @todo */
     3517    vmsvga3dDXInitContextMobData(&pBackend->svgaDXContext);
    34863518//DEBUG_BREAKPOINT_TEST();
    34873519    return rc;
     
    35243556        if (pBackend->dxDevice.pVideoDevice)
    35253557            dxLogRelVideoCaps(pBackend->dxDevice.pVideoDevice);
     3558
     3559        if (!pThis->svga.fVMSVGA3dMSAA)
     3560            pBackend->dxDevice.MultisampleCountMask = 0;
    35263561    }
    35273562    return rc;
     
    47694804
    47704805    case SVGA3D_DEVCAP_MULTISAMPLE_2X:
    4771         *pu32Val = 0; /* boolean */
     4806        *pu32Val = RT_BOOL(pState->pBackend->dxDevice.MultisampleCountMask & (1 << (2 - 1))); /* boolean */
    47724807        break;
    47734808
    47744809    case SVGA3D_DEVCAP_MULTISAMPLE_4X:
    4775         *pu32Val = 0; /* boolean */
     4810        *pu32Val = RT_BOOL(pState->pBackend->dxDevice.MultisampleCountMask & (1 << (4 - 1))); /* boolean */
    47764811        break;
    47774812
     
    48004835
    48014836    case SVGA3D_DEVCAP_MULTISAMPLE_8X:
    4802         *pu32Val = 0; /* boolean */
     4837        *pu32Val = RT_BOOL(pState->pBackend->dxDevice.MultisampleCountMask & (1 << (8 - 1))); /* boolean */
    48034838        break;
    48044839
     
    71317166                                case SVGA3D_RESOURCE_TEXTURE2D:
    71327167                                    if (pSurface->surfaceDesc.numArrayElements <= 1)
    7133                                         aResourceDimension[idxSR] = VGPU10_RESOURCE_DIMENSION_TEXTURE2D;
     7168                                        aResourceDimension[idxSR] = pSurface->surfaceDesc.multisampleCount > 1
     7169                                                                  ? VGPU10_RESOURCE_DIMENSION_TEXTURE2DMS
     7170                                                                  : VGPU10_RESOURCE_DIMENSION_TEXTURE2D;
    71347171                                    else
    7135                                         aResourceDimension[idxSR] = VGPU10_RESOURCE_DIMENSION_TEXTURE2DARRAY;
     7172                                        aResourceDimension[idxSR] = pSurface->surfaceDesc.multisampleCount > 1
     7173                                                                  ? VGPU10_RESOURCE_DIMENSION_TEXTURE2DMSARRAY
     7174                                                                  : VGPU10_RESOURCE_DIMENSION_TEXTURE2DARRAY;
    71367175                                    break;
    71377176                                case SVGA3D_RESOURCE_TEXTURE3D:
     
    87698808    }
    87708809
     8810#ifdef DEBUG_sunlover
     8811    if (pSrcSurface->surfaceDesc.multisampleCount > 1 || pDstSurface->surfaceDesc.multisampleCount > 1)
     8812        DEBUG_BREAKPOINT_TEST();
     8813#endif
     8814
    87718815    LogFunc(("cid %d: src cid %d%s -> dst cid %d%s\n",
    87728816             pDXContext->cid, pSrcSurface->idAssociatedContext,
     
    98589902
    98599903
    9860 static DECLCALLBACK(int) vmsvga3dBackDXResolveCopy(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
    9861 {
    9862     PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
    9863 
    9864     RT_NOREF(pBackend, pDXContext);
    9865     AssertFailed(); /** @todo Implement */
    9866     return VERR_NOT_IMPLEMENTED;
     9904static DECLCALLBACK(int) vmsvga3dBackDXResolveCopy(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext,
     9905                                                   SVGA3dSurfaceId dstSid, uint32_t dstSubResource,
     9906                                                   SVGA3dSurfaceId srcSid, uint32_t srcSubResource, SVGA3dSurfaceFormat copyFormat)
     9907{
     9908    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     9909    AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE);
     9910
     9911    PVMSVGA3DSURFACE pSrcSurface;
     9912    ID3D11Resource *pSrcResource;
     9913    int rc = dxEnsureResource(pThisCC, pDXContext, srcSid, &pSrcSurface, &pSrcResource);
     9914    AssertRCReturn(rc, rc);
     9915
     9916    PVMSVGA3DSURFACE pDstSurface;
     9917    ID3D11Resource *pDstResource;
     9918    rc = dxEnsureResource(pThisCC, pDXContext, dstSid, &pDstSurface, &pDstResource);
     9919    AssertRCReturn(rc, rc);
     9920
     9921    LogFunc(("cid %d: src sid = %u -> dst sid = %u\n", pDXContext->cid, srcSid, dstSid));
     9922
     9923    DXGI_FORMAT const dxgiFormat = vmsvgaDXSurfaceFormat2Dxgi(copyFormat);
     9924    pDXDevice->pImmediateContext->ResolveSubresource(pDstResource, dstSubResource, pSrcResource, srcSubResource, dxgiFormat);
     9925
     9926    pDstSurface->pBackendSurface->cidDrawing = pDXContext->cid;
     9927    return VINF_SUCCESS;
    98679928}
    98689929
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-savedstate.cpp

    r102520 r102808  
    7171
    7272    /** @todo fAllocMipLevels=false and alloc miplevels if there is data to be loaded. */
    73     rc = vmsvga3dSurfaceDefine(pThisCC, sid, entrySurface.surface1Flags, entrySurface.format,
    74                                entrySurface.multisampleCount, entrySurface.autogenFilter,
     73    rc = vmsvga3dSurfaceDefine(pThisCC, sid, RT_MAKE_U64(entrySurface.surface1Flags, entrySurface.surface2Flags), entrySurface.format,
     74                               entrySurface.multisampleCount, (SVGA3dMSPattern)entrySurface.multisamplePattern, (SVGA3dMSQualityLevel)entrySurface.qualityLevel, entrySurface.autogenFilter,
    7575                               entrySurface.numMipLevels, &entrySurface.size,
    76                                entrySurface.arraySize,
     76                               entrySurface.arraySize, entrySurface.bufferByteStride,
    7777                               /* fAllocMipLevels = */ true);
    7878    AssertRCReturn(rc, rc);
     
    309309            uint32_t idx = iMipmap + iArray * pSurface->cLevels;
    310310            PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[idx];
     311
     312            /* Multisample surface content can't be accessed. */
     313            if (pSurface->surfaceDesc.multisampleCount > 1)
     314            {
     315                /* No data follows */
     316                rc = pHlp->pfnSSMPutBool(pSSM, false);
     317                AssertRCReturn(rc, rc);
     318                continue;
     319            }
    311320
    312321            if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface))
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp

    r102714 r102808  
    26242624
    26252625
    2626 int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext)
     2626int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXResolveCopy const *pCmd)
    26272627{
    26282628    int rc;
     
    26362636    AssertRCReturn(rc, rc);
    26372637
    2638     rc = pSvgaR3State->pFuncsDX->pfnDXResolveCopy(pThisCC, pDXContext);
     2638    rc = pSvgaR3State->pFuncsDX->pfnDXResolveCopy(pThisCC, pDXContext, pCmd->dstSid, pCmd->dstSubResource,
     2639                                                  pCmd->srcSid, pCmd->srcSubResource, pCmd->copyFormat);
    26392640    return rc;
    26402641}
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-savedstate.cpp

    r98103 r102808  
    685685
    686686                rc = vmsvga3dSurfaceDefine(pThisCC, sid, surface.f.surfaceFlags, surface.format, surface.multiSampleCount,
    687                                            surface.autogenFilter, surface.cLevels, &pMipmapLevelSize[0], /* arraySize = */ 0, /* fAllocMipLevels = */ true);
     687                                           SVGA3D_MS_PATTERN_NONE, SVGA3D_MS_QUALITY_NONE,
     688                                           surface.autogenFilter, surface.cLevels, &pMipmapLevelSize[0], /* arraySize = */ 0, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ true);
    688689                AssertRCReturn(rc, rc);
    689690
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp

    r102520 r102808  
    313313}
    314314
    315 void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize,
     315void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize, uint32_t multisampleCount,
    316316                                  uint32_t *pcBlocksX,
    317317                                  uint32_t *pcBlocksY,
     
    331331    cbSurfacePlane = clamped_umul32(cbSurfacePlane, desc->bytes_per_block);
    332332
    333     uint32_t const cbSurface = clamped_umul32(cbSurfacePlane, czBlocks);
     333    uint32_t const cbSurfaceResolved = clamped_umul32(cbSurfacePlane, czBlocks);
     334
     335    uint32_t const cbSurface = clamped_umul32(cbSurfaceResolved, RT_MAX(multisampleCount, 1));
    334336
    335337    *pcBlocksX = cxBlocks;
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r99877 r102808  
    27412741                AssertRC(rc);
    27422742
    2743                 rc = vmsvga3dSurfaceDefine(pThisCC, sid, surfaceFlags, format, multisampleCount, autogenFilter,
    2744                                            cMipLevels, &pMipLevelSize[0], /* arraySize = */ 0, /* fAllocMipLevels = */ true);
     2743                rc = vmsvga3dSurfaceDefine(pThisCC, sid, surfaceFlags, format, multisampleCount, SVGA3D_MS_PATTERN_NONE, SVGA3D_MS_QUALITY_NONE, autogenFilter,
     2744                                           cMipLevels, &pMipLevelSize[0], /* arraySize = */ 0, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ true);
    27452745                AssertRC(rc);
    27462746
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp

    r102520 r102808  
    8686 * @param   format              .
    8787 * @param   multisampleCount    .
     88 * @param   multisamplePattern  .
     89 * @param   qualityLevel        .
    8890 * @param   autogenFilter       .
    8991 * @param   numMipLevels        .
    9092 * @param   pMipLevel0Size      .
    9193 * @param   arraySize           Number of elements in a texture array.
     94 * @param   bufferByteStride    .
    9295 * @param   fAllocMipLevels     .
    9396 */
    9497int vmsvga3dSurfaceDefine(PVGASTATECC pThisCC, uint32_t sid, SVGA3dSurfaceAllFlags surfaceFlags, SVGA3dSurfaceFormat format,
    95                           uint32_t multisampleCount, SVGA3dTextureFilter autogenFilter,
    96                           uint32_t numMipLevels, SVGA3dSize const *pMipLevel0Size, uint32_t arraySize, bool fAllocMipLevels)
     98                          uint32_t multisampleCount, SVGA3dMSPattern multisamplePattern, SVGA3dMSQualityLevel qualityLevel, SVGA3dTextureFilter autogenFilter,
     99                          uint32_t numMipLevels, SVGA3dSize const *pMipLevel0Size, uint32_t arraySize, uint32_t bufferByteStride, bool fAllocMipLevels)
    97100{
    98101    PVMSVGA3DSURFACE pSurface;
     
    140143    else
    141144        pSurface->surfaceDesc.numArrayElements = 1;
     145
     146    pSurface->surfaceDesc.multisampleCount = RT_MAX(multisampleCount, 1);
     147    pSurface->surfaceDesc.multisamplePattern = RT_CLAMP(multisamplePattern, SVGA3D_MS_PATTERN_MIN, SVGA3D_MS_PATTERN_MAX);
     148    pSurface->surfaceDesc.qualityLevel = RT_CLAMP(qualityLevel, SVGA3D_MS_QUALITY_MIN, SVGA3D_MS_QUALITY_MAX);
     149    pSurface->surfaceDesc.bufferByteStride = bufferByteStride;
    142150
    143151    /** @todo This 'switch' and the surfaceFlags tweaks should not be necessary.
     
    228236    pSurface->cFaces            = (uint32_t)((surfaceFlags & SVGA3D_SURFACE_CUBEMAP) ? 6 : 1);
    229237    pSurface->cLevels           = numMipLevels;
    230     pSurface->multiSampleCount  = multisampleCount;
     238    pSurface->multiSampleCount  = pSurface->surfaceDesc.multisampleCount; /** @todo Remove the field. */
    231239    pSurface->autogenFilter     = autogenFilter;
    232240    Assert(autogenFilter != SVGA3D_TEX_FILTER_FLATCUBIC);
     
    257265            uint32_t cbSurfacePlane;
    258266            uint32_t cbSurface;
    259             vmsvga3dSurfaceMipBufferSize(format, mipmapSize,
     267            vmsvga3dSurfaceMipBufferSize(format, mipmapSize, pSurface->surfaceDesc.multisampleCount,
    260268                                         &cBlocksX, &cBlocksY, &cbSurfacePitch, &cbSurfacePlane, &cbSurface);
    261269            AssertBreakStmt(cbMemRemaining >= cbSurface, rc = VERR_INVALID_PARAMETER);
     
    17321740
    17331741
     1742bool vmsvga3dIsMultisampleSurface(PVGASTATECC pThisCC, SVGA3dSurfaceId sid)
     1743{
     1744    PVMSVGA3DSURFACE pSurface;
     1745    int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, sid, &pSurface);
     1746    AssertRCReturn(rc, 0);
     1747
     1748    return pSurface->surfaceDesc.multisampleCount > 1;
     1749}
     1750
     1751
    17341752/*
    17351753 * Calculates memory layout of a surface box for memcpy:
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h

    r102520 r102808  
    5454
    5555
    56 /** @todo Use this as a parameter for vmsvga3dSurfaceDefine and a field in VMSVGA3DSURFACE instead of a multiple values. */
    5756/* A surface description provided by the guest. Mostly mirrors SVGA3dCmdDefineGBSurface_v4 */
    5857typedef struct VMSVGA3D_SURFACE_DESC
     
    117116
    118117int vmsvga3dSurfaceDefine(PVGASTATECC pThisCC, uint32_t sid, SVGA3dSurfaceAllFlags surfaceFlags, SVGA3dSurfaceFormat format,
    119                           uint32_t multisampleCount, SVGA3dTextureFilter autogenFilter,
    120                           uint32_t cMipLevels, SVGA3dSize const *pMipLevel0Size, uint32_t arraySize, bool fAllocMipLevels);
     118                          uint32_t multisampleCount, SVGA3dMSPattern multisamplePattern, SVGA3dMSQualityLevel qualityLevel, SVGA3dTextureFilter autogenFilter,
     119                          uint32_t numMipLevels, SVGA3dSize const *pMipLevel0Size, uint32_t arraySize, uint32_t bufferByteStride, bool fAllocMipLevels);
    121120int vmsvga3dSurfaceDestroy(PVGASTATECC pThisCC, uint32_t sid);
    122121int vmsvga3dSurfaceCopy(PVGASTATECC pThisCC, SVGA3dSurfaceImageId dest, SVGA3dSurfaceImageId src,
     
    197196uint32_t vmsvga3dGetArrayElements(PVGASTATECC pThisCC, SVGA3dSurfaceId sid);
    198197uint32_t vmsvga3dGetSubresourceCount(PVGASTATECC pThisCC, SVGA3dSurfaceId sid);
     198bool vmsvga3dIsMultisampleSurface(PVGASTATECC pThisCC, SVGA3dSurfaceId sid);
    199199
    200200DECLINLINE(uint32_t) vmsvga3dCalcSubresource(uint32_t iMipLevel, uint32_t iArray, uint32_t cMipLevels)
     
    345345                                   uint32_t *pu32BlockHeight,
    346346                                   uint32_t *pcbPitchBlock);
    347 void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize,
     347void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize, uint32_t multisampleCount,
    348348                                  uint32_t *pcBlocksX,
    349349                                  uint32_t *pcBlocksY,
     
    532532    DECLCALLBACKMEMBER(int, pfnScreenCopy,                  (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
    533533    DECLCALLBACKMEMBER(int, pfnIntraSurfaceCopy,            (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSurfaceImageId const &surface, SVGA3dCopyBox const &box));
    534     DECLCALLBACKMEMBER(int, pfnDXResolveCopy,               (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
     534    DECLCALLBACKMEMBER(int, pfnDXResolveCopy,               (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSurfaceId dstSid, uint32_t dstSubResource, SVGA3dSurfaceId srcSid, uint32_t srcSubResource, SVGA3dSurfaceFormat copyFormat));
    535535    DECLCALLBACKMEMBER(int, pfnDXPredResolveCopy,           (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
    536536    DECLCALLBACKMEMBER(int, pfnDXPredConvertRegion,         (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
     
    708708int vmsvga3dDXGrowCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXGrowCOTable const *pCmd);
    709709int vmsvga3dIntraSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdIntraSurfaceCopy const *pCmd);
    710 int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
     710int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXResolveCopy const *pCmd);
    711711int vmsvga3dDXPredResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext);
    712712int vmsvga3dDXPredConvertRegion(PVGASTATECC pThisCC, uint32_t idDXContext);
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r100702 r102808  
    64786478                                            "|VMSVGA3dEnabled"
    64796479                                            "|VMSVGA3dOverlayEnabled"
     6480                                            "|VMSVGA3dMSAA"
    64806481# endif
    64816482                                            "|SuppressNewYearSplash"
     
    65496550    AssertLogRelRCReturn(rc, rc);
    65506551    Log(("VMSVGA: VMSVGA3dOverlayEnabled = %d\n", pThis->svga.f3DOverlayEnabled));
     6552
     6553    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "VMSVGA3dMSAA", &pThis->svga.fVMSVGA3dMSAA, true);
     6554    AssertLogRelRCReturn(rc, rc);
     6555    Log(("VMSVGA: VMSVGA3dMSAA = %d\n", pThis->svga.fVMSVGA3dMSAA));
    65516556# endif
    65526557
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