Changeset 88831 in vbox
- Timestamp:
- May 3, 2021 12:37:23 PM (4 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp
r88803 r88831 911 911 912 912 #ifdef VBOX_WITH_VMSVGA3D 913 int vmsvgaR3UpdateGBSurface(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBox)913 int vmsvgaR3UpdateGBSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBox) 914 914 { 915 915 PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State; … … 924 924 { 925 925 VMSVGA3D_MAPPED_SURFACE map; 926 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, pImageId, pBox, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map);926 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, idDXContext, pImageId, pBox, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map); 927 927 if (RT_SUCCESS(rc)) 928 928 { … … 959 959 960 960 961 int vmsvgaR3UpdateGBSurfaceEx(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBoxDst, SVGA3dPoint const *pPtSrc)961 int vmsvgaR3UpdateGBSurfaceEx(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBoxDst, SVGA3dPoint const *pPtSrc) 962 962 { 963 963 /* pPtSrc must be verified by the caller. */ … … 973 973 { 974 974 VMSVGA3D_MAPPED_SURFACE map; 975 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, pImageId, pBoxDst, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map);975 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, idDXContext, pImageId, pBoxDst, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map); 976 976 if (RT_SUCCESS(rc)) 977 977 { … … 1431 1431 static int idxBitmap = 0; 1432 1432 char *pszFilename = RTStrAPrintf2("bmp\\%s%d.bmp", pszPrefix, idxBitmap++); 1433 vmsvga3dBmpWrite(pszFilename, pMap); 1433 int rc = vmsvga3dBmpWrite(pszFilename, pMap); 1434 Log(("WriteBmpFile %s %Rrc\n", pszFilename, rc)); RT_NOREF(rc); 1434 1435 RTStrFree(pszFilename); 1435 1436 } … … 1438 1439 1439 1440 /* SVGA_3D_CMD_UPDATE_GB_IMAGE 1101 */ 1440 static void vmsvga3dCmdUpdateGBImage(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBImage const *pCmd)1441 static void vmsvga3dCmdUpdateGBImage(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdUpdateGBImage const *pCmd) 1441 1442 { 1442 1443 // ASMBreakpoint(); … … 1456 1457 { 1457 1458 VMSVGA3D_MAPPED_SURFACE map; 1458 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, &pCmd->image, &pCmd->box, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map); 1459 /** @todo vmsvga3dSurfaceMap */ 1460 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, idDXContext, &pCmd->image, &pCmd->box, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map); 1459 1461 if (RT_SUCCESS(rc)) 1460 1462 { … … 1709 1711 /* Copy the screen target surface to the memory buffer. */ 1710 1712 VMSVGA3D_MAPPED_SURFACE map; 1711 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, &entryScreenTarget.image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);1713 rc = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, SVGA_ID_INVALID, &entryScreenTarget.image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map); 1712 1714 if (RT_SUCCESS(rc)) 1713 1715 { … … 1743 1745 static void vmsvga3dCmdDefineGBSurface_v2(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v2 const *pCmd) 1744 1746 { 1747 //ASMBreakpoint(); 1745 1748 PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State; 1746 1749 … … 1891 1894 if (pCmd->mobid != SVGA_ID_INVALID) 1892 1895 { 1893 /* Bind a new context. Copy existing data from the gu yest backing memory. */1896 /* Bind a new context. Copy existing data from the guest backing memory. */ 1894 1897 if (pCmd->validContents) 1895 1898 { … … 4281 4284 SVGA3dCmdUpdateGBImage *pCmd = (SVGA3dCmdUpdateGBImage *)pvCmd; 4282 4285 VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd)); 4283 vmsvga3dCmdUpdateGBImage(pThisCC, pCmd);4286 vmsvga3dCmdUpdateGBImage(pThisCC, idDXContext, pCmd); 4284 4287 break; 4285 4288 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r88787 r88831 10 10 * - Log4 for hex dumps of 3D data. 11 11 * - Log5 for info about GMR pages. 12 * - Log6 for DX shaders. 13 * - Log7 for SVGA command dump. 12 14 * - LogRel for the usual important stuff. 13 15 * - LogRel2 for cursor. … … 152 154 #include <VBoxVideo.h> 153 155 #include <VBox/bioslogo.h> 156 157 #ifdef LOG_ENABLED 158 RT_C_DECLS_BEGIN 159 #include "svgadump/svga_dump.h" 160 RT_C_DECLS_END 161 #endif 154 162 155 163 /* should go BEFORE any other DevVGA include to make all DevVGA.h config defines be visible */ … … 3440 3448 uint32_t cbCmd = sizeof(uint32_t); 3441 3449 3442 LogFlowFunc(("%s %d\n", vmsvgaR3FifoCmdToString(cmdId), cmdId)); 3450 LogFlowFunc(("[cid=%d] %s %d\n", (int32_t)idDXContext, vmsvgaR3FifoCmdToString(cmdId), cmdId)); 3451 #ifdef LOG_ENABLED 3452 if (SVGA_3D_CMD_BASE <= cmdId && cmdId < SVGA_3D_CMD_MAX) 3453 { 3454 SVGA3dCmdHeader const *header = (SVGA3dCmdHeader *)pu8Cmd; 3455 svga_dump_command(cmdId, (uint8_t *)&header[1], header->size); 3456 } 3457 else if (cmdId == SVGA_CMD_FENCE) 3458 { 3459 Log7(("\tSVGA_CMD_FENCE\n")); 3460 Log7(("\t\t0x%08x\n", ((uint32_t *)pu8Cmd)[1])); 3461 } 3462 #endif 3443 3463 3444 3464 /* At the end of the switch cbCmd is equal to the total length of the command including the cmdId. … … 6064 6084 } 6065 6085 6086 static DECLCALLBACK(size_t) vmsvga3dFloatFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, 6087 const char *pszType, void const *pvValue, 6088 int cchWidth, int cchPrecision, unsigned fFlags, void *pvUser) 6089 { 6090 RT_NOREF(pszType, cchWidth, cchPrecision, fFlags, pvUser); 6091 double const v = *(double *)&pvValue; 6092 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, FLOAT_FMT_STR, FLOAT_FMT_ARGS(v)); 6093 } 6094 6066 6095 /** 6067 6096 * Initialize the SVGA hardware state … … 6076 6105 PVMSVGAR3STATE pSVGAState; 6077 6106 int rc; 6107 6108 rc = RTStrFormatTypeRegister("float", vmsvga3dFloatFormat, NULL); 6109 AssertMsgReturn(RT_SUCCESS(rc) || rc == VERR_ALREADY_EXISTS, ("%Rrc\n", rc), rc); 6078 6110 6079 6111 pThis->svga.cScratchRegion = VMSVGA_SCRATCH_SIZE; -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h
r88787 r88831 644 644 645 645 #ifdef VBOX_WITH_VMSVGA3D 646 int vmsvgaR3UpdateGBSurface(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBox);647 int vmsvgaR3UpdateGBSurfaceEx(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBoxDst, SVGA3dPoint const *pPtSrc);646 int vmsvgaR3UpdateGBSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBox); 647 int vmsvgaR3UpdateGBSurfaceEx(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBoxDst, SVGA3dPoint const *pPtSrc); 648 648 #endif 649 649 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp
r88803 r88831 101 101 pDXContext = p3dState->papDXContexts[cid]; 102 102 memset(pDXContext, 0, sizeof(*pDXContext)); 103 /* 0xFFFFFFFF (SVGA_ID_INVALID) is a better initial value than 0 for most of svgaDXContext fields. */ 104 memset(&pDXContext->svgaDXContext, 0xFF, sizeof(pDXContext->svgaDXContext)); 103 105 pDXContext->cid = cid; 104 106 … … 202 204 203 205 rc = pSvgaR3State->pFuncsDX->pfnDXSetSingleConstantBuffer(pThisCC, pDXContext, pCmd->slot, pCmd->type, pCmd->sid, pCmd->offsetInBytes, pCmd->sizeInBytes); 206 if (RT_SUCCESS(rc)) 207 { 208 uint32_t const idxShaderState = pCmd->type - SVGA3D_SHADERTYPE_MIN; 209 SVGA3dConstantBufferBinding *pCBB = &pDXContext->svgaDXContext.shaderState[idxShaderState].constantBuffers[pCmd->slot]; 210 pCBB->sid = pCmd->sid; 211 pCBB->offsetInBytes = pCmd->offsetInBytes; 212 pCBB->sizeInBytes = pCmd->sizeInBytes; 213 } 204 214 return rc; 205 215 } … … 295 305 296 306 rc = pSvgaR3State->pFuncsDX->pfnDXDraw(pThisCC, pDXContext, pCmd->vertexCount, pCmd->startVertexLocation); 307 #ifdef DUMP_BITMAPS 308 SVGACOTableDXRTViewEntry *pRTViewEntry = &pDXContext->cot.paRTView[pDXContext->svgaDXContext.renderState.renderTargetViewIds[0]]; 309 SVGA3dSurfaceImageId image; 310 image.sid = pRTViewEntry->sid; 311 image.face = 0; 312 image.mipmap = 0; 313 VMSVGA3D_MAPPED_SURFACE map; 314 int rc2 = pSvgaR3State->pFuncsMap->pfnSurfaceMap(pThisCC, idDXContext, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map); 315 if (RT_SUCCESS(rc2)) 316 { 317 vmsvga3dMapWriteBmpFile(&map, "rt-"); 318 pSvgaR3State->pFuncsMap->pfnSurfaceUnmap(pThisCC, &image, &map, /* fWritten = */ false); 319 } 320 #endif 297 321 return rc; 298 322 } … … 422 446 423 447 rc = pSvgaR3State->pFuncsDX->pfnDXSetIndexBuffer(pThisCC, pDXContext, pCmd->sid, pCmd->format, pCmd->offset); 448 if (RT_SUCCESS(rc)) 449 { 450 pDXContext->svgaDXContext.inputAssembly.indexBufferSid = pCmd->sid; 451 pDXContext->svgaDXContext.inputAssembly.indexBufferOffset = pCmd->offset; 452 pDXContext->svgaDXContext.inputAssembly.indexBufferFormat = pCmd->format; 453 } 424 454 return rc; 425 455 } … … 441 471 442 472 rc = pSvgaR3State->pFuncsDX->pfnDXSetTopology(pThisCC, pDXContext, topology); 473 if (RT_SUCCESS(rc)) 474 pDXContext->svgaDXContext.inputAssembly.topology = topology; 443 475 return rc; 444 476 } … … 457 489 AssertRCReturn(rc, rc); 458 490 491 ASSERT_GUEST_RETURN( depthStencilViewId < pDXContext->cot.cDSView 492 || depthStencilViewId == SVGA_ID_INVALID, VERR_INVALID_PARAMETER); 459 493 ASSERT_GUEST_RETURN(cRenderTargetViewId < SVGA3D_MAX_RENDER_TARGETS, VERR_INVALID_PARAMETER); 460 ASSERT_GUEST_RETURN(depthStencilViewId < pDXContext->cot.cDSView || depthStencilViewId == SVGA_ID_INVALID, VERR_INVALID_PARAMETER);461 494 for (uint32_t i = 0; i < cRenderTargetViewId; ++i) 462 495 ASSERT_GUEST_RETURN( paRenderTargetViewId[i] < pDXContext->cot.cRTView … … 465 498 466 499 rc = pSvgaR3State->pFuncsDX->pfnDXSetRenderTargets(pThisCC, pDXContext, depthStencilViewId, cRenderTargetViewId, paRenderTargetViewId); 467 /// @todo if (RT_SUCCESS(rc)) 468 //{ 469 // for (uint32_t i = 0; i < cRenderTargetViewId; ++i) 470 // pDXContext->svgaDXContext.renderState.renderTargetViewIds[i] = paRenderTargetViewId[i]; 471 //} 500 if (RT_SUCCESS(rc)) 501 { 502 pDXContext->svgaDXContext.renderState.depthStencilViewId = depthStencilViewId; 503 for (uint32_t i = 0; i < cRenderTargetViewId; ++i) 504 pDXContext->svgaDXContext.renderState.renderTargetViewIds[i] = paRenderTargetViewId[i]; 505 } 472 506 return rc; 473 507 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp
r88803 r88831 1268 1268 1269 1269 1270 static UINT dxBindFlags(SVGA3dSurfaceAllFlags surfaceFlags) 1271 { 1272 /* Catch unimplemented flags. */ 1273 Assert(!RT_BOOL(surfaceFlags & (SVGA3D_SURFACE_BIND_LOGICOPS | SVGA3D_SURFACE_BIND_RAW_VIEWS))); 1274 1275 UINT BindFlags = 0; 1276 1277 if (surfaceFlags & SVGA3D_SURFACE_BIND_VERTEX_BUFFER) BindFlags |= D3D11_BIND_VERTEX_BUFFER; 1278 if (surfaceFlags & SVGA3D_SURFACE_BIND_INDEX_BUFFER) BindFlags |= D3D11_BIND_INDEX_BUFFER; 1279 if (surfaceFlags & SVGA3D_SURFACE_BIND_CONSTANT_BUFFER) BindFlags |= D3D11_BIND_CONSTANT_BUFFER; 1280 if (surfaceFlags & SVGA3D_SURFACE_BIND_SHADER_RESOURCE) BindFlags |= D3D11_BIND_SHADER_RESOURCE; 1281 if (surfaceFlags & SVGA3D_SURFACE_BIND_RENDER_TARGET) BindFlags |= D3D11_BIND_RENDER_TARGET; 1282 if (surfaceFlags & SVGA3D_SURFACE_BIND_DEPTH_STENCIL) BindFlags |= D3D11_BIND_DEPTH_STENCIL; 1283 if (surfaceFlags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT) BindFlags |= D3D11_BIND_STREAM_OUTPUT; 1284 if (surfaceFlags & SVGA3D_SURFACE_BIND_UAVIEW) BindFlags |= D3D11_BIND_UNORDERED_ACCESS; 1285 1286 return BindFlags; 1287 } 1288 1289 1270 1290 static int vmsvga3dBackSurfaceCreateTexture(PVMSVGA3DSTATE p3dState, PVMSVGA3DDXCONTEXT pDXContext, PVMSVGA3DSURFACE pSurface) 1271 1291 { … … 1282 1302 AssertPtrReturn(pBackendSurface, VERR_NO_MEMORY); 1283 1303 1284 /** @todo Various texture types. */ 1285 ASMBreakpoint(); 1286 1304 uint32_t const cWidth = pSurface->paMipmapLevels[0].mipmapSize.width; 1305 uint32_t const cHeight = pSurface->paMipmapLevels[0].mipmapSize.height; 1306 uint32_t const cDepth = pSurface->paMipmapLevels[0].mipmapSize.depth; 1307 uint32_t const numMipLevels = pSurface->cLevels; 1308 1309 DXGI_FORMAT dxgiFormat = vmsvgaDXSurfaceFormat2Dxgi(pSurface->format); 1310 AssertReturn(dxgiFormat != DXGI_FORMAT_UNKNOWN, E_FAIL); 1311 1312 /* 1313 * Create D3D11 texture object. 1314 */ 1315 HRESULT hr = S_OK; 1316 if (pSurface->surfaceFlags & SVGA3D_SURFACE_CUBEMAP) 1317 { 1318 Assert(pSurface->cFaces == 6); 1319 Assert(cWidth == cHeight); 1320 Assert(cDepth == 1); 1321 1322 pBackendSurface->enmResType = VMSVGA3D_RESTYPE_CUBE_TEXTURE; 1323 AssertFailed(); /** @todo implement */ 1324 hr = E_FAIL; 1325 } 1326 else if (pSurface->surfaceFlags & SVGA3D_SURFACE_1D) 1327 { 1328 AssertFailed(); /** @todo implement */ 1329 hr = E_FAIL; 1330 } 1331 else 1332 { 1333 if (cDepth > 1) 1334 { 1335 /* 1336 * Volume texture. 1337 */ 1338 pBackendSurface->enmResType = VMSVGA3D_RESTYPE_VOLUME_TEXTURE; 1339 AssertFailed(); /** @todo implement */ 1340 hr = E_FAIL; 1341 } 1342 else 1343 { 1344 /* 1345 * 2D texture. 1346 */ 1347 Assert(pSurface->cFaces == 1); 1348 1349 D3D11_SUBRESOURCE_DATA *paInitialData = NULL; 1350 D3D11_SUBRESOURCE_DATA aInitialData[SVGA3D_MAX_MIP_LEVELS]; 1351 if (pSurface->paMipmapLevels[0].pSurfaceData) 1352 { 1353 /** @todo Can happen for a non GBO surface. Test this. */ 1354 for (uint32_t i = 0; i < numMipLevels; ++i) 1355 { 1356 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[i]; 1357 D3D11_SUBRESOURCE_DATA *p = &aInitialData[i]; 1358 p->pSysMem = pMipmapLevel->pSurfaceData; 1359 p->SysMemPitch = pMipmapLevel->cbSurfacePitch; 1360 p->SysMemSlicePitch = pMipmapLevel->cbSurfacePlane; 1361 } 1362 paInitialData = &aInitialData[0]; 1363 } 1364 1365 D3D11_TEXTURE2D_DESC td; 1366 RT_ZERO(td); 1367 td.Width = cWidth; 1368 td.Height = cHeight; 1369 td.MipLevels = numMipLevels; 1370 td.ArraySize = 1; /** @todo */ 1371 td.Format = dxgiFormat; 1372 td.SampleDesc.Count = 1; 1373 td.SampleDesc.Quality = 0; 1374 td.Usage = D3D11_USAGE_DEFAULT; 1375 td.BindFlags = dxBindFlags(pSurface->surfaceFlags); 1376 td.CPUAccessFlags = 0; /** @todo */ 1377 td.MiscFlags = 0; /** @todo */ 1378 if ( numMipLevels > 1 1379 && (td.BindFlags & (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET)) == (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET)) 1380 td.MiscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS; /* Required for GenMips. */ 1381 1382 hr = pDevice->pDevice->CreateTexture2D(&td, paInitialData, &pBackendSurface->u.Texture.pTexture); 1383 Assert(SUCCEEDED(hr)); 1384 if (SUCCEEDED(hr)) 1385 { 1386 /* Map-able texture. */ 1387 td.MipLevels = 1; /* Must be for D3D11_USAGE_DYNAMIC. */ 1388 td.Usage = D3D11_USAGE_DYNAMIC; 1389 td.BindFlags = D3D11_BIND_SHADER_RESOURCE; /* Have to specify a supported flag, otherwise E_INVALIDARG will be returned. */ 1390 td.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 1391 td.MiscFlags = 0; 1392 hr = pDevice->pDevice->CreateTexture2D(&td, paInitialData, &pBackendSurface->u.Texture.pDynamicTexture); 1393 Assert(SUCCEEDED(hr)); 1394 } 1395 1396 if (SUCCEEDED(hr)) 1397 { 1398 /* Staging texture. */ 1399 td.MipLevels = 1; 1400 td.Usage = D3D11_USAGE_STAGING; 1401 td.BindFlags = 0; /* No flags allowed. */ 1402 td.CPUAccessFlags = D3D11_CPU_ACCESS_READ; 1403 td.MiscFlags = 0; 1404 hr = pDevice->pDevice->CreateTexture2D(&td, paInitialData, &pBackendSurface->u.Texture.pStagingTexture); 1405 Assert(SUCCEEDED(hr)); 1406 } 1407 1408 pBackendSurface->enmResType = VMSVGA3D_RESTYPE_TEXTURE; 1409 } 1410 } 1411 1412 Assert(hr == S_OK); 1413 1414 if (pSurface->autogenFilter != SVGA3D_TEX_FILTER_NONE) 1415 { 1416 } 1417 1418 if (SUCCEEDED(hr)) 1419 { 1420 /* 1421 * Success. 1422 */ 1423 pBackendSurface->enmDxgiFormat = dxgiFormat; 1424 pSurface->pBackendSurface = pBackendSurface; 1425 pSurface->idAssociatedContext = pDXContext->cid; 1426 return VINF_SUCCESS; 1427 } 1428 1429 /* Failure. */ 1430 D3D_RELEASE(pBackendSurface->u.Texture.pStagingTexture); 1431 D3D_RELEASE(pBackendSurface->u.Texture.pDynamicTexture); 1432 D3D_RELEASE(pBackendSurface->u.Texture.pTexture); 1287 1433 RTMemFree(pBackendSurface); 1288 return VERR_NO T_IMPLEMENTED;1434 return VERR_NO_MEMORY; 1289 1435 } 1290 1436 … … 1448 1594 1449 1595 1596 static HRESULT dxCreateConstantBuffer(DXDEVICE *pDevice, VMSVGA3DSURFACE const *pSurface, PVMSVGA3DBACKENDSURFACE pBackendSurface) 1597 { 1598 D3D11_SUBRESOURCE_DATA *pInitialData = NULL; /** @todo */ 1599 D3D11_BUFFER_DESC bd; 1600 RT_ZERO(bd); 1601 bd.ByteWidth = pSurface->paMipmapLevels[0].cbSurface; 1602 bd.Usage = D3D11_USAGE_DYNAMIC; /** @todo HINT_STATIC */ 1603 bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; 1604 bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 1605 bd.MiscFlags = 0; 1606 bd.StructureByteStride = 0; 1607 1608 return pDevice->pDevice->CreateBuffer(&bd, pInitialData, &pBackendSurface->u.Buffer.pBuffer); 1609 } 1610 1611 1612 static HRESULT dxCreateBuffer(DXDEVICE *pDevice, VMSVGA3DSURFACE const *pSurface, PVMSVGA3DBACKENDSURFACE pBackendSurface) 1613 { 1614 D3D11_SUBRESOURCE_DATA *pInitialData = NULL; /** @todo */ 1615 D3D11_BUFFER_DESC bd; 1616 RT_ZERO(bd); 1617 bd.ByteWidth = pSurface->paMipmapLevels[0].cbSurface; 1618 bd.Usage = D3D11_USAGE_DYNAMIC; /** @todo HINT_STATIC */ 1619 bd.BindFlags = D3D11_BIND_VERTEX_BUFFER 1620 | D3D11_BIND_INDEX_BUFFER; 1621 bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 1622 bd.MiscFlags = 0; 1623 bd.StructureByteStride = 0; 1624 1625 return pDevice->pDevice->CreateBuffer(&bd, pInitialData, &pBackendSurface->u.Buffer.pBuffer); 1626 } 1627 1628 1629 static int vmsvga3dBackSurfaceCreate(PVMSVGA3DSTATE p3dState, PVMSVGA3DDXCONTEXT pDXContext, PVMSVGA3DSURFACE pSurface) 1630 { 1631 DXDEVICE *pDevice = &pDXContext->pBackendDXContext->device; 1632 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 1633 1634 if (pSurface->pBackendSurface != NULL) 1635 { 1636 AssertFailed(); /** @todo Should the function not be used like that? */ 1637 vmsvga3dBackSurfaceDestroy(p3dState, pSurface); 1638 } 1639 1640 PVMSVGA3DBACKENDSURFACE pBackendSurface = (PVMSVGA3DBACKENDSURFACE)RTMemAllocZ(sizeof(VMSVGA3DBACKENDSURFACE)); 1641 AssertPtrReturn(pBackendSurface, VERR_NO_MEMORY); 1642 1643 HRESULT hr; 1644 1645 /* 1646 * Figure out the type of the surface. 1647 */ 1648 if (pSurface->surfaceFlags & SVGA3D_SURFACE_BIND_CONSTANT_BUFFER) 1649 { 1650 hr = dxCreateConstantBuffer(pDevice, pSurface, pBackendSurface); 1651 if (SUCCEEDED(hr)) 1652 { 1653 pBackendSurface->enmResType = VMSVGA3D_RESTYPE_BUFFER; 1654 pBackendSurface->enmDxgiFormat = DXGI_FORMAT_UNKNOWN; 1655 } 1656 else 1657 D3D_RELEASE(pBackendSurface->u.Buffer.pBuffer); 1658 } 1659 else if (pSurface->surfaceFlags & ( SVGA3D_SURFACE_BIND_VERTEX_BUFFER 1660 | SVGA3D_SURFACE_BIND_INDEX_BUFFER 1661 | SVGA3D_SURFACE_HINT_VERTEXBUFFER 1662 | SVGA3D_SURFACE_HINT_INDEXBUFFER)) 1663 { 1664 hr = dxCreateBuffer(pDevice, pSurface, pBackendSurface); 1665 if (SUCCEEDED(hr)) 1666 { 1667 pBackendSurface->enmResType = VMSVGA3D_RESTYPE_BUFFER; 1668 pBackendSurface->enmDxgiFormat = DXGI_FORMAT_UNKNOWN; 1669 } 1670 else 1671 D3D_RELEASE(pBackendSurface->u.Buffer.pBuffer); 1672 } 1673 else 1674 { 1675 AssertFailed(); /** @todo implement */ 1676 hr = E_FAIL; 1677 } 1678 1679 if (SUCCEEDED(hr)) 1680 { 1681 /* 1682 * Success. 1683 */ 1684 pSurface->pBackendSurface = pBackendSurface; 1685 pSurface->idAssociatedContext = pDXContext->cid; 1686 return VINF_SUCCESS; 1687 } 1688 1689 /* Failure. */ 1690 RTMemFree(pBackendSurface); 1691 return VERR_NO_MEMORY; 1692 } 1693 1694 1450 1695 int vmsvga3dInit(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 1451 1696 { … … 1790 2035 1791 2036 1792 static DECLCALLBACK(int) vmsvga3dSurfaceMap(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, SVGA3dBox const *pBox,2037 static DECLCALLBACK(int) vmsvga3dSurfaceMap(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dSurfaceImageId const *pImage, SVGA3dBox const *pBox, 1793 2038 VMSVGA3D_SURFACE_MAP enmMapType, VMSVGA3D_MAPPED_SURFACE *pMap) 1794 2039 { … … 1804 2049 AssertRCReturn(rc, rc); 1805 2050 2051 PVMSVGA3DDXCONTEXT pDXContext; 1806 2052 PVMSVGA3DBACKENDSURFACE pBackendSurface = pSurface->pBackendSurface; 1807 2053 if (!pBackendSurface) 1808 return VERR_INVALID_PARAMETER; 1809 // AssertFailedReturn(VERR_INVALID_PARAMETER); /** @todo The caller must directly use the surface memory. */ 1810 1811 PVMSVGA3DDXCONTEXT pDXContext; 1812 vmsvga3dDXContextFromCid(pState, pSurface->idAssociatedContext, &pDXContext); 2054 { 2055 /* This means that the guest uploads new data to the surface. 2056 * So the data should be copied either to a host memory buffer, 2057 * or to the actual surface. 2058 * In the latter case the BackendSurface must be created here. 2059 */ 2060 rc = vmsvga3dDXContextFromCid(pState, idDXContext, &pDXContext); 2061 AssertRCReturn(rc, rc); 2062 2063 rc = vmsvga3dBackSurfaceCreate(pState, pDXContext, pSurface); 2064 AssertRCReturn(rc, rc); 2065 2066 pBackendSurface = pSurface->pBackendSurface; 2067 } 2068 else 2069 vmsvga3dDXContextFromCid(pState, pSurface->idAssociatedContext, &pDXContext); 2070 2071 Assert(pImage->face == 0 && pImage->mipmap == 0); /** @todo implement. */ 1813 2072 1814 2073 DXDEVICE *pDevice = NULL; … … 3166 3425 3167 3426 VMSVGA3D_MAPPED_SURFACE map; 3168 rc = vmsvga3dSurfaceMap(pThisCC, &image, &box, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map);3427 rc = vmsvga3dSurfaceMap(pThisCC, pSurface->idAssociatedContext, &image, &box, VMSVGA3D_SURFACE_MAP_WRITE_DISCARD, &map); 3169 3428 if (RT_SUCCESS(rc)) 3170 3429 { … … 3207 3466 #endif 3208 3467 } 3468 else if (pBackendSurface->enmResType == VMSVGA3D_RESTYPE_TEXTURE) 3469 { 3470 /** @todo This is generic code and should be in DevVGA-SVGA3d.cpp for backends which support Map/Unmap. */ 3471 AssertReturn(uHostFace == 0 && uHostMipmap == 0, VERR_INVALID_PARAMETER); 3472 3473 uint32_t const u32GuestBlockX = pBox->srcx / pSurface->cxBlock; 3474 uint32_t const u32GuestBlockY = pBox->srcy / pSurface->cyBlock; 3475 Assert(u32GuestBlockX * pSurface->cxBlock == pBox->srcx); 3476 Assert(u32GuestBlockY * pSurface->cyBlock == pBox->srcy); 3477 uint32_t const cBlocksX = (pBox->w + pSurface->cxBlock - 1) / pSurface->cxBlock; 3478 uint32_t const cBlocksY = (pBox->h + pSurface->cyBlock - 1) / pSurface->cyBlock; 3479 AssertMsgReturn(cBlocksX && cBlocksY, ("Empty box %dx%d\n", pBox->w, pBox->h), VERR_INTERNAL_ERROR); 3480 3481 /* vmsvgaR3GmrTransfer verifies uGuestOffset. 3482 * srcx(u32GuestBlockX) and srcy(u32GuestBlockY) have been verified in vmsvga3dSurfaceDMA 3483 * to not cause 32 bit overflow when multiplied by cbBlock and cbGuestPitch. 3484 */ 3485 uint64_t const uGuestOffset = u32GuestBlockX * pSurface->cbBlock + u32GuestBlockY * cbGuestPitch; 3486 AssertReturn(uGuestOffset < UINT32_MAX, VERR_INVALID_PARAMETER); 3487 3488 SVGA3dSurfaceImageId image; 3489 image.sid = pSurface->id; 3490 image.face = uHostFace; 3491 image.mipmap = uHostMipmap; 3492 3493 SVGA3dBox box; 3494 box.x = pBox->x; 3495 box.y = pBox->y; 3496 box.z = 0; 3497 box.w = pBox->w; 3498 box.h = pBox->h; 3499 box.d = 1; 3500 3501 VMSVGA3D_SURFACE_MAP const enmMap = transfer == SVGA3D_WRITE_HOST_VRAM 3502 ? VMSVGA3D_SURFACE_MAP_WRITE_DISCARD 3503 : VMSVGA3D_SURFACE_MAP_READ; 3504 3505 VMSVGA3D_MAPPED_SURFACE map; 3506 rc = vmsvga3dSurfaceMap(pThisCC, pSurface->idAssociatedContext, &image, &box, enmMap, &map); 3507 if (RT_SUCCESS(rc)) 3508 { 3509 /* Prepare parameters for vmsvgaR3GmrTransfer, which needs the host buffer address, size 3510 * and offset of the first scanline. 3511 */ 3512 uint32_t const cbLockedBuf = map.cbRowPitch * cBlocksY; 3513 uint8_t *pu8LockedBuf = (uint8_t *)map.pvData; 3514 uint32_t const offLockedBuf = 0; 3515 3516 rc = vmsvgaR3GmrTransfer(pThis, 3517 pThisCC, 3518 transfer, 3519 pu8LockedBuf, 3520 cbLockedBuf, 3521 offLockedBuf, 3522 map.cbRowPitch, 3523 GuestPtr, 3524 (uint32_t)uGuestOffset, 3525 cbGuestPitch, 3526 cBlocksX * pSurface->cbBlock, 3527 cBlocksY); 3528 AssertRC(rc); 3529 3530 bool const fWritten = (transfer == SVGA3D_WRITE_HOST_VRAM); 3531 vmsvga3dSurfaceUnmap(pThisCC, &image, &map, fWritten); 3532 } 3533 } 3209 3534 else 3210 3535 { … … 3384 3709 boxDst.d = 1; 3385 3710 3386 rc = vmsvgaR3UpdateGBSurfaceEx(pThisCC, &imageId, &boxDst, &ptSrc);3711 rc = vmsvgaR3UpdateGBSurfaceEx(pThisCC, pDXContext->cid, &imageId, &boxDst, &ptSrc); 3387 3712 AssertRCReturn(rc, rc); 3388 3713 } 3389 3714 3390 3715 dxConstantBufferSet(pDevice, slot, type, pSurface->pBackendSurface->u.Buffer.pBuffer); 3391 3392 uint32_t const idxShaderState = type - SVGA3D_SHADERTYPE_MIN;3393 SVGA3dConstantBufferBinding *pCBB = &pDXContext->svgaDXContext.shaderState[idxShaderState].constantBuffers[slot];3394 pCBB->sid = sid;3395 pCBB->offsetInBytes = offsetInBytes;3396 pCBB->sizeInBytes = sizeInBytes;3397 3716 return VINF_SUCCESS; 3398 3717 } … … 3482 3801 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 3483 3802 3484 pDevice->pImmediateContext->Draw(vertexCount, startVertexLocation); 3803 if (pDXContext->svgaDXContext.inputAssembly.topology != SVGA3D_PRIMITIVE_TRIANGLEFAN) 3804 pDevice->pImmediateContext->Draw(vertexCount, startVertexLocation); 3805 else 3806 { 3807 /* 3808 * Emulate SVGA3D_PRIMITIVE_TRIANGLEFAN using an indexed draw of a triangle list. 3809 */ 3810 3811 /* Make sure that 16 bit indices are enough. 20000 ~= 65536 / 3 */ 3812 AssertReturn(vertexCount <= 20000, VERR_NOT_SUPPORTED); 3813 3814 /* Generate indices. */ 3815 UINT const IndexCount = 3 * (vertexCount - 2); /* 3_per_triangle * num_triangles */ 3816 UINT const cbAlloc = IndexCount * sizeof(USHORT); 3817 USHORT *paIndices = (USHORT *)RTMemAlloc(cbAlloc); 3818 AssertReturn(paIndices, VERR_NO_MEMORY); 3819 USHORT iVertex = 1; 3820 for (UINT i = 0; i < IndexCount; i+= 3) 3821 { 3822 paIndices[i] = 0; 3823 paIndices[i + 1] = iVertex; 3824 ++iVertex; 3825 paIndices[i + 2] = iVertex; 3826 } 3827 3828 D3D11_SUBRESOURCE_DATA InitData; 3829 InitData.pSysMem = paIndices; 3830 InitData.SysMemPitch = cbAlloc; 3831 InitData.SysMemSlicePitch = cbAlloc; 3832 3833 D3D11_BUFFER_DESC bd; 3834 RT_ZERO(bd); 3835 bd.ByteWidth = cbAlloc; 3836 bd.Usage = D3D11_USAGE_IMMUTABLE; 3837 bd.BindFlags = D3D11_BIND_INDEX_BUFFER; 3838 //bd.CPUAccessFlags = 0; 3839 //bd.MiscFlags = 0; 3840 //bd.StructureByteStride = 0; 3841 3842 ID3D11Buffer *pIndexBuffer = 0; 3843 HRESULT hr = pDevice->pDevice->CreateBuffer(&bd, &InitData, &pIndexBuffer); 3844 Assert(SUCCEEDED(hr));RT_NOREF(hr); 3845 3846 /* Save the current index buffer. */ 3847 ID3D11Buffer *pSavedIndexBuffer = 0; 3848 DXGI_FORMAT SavedFormat = DXGI_FORMAT_UNKNOWN; 3849 UINT SavedOffset = 0; 3850 pDevice->pImmediateContext->IAGetIndexBuffer(&pSavedIndexBuffer, &SavedFormat, &SavedOffset); 3851 3852 /* Set up the device state. */ 3853 pDevice->pImmediateContext->IASetIndexBuffer(pIndexBuffer, DXGI_FORMAT_R16_UINT, 0); 3854 pDevice->pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); 3855 3856 UINT const StartIndexLocation = 0; 3857 INT const BaseVertexLocation = startVertexLocation; 3858 pDevice->pImmediateContext->DrawIndexed(IndexCount, StartIndexLocation, BaseVertexLocation); 3859 3860 /* Restore the device state. */ 3861 pDevice->pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); 3862 pDevice->pImmediateContext->IASetIndexBuffer(pSavedIndexBuffer, SavedFormat, SavedOffset); 3863 D3D_RELEASE(pSavedIndexBuffer); 3864 3865 /* Cleanup. */ 3866 D3D_RELEASE(pIndexBuffer); 3867 RTMemFree(paIndices); 3868 } 3869 3485 3870 return VINF_SUCCESS; 3486 3871 } … … 3495 3880 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 3496 3881 3882 Assert(pDXContext->svgaDXContext.inputAssembly.topology != SVGA3D_PRIMITIVE_TRIANGLEFAN); 3883 3497 3884 pDevice->pImmediateContext->DrawIndexed(indexCount, startIndexLocation, baseVertexLocation); 3498 3885 return VINF_SUCCESS; … … 3502 3889 static DECLCALLBACK(int) vmsvga3dBackDXDrawInstanced(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext) 3503 3890 { 3891 Assert(pDXContext->svgaDXContext.inputAssembly.topology != SVGA3D_PRIMITIVE_TRIANGLEFAN); 3504 3892 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 3505 3893 … … 3512 3900 static DECLCALLBACK(int) vmsvga3dBackDXDrawIndexedInstanced(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext) 3513 3901 { 3902 Assert(pDXContext->svgaDXContext.inputAssembly.topology != SVGA3D_PRIMITIVE_TRIANGLEFAN); 3514 3903 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 3515 3904 … … 3522 3911 static DECLCALLBACK(int) vmsvga3dBackDXDrawAuto(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext) 3523 3912 { 3913 Assert(pDXContext->svgaDXContext.inputAssembly.topology != SVGA3D_PRIMITIVE_TRIANGLEFAN); 3524 3914 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 3525 3915 … … 3617 4007 box.d = 1; 3618 4008 3619 rc = vmsvgaR3UpdateGBSurface(pThisCC, &imageId, &box);4009 rc = vmsvgaR3UpdateGBSurface(pThisCC, pDXContext->cid, &imageId, &box); 3620 4010 AssertRCReturn(rc, rc); 3621 4011 } … … 3684 4074 box.d = 1; 3685 4075 3686 rc = vmsvgaR3UpdateGBSurface(pThisCC, &imageId, &box);4076 rc = vmsvgaR3UpdateGBSurface(pThisCC, pDXContext->cid, &imageId, &box); 3687 4077 AssertRCReturn(rc, rc); 3688 4078 } … … 3699 4089 3700 4090 pDevice->pImmediateContext->IASetIndexBuffer(pResource, enmDxgiFormat, offset); 3701 3702 pDXContext->svgaDXContext.inputAssembly.indexBufferSid = sid;3703 pDXContext->svgaDXContext.inputAssembly.indexBufferOffset = offset;3704 pDXContext->svgaDXContext.inputAssembly.indexBufferFormat = format;3705 3706 4091 return VINF_SUCCESS; 3707 4092 } … … 3717 4102 D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, 3718 4103 D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, 3719 D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, /* SVGA3D_PRIMITIVE_TRIANGLEFAN: No FAN in D3D11 */4104 D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, /* SVGA3D_PRIMITIVE_TRIANGLEFAN: No FAN in D3D11. */ 3720 4105 D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, 3721 4106 D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, … … 3766 4151 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 3767 4152 3768 D3D11_PRIMITIVE_TOPOLOGY enmTopology = dxTopology(topology);4153 D3D11_PRIMITIVE_TOPOLOGY const enmTopology = dxTopology(topology); 3769 4154 pDevice->pImmediateContext->IASetPrimitiveTopology(enmTopology); 3770 pDXContext->svgaDXContext.inputAssembly.topology = topology;3771 4155 return VINF_SUCCESS; 3772 4156 } … … 3784 4168 for (uint32_t i = 0; i < cRenderTargetViewId; ++i) 3785 4169 { 3786 SVGA3dRenderTargetViewId renderTargetViewId = paRenderTargetViewId[i];4170 SVGA3dRenderTargetViewId const renderTargetViewId = paRenderTargetViewId[i]; 3787 4171 if (renderTargetViewId != SVGA3D_INVALID_ID) 3788 4172 { -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r88787 r88831 21 21 *********************************************************************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_DEV_VMSVGA 23 #include <VBox/AssertGuest.h> 23 24 #include <VBox/vmm/pdmdev.h> 24 25 #include <iprt/errcore.h> … … 67 68 numMipLevels, pMipLevel0Size->width, pMipLevel0Size->height, pMipLevel0Size->depth)); 68 69 69 A ssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);70 A ssertReturn(numMipLevels >= 1, VERR_INVALID_PARAMETER);70 ASSERT_GUEST_RETURN(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER); 71 ASSERT_GUEST_RETURN(numMipLevels >= 1 && numMipLevels < SVGA3D_MAX_MIP_LEVELS, VERR_INVALID_PARAMETER); 71 72 72 73 if (sid >= pState->cSurfaces) … … 304 305 #endif 305 306 306 LogFunc(("surface hint(s):%s%s%s%s%s%s\n", 307 (surfaceFlags & SVGA3D_SURFACE_HINT_INDEXBUFFER) ? " SVGA3D_SURFACE_HINT_INDEXBUFFER" : "", 308 (surfaceFlags & SVGA3D_SURFACE_HINT_VERTEXBUFFER) ? " SVGA3D_SURFACE_HINT_VERTEXBUFFER" : "", 309 (surfaceFlags & SVGA3D_SURFACE_HINT_TEXTURE) ? " SVGA3D_SURFACE_HINT_TEXTURE" : "", 310 (surfaceFlags & SVGA3D_SURFACE_HINT_DEPTHSTENCIL) ? " SVGA3D_SURFACE_HINT_DEPTHSTENCIL" : "", 311 (surfaceFlags & SVGA3D_SURFACE_HINT_RENDERTARGET) ? " SVGA3D_SURFACE_HINT_RENDERTARGET" : "", 312 (surfaceFlags & SVGA3D_SURFACE_CUBEMAP) ? " SVGA3D_SURFACE_CUBEMAP" : "" 307 #ifdef LOG_ENABLED 308 SVGA3dSurfaceAllFlags const f = surfaceFlags; 309 LogFunc(("surface flags:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s 0x%RX64\n", 310 (f & SVGA3D_SURFACE_CUBEMAP) ? " CUBEMAP" : "", 311 (f & SVGA3D_SURFACE_HINT_STATIC) ? " HINT_STATIC" : "", 312 (f & SVGA3D_SURFACE_HINT_DYNAMIC) ? " HINT_DYNAMIC" : "", 313 (f & SVGA3D_SURFACE_HINT_INDEXBUFFER) ? " HINT_INDEXBUFFER" : "", 314 (f & SVGA3D_SURFACE_HINT_VERTEXBUFFER) ? " HINT_VERTEXBUFFER" : "", 315 (f & SVGA3D_SURFACE_HINT_TEXTURE) ? " HINT_TEXTURE" : "", 316 (f & SVGA3D_SURFACE_HINT_RENDERTARGET) ? " HINT_RENDERTARGET" : "", 317 (f & SVGA3D_SURFACE_HINT_DEPTHSTENCIL) ? " HINT_DEPTHSTENCIL" : "", 318 (f & SVGA3D_SURFACE_HINT_WRITEONLY) ? " HINT_WRITEONLY" : "", 319 (f & SVGA3D_SURFACE_DEAD2) ? " DEAD2" : "", 320 (f & SVGA3D_SURFACE_AUTOGENMIPMAPS) ? " AUTOGENMIPMAPS" : "", 321 (f & SVGA3D_SURFACE_DEAD1) ? " DEAD1" : "", 322 (f & SVGA3D_SURFACE_MOB_PITCH) ? " MOB_PITCH" : "", 323 (f & SVGA3D_SURFACE_INACTIVE) ? " INACTIVE" : "", 324 (f & SVGA3D_SURFACE_HINT_RT_LOCKABLE) ? " HINT_RT_LOCKABLE" : "", 325 (f & SVGA3D_SURFACE_VOLUME) ? " VOLUME" : "", 326 (f & SVGA3D_SURFACE_SCREENTARGET) ? " SCREENTARGET" : "", 327 (f & SVGA3D_SURFACE_ALIGN16) ? " ALIGN16" : "", 328 (f & SVGA3D_SURFACE_1D) ? " 1D" : "", 329 (f & SVGA3D_SURFACE_ARRAY) ? " ARRAY" : "", 330 (f & SVGA3D_SURFACE_BIND_VERTEX_BUFFER) ? " BIND_VERTEX_BUFFER" : "", 331 (f & SVGA3D_SURFACE_BIND_INDEX_BUFFER) ? " BIND_INDEX_BUFFER" : "", 332 (f & SVGA3D_SURFACE_BIND_CONSTANT_BUFFER) ? " BIND_CONSTANT_BUFFER" : "", 333 (f & SVGA3D_SURFACE_BIND_SHADER_RESOURCE) ? " BIND_SHADER_RESOURCE" : "", 334 (f & SVGA3D_SURFACE_BIND_RENDER_TARGET) ? " BIND_RENDER_TARGET" : "", 335 (f & SVGA3D_SURFACE_BIND_DEPTH_STENCIL) ? " BIND_DEPTH_STENCIL" : "", 336 (f & SVGA3D_SURFACE_BIND_STREAM_OUTPUT) ? " BIND_STREAM_OUTPUT" : "", 337 (f & SVGA3D_SURFACE_STAGING_UPLOAD) ? " STAGING_UPLOAD" : "", 338 (f & SVGA3D_SURFACE_STAGING_DOWNLOAD) ? " STAGING_DOWNLOAD" : "", 339 (f & SVGA3D_SURFACE_HINT_INDIRECT_UPDATE) ? " HINT_INDIRECT_UPDATE" : "", 340 (f & SVGA3D_SURFACE_TRANSFER_FROM_BUFFER) ? " TRANSFER_FROM_BUFFER" : "", 341 (f & SVGA3D_SURFACE_RESERVED1) ? " RESERVED1" : "", 342 (f & SVGA3D_SURFACE_MULTISAMPLE) ? " MULTISAMPLE" : "", 343 (f & SVGA3D_SURFACE_BIND_UAVIEW) ? " BIND_UAVIEW" : "", 344 (f & SVGA3D_SURFACE_TRANSFER_TO_BUFFER) ? " TRANSFER_TO_BUFFER" : "", 345 (f & SVGA3D_SURFACE_BIND_LOGICOPS) ? " BIND_LOGICOPS" : "", 346 (f & SVGA3D_SURFACE_BIND_RAW_VIEWS) ? " BIND_RAW_VIEWS" : "", 347 (f & SVGA3D_SURFACE_BUFFER_STRUCTURED) ? " BUFFER_STRUCTURED" : "", 348 (f & SVGA3D_SURFACE_DRAWINDIRECT_ARGS) ? " DRAWINDIRECT_ARGS" : "", 349 (f & SVGA3D_SURFACE_RESOURCE_CLAMP) ? " RESOURCE_CLAMP" : "", 350 (f & SVGA3D_SURFACE_FLAG_MAX) ? " FLAG_MAX" : "", 351 f & ~(SVGA3D_SURFACE_FLAG_MAX - 1ULL) 313 352 )); 353 #endif 314 354 315 355 Assert(!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r88803 r88831 38 38 /** Arbitrary upper limit; 2GB enough for 32768x16384*4. */ 39 39 #define SVGA3D_MAX_SURFACE_MEM_SIZE 0x80000000 40 /** Arbitrary upper limit. [0,15] is enough for 2^15=32768x32768. */ 41 #define SVGA3D_MAX_MIP_LEVELS 16 40 42 41 43 … … 67 69 } VMSVGA3D_MAPPED_SURFACE; 68 70 71 /* Write render targets to bitmaps. */ 72 //#define DUMP_BITMAPS 69 73 #ifdef DUMP_BITMAPS 70 74 void vmsvga3dMapWriteBmpFile(VMSVGA3D_MAPPED_SURFACE const *pMap, char const *pszPrefix); … … 279 283 typedef struct 280 284 { 281 DECLCALLBACKMEMBER(int, pfnSurfaceMap, (PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, SVGA3dBox const *pBox, VMSVGA3D_SURFACE_MAP enmMapType, VMSVGA3D_MAPPED_SURFACE *pMap));285 DECLCALLBACKMEMBER(int, pfnSurfaceMap, (PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dSurfaceImageId const *pImage, SVGA3dBox const *pBox, VMSVGA3D_SURFACE_MAP enmMapType, VMSVGA3D_MAPPED_SURFACE *pMap)); 282 286 DECLCALLBACKMEMBER(int, pfnSurfaceUnmap, (PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImage, VMSVGA3D_MAPPED_SURFACE *pMap, bool fWritten)); 283 287 } VMSVGA3DBACKENDFUNCSMAP; -
trunk/src/VBox/Devices/Makefile.kmk
r88787 r88831 330 330 Graphics/DevVGA-SVGA3d-dx.cpp \ 331 331 Graphics/DevVGA-SVGA3d-dx-shader.cpp 332 VBoxDD_SOURCES += \ 333 Graphics/svgadump/svga_dump.c 332 334 endif 333 335 if "$(KBUILD_TARGET)" == "win" && !defined(VBOX_WITH_VMSVGA3D_USE_OPENGL)
Note:
See TracChangeset
for help on using the changeset viewer.