- 時間撮記:
- 2013-10-21 下午05:25:21 (11 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c
r48795 r49216 1407 1407 } 1408 1408 1409 static void crStateSaveKeysCB(unsigned long firstKey, unsigned long count, void *data) 1410 { 1411 PSSMHANDLE pSSM = (PSSMHANDLE)data; 1412 int rc; 1413 CRASSERT(firstKey); 1414 CRASSERT(count); 1415 rc = SSMR3PutU32(pSSM, firstKey); 1416 CRASSERT(RT_SUCCESS(rc)); 1417 rc = SSMR3PutU32(pSSM, count); 1418 CRASSERT(RT_SUCCESS(rc)); 1419 } 1420 1421 static int32_t crStateSaveKeys(CRHashTable *pHash, PSSMHANDLE pSSM) 1422 { 1423 crHashtableWalkKeys(pHash, crStateSaveKeysCB , pSSM); 1424 /* use null terminator */ 1425 SSMR3PutU32(pSSM, 0); 1426 return VINF_SUCCESS; 1427 } 1428 1429 static int32_t crStateLoadKeys(CRHashTable *pHash, PSSMHANDLE pSSM) 1430 { 1431 uint32_t u32Key, u32Count, i; 1432 int rc; 1433 for(;;) 1434 { 1435 rc = SSMR3GetU32(pSSM, &u32Key); 1436 AssertRCReturn(rc, rc); 1437 1438 if (!u32Key) 1439 return rc; 1440 1441 rc = SSMR3GetU32(pSSM, &u32Count); 1442 AssertRCReturn(rc, rc); 1443 1444 CRASSERT(u32Count); 1445 1446 for (i = u32Key; i < u32Count + u32Key; ++i) 1447 { 1448 GLboolean fIsNew = crHashtableAllocRegisterKey(pHash, i); 1449 CRASSERT(fIsNew); 1450 } 1451 } 1452 1453 return rc; 1454 } 1455 1456 1409 1457 int32_t crStateSaveContext(CRContext *pContext, PSSMHANDLE pSSM) 1410 1458 { … … 1503 1551 { 1504 1552 CRASSERT(pContext->shared && pContext->shared->textureTable); 1553 rc = crStateSaveKeys(pContext->shared->textureTable, pSSM); 1554 AssertRCReturn(rc, rc); 1505 1555 ui32 = crHashtableNumElements(pContext->shared->textureTable); 1506 1556 rc = SSMR3PutU32(pSSM, ui32); … … 1600 1650 #ifdef CR_ARB_vertex_buffer_object 1601 1651 /* Save buffer objects */ 1652 if (bSaveShared) 1653 { 1654 rc = crStateSaveKeys(pContext->shared->buffersTable, pSSM); 1655 AssertRCReturn(rc, rc); 1656 } 1602 1657 ui32 = bSaveShared? crHashtableNumElements(pContext->shared->buffersTable):0; 1603 1658 rc = SSMR3PutU32(pSSM, ui32); … … 1667 1722 if (bSaveShared) 1668 1723 { 1724 rc = crStateSaveKeys(pContext->shared->fbTable, pSSM); 1725 AssertRCReturn(rc, rc); 1669 1726 ui32 = crHashtableNumElements(pContext->shared->fbTable); 1670 1727 rc = SSMR3PutU32(pSSM, ui32); 1671 1728 AssertRCReturn(rc, rc); 1672 1729 crHashtableWalk(pContext->shared->fbTable, crStateSaveFramebuffersCB, pSSM); 1730 1731 rc = crStateSaveKeys(pContext->shared->rbTable, pSSM); 1732 AssertRCReturn(rc, rc); 1673 1733 ui32 = crHashtableNumElements(pContext->shared->rbTable); 1674 1734 rc = SSMR3PutU32(pSSM, ui32); … … 2169 2229 /* Load shared textures */ 2170 2230 CRASSERT(pContext->shared && pContext->shared->textureTable); 2231 2232 if (u32Version >= SHCROGL_SSM_VERSION_WITH_ALLOCATED_KEYS) 2233 { 2234 rc = crStateLoadKeys(pContext->shared->buffersTable, pSSM); 2235 AssertRCReturn(rc, rc); 2236 } 2237 2171 2238 rc = SSMR3GetU32(pSSM, &uiNumElems); 2172 2239 AssertRCReturn(rc, rc); … … 2271 2338 /* Load buffer objects */ 2272 2339 #ifdef CR_ARB_vertex_buffer_object 2340 if (bLoadShared) 2341 { 2342 if (u32Version >= SHCROGL_SSM_VERSION_WITH_ALLOCATED_KEYS) 2343 { 2344 rc = crStateLoadKeys(pContext->shared->textureTable, pSSM); 2345 AssertRCReturn(rc, rc); 2346 } 2347 } 2348 2273 2349 rc = SSMR3GetU32(pSSM, &uiNumElems); 2274 2350 AssertRCReturn(rc, rc); … … 2393 2469 if (bLoadShared) 2394 2470 { 2471 if (u32Version >= SHCROGL_SSM_VERSION_WITH_ALLOCATED_KEYS) 2472 { 2473 rc = crStateLoadKeys(pContext->shared->fbTable, pSSM); 2474 AssertRCReturn(rc, rc); 2475 } 2476 2395 2477 rc = SSMR3GetU32(pSSM, &uiNumElems); 2396 2478 AssertRCReturn(rc, rc); … … 2410 2492 2411 2493 crHashtableAdd(pContext->shared->fbTable, key, pFBO); 2494 } 2495 2496 if (u32Version >= SHCROGL_SSM_VERSION_WITH_ALLOCATED_KEYS) 2497 { 2498 rc = crStateLoadKeys(pContext->shared->rbTable, pSSM); 2499 AssertRCReturn(rc, rc); 2412 2500 } 2413 2501
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器