From ef942f3fe3a8921d1934fe3253f8161a85767cc1 Mon Sep 17 00:00:00 2001 From: Roberto Nibali Date: Wed, 8 Jul 2026 21:32:04 +0200 Subject: [PATCH] VMSVGA: avoid initial data for DX depth/stencil textures Signed-off-by: Roberto Nibali --- src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp index 13880a6b7f7..696cc24828b 100644 --- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp +++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp @@ -3241,9 +3241,14 @@ static int vmsvga3dBackSurfaceCreateResource(PVGASTATECC pThisCC, PVMSVGA3DSURFA * On NVidia the host driver does not allow initial data for large textures with D3D11_BIND_DECODER flag. */ D3D11_SUBRESOURCE_DATA *paInitialData = NULL; + /* Depth/stencil resources are initialized by subsequent rendering commands + * such as clears. Do not upload the optional host-side backing buffer here: + * it may be stale after hardware realization and DXMT's Metal path validates + * the source bytes during texture creation. + */ if ( pSurface->paMipmapLevels[0].pSurfaceData && pSurface->surfaceDesc.multisampleCount <= 1 - && (BindFlags & D3D11_BIND_DECODER) == 0 + && (BindFlags & (D3D11_BIND_DECODER | D3D11_BIND_DEPTH_STENCIL)) == 0 ) { /* Can happen for a non GBO surface or if GBO texture was updated prior to creation of the hardware resource. */