- Timestamp:
- Jan 10, 2024 8:16:30 AM (13 months ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp
r102616 r102808 1299 1299 1300 1300 /* 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; 1301 1303 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); 1304 1306 } 1305 1307 … … 1375 1377 // entry.arraySize = 0; 1376 1378 // entry.mobPitch = 0; 1379 // entry.surface2Flags = 0; 1380 // entry.multisamplePattern = 0; 1381 // entry.qualityLevel = 0; 1382 // entry.bufferByteStride = 0; 1383 // entry.minLOD = 0; 1377 1384 int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE], 1378 1385 pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry)); … … 1380 1387 { 1381 1388 /* 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; 1382 1391 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); 1385 1394 } 1386 1395 } … … 1657 1666 SVGA3dTransferType enmTransfer) 1658 1667 { 1668 if (vmsvga3dIsMultisampleSurface(pThisCC, pImage->sid)) 1669 { 1670 /* Multisample surfaces can't be accessed. Skip. */ 1671 return VINF_SUCCESS; 1672 } 1673 1659 1674 PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State; 1660 1675 … … 2067 2082 entry.arraySize = pCmd->arraySize; 2068 2083 // entry.mobPitch = 0; 2069 // entry.mobPitch = 0;2070 2084 // entry.surface2Flags = 0; 2071 2085 // entry.multisamplePattern = 0; … … 2079 2093 { 2080 2094 /* 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; 2082 2097 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); 2085 2100 } 2086 2101 } … … 3753 3768 entry.arraySize = pCmd->arraySize; 3754 3769 // entry.mobPitch = 0; 3755 // entry.mobPitch = 0;3756 3770 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; 3759 3773 // entry.bufferByteStride = 0; 3760 3774 // entry.minLOD = 0; … … 3765 3779 { 3766 3780 /* Create the host surface. */ 3767 /** @todo SVGAOTableSurfaceEntry as input parameter? */3768 3781 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); 3771 3784 } 3772 3785 return rc; … … 3782 3795 { 3783 3796 #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); 3788 3800 #else 3789 3801 RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd); … … 4163 4175 entry.arraySize = pCmd->arraySize; 4164 4176 // entry.mobPitch = 0; 4165 // entry.mobPitch = 0;4166 4177 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; 4169 4180 entry.bufferByteStride = pCmd->bufferByteStride; 4170 4181 // entry.minLOD = 0; … … 4175 4186 { 4176 4187 /* Create the host surface. */ 4177 /** @todo SVGAOTableSurfaceEntry as input parameter? */4178 4188 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); 4181 4191 } 4182 4192 return rc; -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h
r102520 r102808 361 361 /** Whether the VirtualBox extensions for VMSVGA device (new commands and caps) are enabled. */ 362 362 bool fVBoxExtensions; 363 bool afPadding[3]; 363 /** Whether MSAA support is enabled. */ 364 bool fVMSVGA3dMSAA; 365 bool afPadding[2]; 364 366 uint32_t uWidth; 365 367 uint32_t uHeight; -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp
r102715 r102808 106 106 IDXGIFactory *pDxgiFactory; /* DXGI Factory. */ 107 107 D3D_FEATURE_LEVEL FeatureLevel; 108 109 uint32_t MultisampleCountMask; /* 1 << (MSCount - 1) for MSCount = 2, 4, 8, 16, 32 */ 108 110 109 111 ID3D11VideoDevice *pVideoDevice; … … 909 911 *pu32DevCap |= SVGA3D_DXFMT_DX_VERTEX_BUFFER; 910 912 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 } 915 920 } 916 921 else … … 1357 1362 rc = VERR_NOT_SUPPORTED; 1358 1363 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 } 1359 1377 return rc; 1360 1378 } … … 2026 2044 if (pSurface->surfaceDesc.numArrayElements <= 1) 2027 2045 { 2028 desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; 2046 desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1 2047 ? D3D11_RTV_DIMENSION_TEXTURE2DMS 2048 : D3D11_RTV_DIMENSION_TEXTURE2D; 2029 2049 desc.Texture2D.MipSlice = pEntry->desc.tex.mipSlice; 2030 2050 } 2031 2051 else 2032 2052 { 2033 desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; 2053 desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1 2054 ? D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY 2055 : D3D11_RTV_DIMENSION_TEXTURE2DARRAY; 2034 2056 desc.Texture2DArray.MipSlice = pEntry->desc.tex.mipSlice; 2035 2057 desc.Texture2DArray.FirstArraySlice = pEntry->desc.tex.firstArraySlice; … … 2102 2124 if (pSurface->surfaceDesc.numArrayElements <= 1) 2103 2125 { 2104 desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; 2126 desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1 2127 ? D3D11_SRV_DIMENSION_TEXTURE2DMS 2128 : D3D11_SRV_DIMENSION_TEXTURE2D; 2105 2129 desc.Texture2D.MostDetailedMip = pEntry->desc.tex.mostDetailedMip; 2106 2130 desc.Texture2D.MipLevels = pEntry->desc.tex.mipLevels; … … 2108 2132 else 2109 2133 { 2110 desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; 2134 desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1 2135 ? D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY 2136 : D3D11_SRV_DIMENSION_TEXTURE2DARRAY; 2111 2137 desc.Texture2DArray.MostDetailedMip = pEntry->desc.tex.mostDetailedMip; 2112 2138 desc.Texture2DArray.MipLevels = pEntry->desc.tex.mipLevels; … … 2245 2271 if (pSurface->surfaceDesc.numArrayElements <= 1) 2246 2272 { 2247 desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; 2273 desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1 2274 ? D3D11_DSV_DIMENSION_TEXTURE2DMS 2275 : D3D11_DSV_DIMENSION_TEXTURE2D; 2248 2276 desc.Texture2D.MipSlice = pEntry->mipSlice; 2249 2277 } 2250 2278 else 2251 2279 { 2252 desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY; 2280 desc.ViewDimension = pSurface->surfaceDesc.multisampleCount > 1 2281 ? D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY 2282 : D3D11_DSV_DIMENSION_TEXTURE2DARRAY; 2253 2283 desc.Texture2DArray.MipSlice = pEntry->mipSlice; 2254 2284 desc.Texture2DArray.FirstArraySlice = pEntry->firstArraySlice; … … 2702 2732 */ 2703 2733 D3D11_SUBRESOURCE_DATA *paInitialData = NULL; 2704 if (pSurface->paMipmapLevels[0].pSurfaceData )2734 if (pSurface->paMipmapLevels[0].pSurfaceData && pSurface->surfaceDesc.multisampleCount <= 1) 2705 2735 { 2706 2736 /* Can happen for a non GBO surface or if GBO texture was updated prior to creation of the hardware resource. */ … … 2912 2942 td.ArraySize = pSurface->surfaceDesc.numArrayElements; 2913 2943 td.Format = dxgiFormat; 2914 td.SampleDesc.Count = 1;2944 td.SampleDesc.Count = pSurface->surfaceDesc.multisampleCount; 2915 2945 td.SampleDesc.Quality = 0; 2916 2946 td.Usage = D3D11_USAGE_DEFAULT; … … 2930 2960 td.MipLevels = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ 2931 2961 td.ArraySize = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ 2962 td.SampleDesc.Count = 1; 2963 td.SampleDesc.Quality = 0; 2932 2964 td.Usage = D3D11_USAGE_DYNAMIC; 2933 2965 td.BindFlags = D3D11_BIND_SHADER_RESOURCE; /* Have to specify a supported flag, otherwise E_INVALIDARG will be returned. */ … … 3483 3515 LogRelMax(1, ("VMSVGA: Single DX device mode: %s\n", pBackend->fSingleDevice ? "enabled" : "disabled")); 3484 3516 3485 vmsvga3dDXInitContextMobData(&pBackend->svgaDXContext); /** @todo */3517 vmsvga3dDXInitContextMobData(&pBackend->svgaDXContext); 3486 3518 //DEBUG_BREAKPOINT_TEST(); 3487 3519 return rc; … … 3524 3556 if (pBackend->dxDevice.pVideoDevice) 3525 3557 dxLogRelVideoCaps(pBackend->dxDevice.pVideoDevice); 3558 3559 if (!pThis->svga.fVMSVGA3dMSAA) 3560 pBackend->dxDevice.MultisampleCountMask = 0; 3526 3561 } 3527 3562 return rc; … … 4769 4804 4770 4805 case SVGA3D_DEVCAP_MULTISAMPLE_2X: 4771 *pu32Val = 0; /* boolean */4806 *pu32Val = RT_BOOL(pState->pBackend->dxDevice.MultisampleCountMask & (1 << (2 - 1))); /* boolean */ 4772 4807 break; 4773 4808 4774 4809 case SVGA3D_DEVCAP_MULTISAMPLE_4X: 4775 *pu32Val = 0; /* boolean */4810 *pu32Val = RT_BOOL(pState->pBackend->dxDevice.MultisampleCountMask & (1 << (4 - 1))); /* boolean */ 4776 4811 break; 4777 4812 … … 4800 4835 4801 4836 case SVGA3D_DEVCAP_MULTISAMPLE_8X: 4802 *pu32Val = 0; /* boolean */4837 *pu32Val = RT_BOOL(pState->pBackend->dxDevice.MultisampleCountMask & (1 << (8 - 1))); /* boolean */ 4803 4838 break; 4804 4839 … … 7131 7166 case SVGA3D_RESOURCE_TEXTURE2D: 7132 7167 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; 7134 7171 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; 7136 7175 break; 7137 7176 case SVGA3D_RESOURCE_TEXTURE3D: … … 8769 8808 } 8770 8809 8810 #ifdef DEBUG_sunlover 8811 if (pSrcSurface->surfaceDesc.multisampleCount > 1 || pDstSurface->surfaceDesc.multisampleCount > 1) 8812 DEBUG_BREAKPOINT_TEST(); 8813 #endif 8814 8771 8815 LogFunc(("cid %d: src cid %d%s -> dst cid %d%s\n", 8772 8816 pDXContext->cid, pSrcSurface->idAssociatedContext, … … 9858 9902 9859 9903 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; 9904 static 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; 9867 9928 } 9868 9929 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-savedstate.cpp
r102520 r102808 71 71 72 72 /** @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, 75 75 entrySurface.numMipLevels, &entrySurface.size, 76 entrySurface.arraySize, 76 entrySurface.arraySize, entrySurface.bufferByteStride, 77 77 /* fAllocMipLevels = */ true); 78 78 AssertRCReturn(rc, rc); … … 309 309 uint32_t idx = iMipmap + iArray * pSurface->cLevels; 310 310 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 } 311 320 312 321 if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)) -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp
r102714 r102808 2624 2624 2625 2625 2626 int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext )2626 int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXResolveCopy const *pCmd) 2627 2627 { 2628 2628 int rc; … … 2636 2636 AssertRCReturn(rc, rc); 2637 2637 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); 2639 2640 return rc; 2640 2641 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-savedstate.cpp
r98103 r102808 685 685 686 686 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); 688 689 AssertRCReturn(rc, rc); 689 690 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
r102520 r102808 313 313 } 314 314 315 void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize, 315 void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize, uint32_t multisampleCount, 316 316 uint32_t *pcBlocksX, 317 317 uint32_t *pcBlocksY, … … 331 331 cbSurfacePlane = clamped_umul32(cbSurfacePlane, desc->bytes_per_block); 332 332 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)); 334 336 335 337 *pcBlocksX = cxBlocks; -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r99877 r102808 2741 2741 AssertRC(rc); 2742 2742 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); 2745 2745 AssertRC(rc); 2746 2746 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r102520 r102808 86 86 * @param format . 87 87 * @param multisampleCount . 88 * @param multisamplePattern . 89 * @param qualityLevel . 88 90 * @param autogenFilter . 89 91 * @param numMipLevels . 90 92 * @param pMipLevel0Size . 91 93 * @param arraySize Number of elements in a texture array. 94 * @param bufferByteStride . 92 95 * @param fAllocMipLevels . 93 96 */ 94 97 int vmsvga3dSurfaceDefine(PVGASTATECC pThisCC, uint32_t sid, SVGA3dSurfaceAllFlags surfaceFlags, SVGA3dSurfaceFormat format, 95 uint32_t multisampleCount, SVGA3d TextureFilter 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) 97 100 { 98 101 PVMSVGA3DSURFACE pSurface; … … 140 143 else 141 144 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; 142 150 143 151 /** @todo This 'switch' and the surfaceFlags tweaks should not be necessary. … … 228 236 pSurface->cFaces = (uint32_t)((surfaceFlags & SVGA3D_SURFACE_CUBEMAP) ? 6 : 1); 229 237 pSurface->cLevels = numMipLevels; 230 pSurface->multiSampleCount = multisampleCount;238 pSurface->multiSampleCount = pSurface->surfaceDesc.multisampleCount; /** @todo Remove the field. */ 231 239 pSurface->autogenFilter = autogenFilter; 232 240 Assert(autogenFilter != SVGA3D_TEX_FILTER_FLATCUBIC); … … 257 265 uint32_t cbSurfacePlane; 258 266 uint32_t cbSurface; 259 vmsvga3dSurfaceMipBufferSize(format, mipmapSize, 267 vmsvga3dSurfaceMipBufferSize(format, mipmapSize, pSurface->surfaceDesc.multisampleCount, 260 268 &cBlocksX, &cBlocksY, &cbSurfacePitch, &cbSurfacePlane, &cbSurface); 261 269 AssertBreakStmt(cbMemRemaining >= cbSurface, rc = VERR_INVALID_PARAMETER); … … 1732 1740 1733 1741 1742 bool 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 1734 1752 /* 1735 1753 * Calculates memory layout of a surface box for memcpy: -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r102520 r102808 54 54 55 55 56 /** @todo Use this as a parameter for vmsvga3dSurfaceDefine and a field in VMSVGA3DSURFACE instead of a multiple values. */57 56 /* A surface description provided by the guest. Mostly mirrors SVGA3dCmdDefineGBSurface_v4 */ 58 57 typedef struct VMSVGA3D_SURFACE_DESC … … 117 116 118 117 int vmsvga3dSurfaceDefine(PVGASTATECC pThisCC, uint32_t sid, SVGA3dSurfaceAllFlags surfaceFlags, SVGA3dSurfaceFormat format, 119 uint32_t multisampleCount, SVGA3d TextureFilter 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); 121 120 int vmsvga3dSurfaceDestroy(PVGASTATECC pThisCC, uint32_t sid); 122 121 int vmsvga3dSurfaceCopy(PVGASTATECC pThisCC, SVGA3dSurfaceImageId dest, SVGA3dSurfaceImageId src, … … 197 196 uint32_t vmsvga3dGetArrayElements(PVGASTATECC pThisCC, SVGA3dSurfaceId sid); 198 197 uint32_t vmsvga3dGetSubresourceCount(PVGASTATECC pThisCC, SVGA3dSurfaceId sid); 198 bool vmsvga3dIsMultisampleSurface(PVGASTATECC pThisCC, SVGA3dSurfaceId sid); 199 199 200 200 DECLINLINE(uint32_t) vmsvga3dCalcSubresource(uint32_t iMipLevel, uint32_t iArray, uint32_t cMipLevels) … … 345 345 uint32_t *pu32BlockHeight, 346 346 uint32_t *pcbPitchBlock); 347 void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize, 347 void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize, uint32_t multisampleCount, 348 348 uint32_t *pcBlocksX, 349 349 uint32_t *pcBlocksY, … … 532 532 DECLCALLBACKMEMBER(int, pfnScreenCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)); 533 533 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)); 535 535 DECLCALLBACKMEMBER(int, pfnDXPredResolveCopy, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)); 536 536 DECLCALLBACKMEMBER(int, pfnDXPredConvertRegion, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)); … … 708 708 int vmsvga3dDXGrowCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXGrowCOTable const *pCmd); 709 709 int vmsvga3dIntraSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdIntraSurfaceCopy const *pCmd); 710 int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext );710 int vmsvga3dDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXResolveCopy const *pCmd); 711 711 int vmsvga3dDXPredResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext); 712 712 int vmsvga3dDXPredConvertRegion(PVGASTATECC pThisCC, uint32_t idDXContext); -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r100702 r102808 6478 6478 "|VMSVGA3dEnabled" 6479 6479 "|VMSVGA3dOverlayEnabled" 6480 "|VMSVGA3dMSAA" 6480 6481 # endif 6481 6482 "|SuppressNewYearSplash" … … 6549 6550 AssertLogRelRCReturn(rc, rc); 6550 6551 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)); 6551 6556 # endif 6552 6557
Note:
See TracChangeset
for help on using the changeset viewer.