Changeset 46343 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- May 31, 2013 1:27:10 PM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
r45348 r46343 152 152 VBoxOGLcrserverlib_DEFS += ifdef VBOX_WITH_CRHGSMI 153 153 endif 154 ifdef VBOX_WITH_CRDUMPER 155 VBoxOGLcrserverlib_DEFS += VBOX_WITH_CRDUMPER 156 endif 157 ifdef VBOX_WITH_CRSERVER_DUMPER 158 VBoxOGLcrserverlib_DEFS += VBOX_WITH_CRSERVER_DUMPER 159 endif 160 154 161 155 162 # -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r46173 r46343 351 351 } CR_SERVER_CTX_SWITCH; 352 352 353 DECLINLINE(void) cr _serverCtxSwitchPrepare(CR_SERVER_CTX_SWITCH *pData, CRContext *pNewCtx)353 DECLINLINE(void) crServerCtxSwitchPrepare(CR_SERVER_CTX_SWITCH *pData, CRContext *pNewCtx) 354 354 { 355 355 CRMuralInfo *pCurrentMural = cr_server.currentMural; … … 379 379 } 380 380 381 DECLINLINE(void) cr _serverCtxSwitchPostprocess(CR_SERVER_CTX_SWITCH *pData)381 DECLINLINE(void) crServerCtxSwitchPostprocess(CR_SERVER_CTX_SWITCH *pData) 382 382 { 383 383 crStateSwitchPostprocess(pData->pOldCtx, pData->pNewCtx, pData->idDrawFBO, pData->idReadFBO); 384 384 } 385 386 void crServerInitTmpCtxDispatch(); 387 388 #ifdef VBOX_WITH_CRSERVER_DUMPER 389 void crServerDumpCheckTerm(); 390 int crServerDumpCheckInit(); 391 void crServerDumpBuffer(); 392 void crServerDumpTextures(); 393 394 #define CR_SERVER_DUMP_F_DRAW_BUFF_ENTER 0x01 395 #define CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE 0x02 396 #define CR_SERVER_DUMP_F_DRAW_TEX_ENTER 0x10 397 #define CR_SERVER_DUMP_F_DRAW_TEX_LEAVE 0x20 398 399 extern int g_CrDbgDumpDraw; 400 bool crServerDumpFilter(int event); 401 402 #define CR_SERVER_DUMP_IF_ANY(_ev) ((g_CrDbgDumpDraw & (_ev)) && crServerDumpFilter((_ev))) 403 404 #define CR_SERVER_DUMP_DRAW_ENTER() do { \ 405 if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_TEX_ENTER)) break; \ 406 crServerDumpCheckInit(); \ 407 crDmpStrF(cr_server.Recorder.pDumper, "==> %s\n", __FUNCTION__); \ 408 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER)) { \ 409 crServerDumpBuffer(); \ 410 } \ 411 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_ENTER)) { \ 412 crServerDumpTextures(); \ 413 } \ 414 } while (0) 415 416 #define CR_SERVER_DUMP_DRAW_LEAVE() do { \ 417 if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE)) break; \ 418 crServerDumpCheckInit(); \ 419 crDmpStrF(cr_server.Recorder.pDumper, "<== %s\n", __FUNCTION__); \ 420 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE)) { \ 421 crServerDumpBuffer(); \ 422 } \ 423 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_LEAVE)) { \ 424 crServerDumpTextures(); \ 425 } \ 426 } while (0) 427 #else /* if !defined VBOX_WITH_CRSERVER_DUMPER */ 428 #define CR_SERVER_DUMP_DRAW_ENTER() do {} while (0) 429 #define CR_SERVER_DUMP_DRAW_LEAVE() do {} while (0) 430 #endif /* !VBOX_WITH_CRSERVER_DUMPER */ 431 385 432 RT_C_DECLS_END 386 433 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r46173 r46343 380 380 381 381 crServerInitDispatch(); 382 crServerInitTmpCtxDispatch(); 382 383 crStateDiffAPI( &(cr_server.head_spu->dispatch_table) ); 383 384 … … 487 488 488 489 crServerInitDispatch(); 490 crServerInitTmpCtxDispatch(); 489 491 crStateDiffAPI( &(cr_server.head_spu->dispatch_table) ); 490 492 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r46173 r46343 1292 1292 return retval; /* WILL PROBABLY BE IGNORED */ 1293 1293 } 1294 1295 void SERVER_DISPATCH_APIENTRY 1296 crServerMakeTmpCtxCurrent( GLint window, GLint nativeWindow, GLint context ) 1297 { 1298 CRContext *pCtx = crStateGetCurrent(); 1299 CRContext *pCurCtx = NULL; 1300 GLuint idDrawFBO = 0, idReadFBO = 0; 1301 int fDoPrePostProcess = 0; 1302 1303 if (pCtx) 1304 { 1305 GLint curSrvSpuCtx = cr_server.currentCtxInfo && cr_server.currentCtxInfo->SpuContext > 0 ? cr_server.currentCtxInfo->SpuContext : cr_server.MainContextInfo.SpuContext; 1306 bool fSwitchToTmpCtx = (curSrvSpuCtx != context); 1307 CRMuralInfo *pCurrentMural = cr_server.currentMural; 1308 CRContextInfo *pCurCtxInfo = cr_server.currentCtxInfo; 1309 pCurCtx = pCurCtxInfo ? pCurCtxInfo->pContext : NULL; 1310 1311 CRASSERT(pCurCtx == pCtx); 1312 1313 if (pCurrentMural) 1314 { 1315 idDrawFBO = CR_SERVER_FBO_FOR_IDX(pCurrentMural, pCurrentMural->iCurDrawBuffer); 1316 idReadFBO = CR_SERVER_FBO_FOR_IDX(pCurrentMural, pCurrentMural->iCurReadBuffer); 1317 } 1318 else 1319 { 1320 idDrawFBO = 0; 1321 idReadFBO = 0; 1322 } 1323 1324 fDoPrePostProcess = fSwitchToTmpCtx ? 1 : -1; 1325 } 1326 else 1327 { 1328 /* this is a GUI thread, so no need to do anything here */ 1329 } 1330 1331 if (fDoPrePostProcess > 0) 1332 crStateSwitchPrepare(NULL, pCurCtx, idDrawFBO, idReadFBO); 1333 1334 cr_server.head_spu->dispatch_table.MakeCurrent( window, nativeWindow, context); 1335 1336 if (fDoPrePostProcess < 0) 1337 crStateSwitchPostprocess(pCurCtx, NULL, idDrawFBO, idReadFBO); 1338 } 1339 1340 void crServerInitTmpCtxDispatch() 1341 { 1342 crSPUInitDispatchTable(&cr_server.TmpCtxDispatch); 1343 crSPUCopyDispatchTable(&cr_server.TmpCtxDispatch, &cr_server.head_spu->dispatch_table); 1344 cr_server.TmpCtxDispatch.MakeCurrent = crServerMakeTmpCtxCurrent; 1345 } 1346 1347 /* dump stuff */ 1348 #ifdef VBOX_WITH_CRSERVER_DUMPER 1349 1350 /* first four bits are buffer dump config 1351 * second four bits are texture dump config 1352 * config flags: 1353 * 1 - blit on enter 1354 * 2 - blit on exit 1355 * 1356 * 1357 * Example: 1358 * 1359 * 0x03 - dump buffer on enter and exit 1360 * 0x22 - dump texture and buffer on exit */ 1361 int g_CrDbgDumpDraw = 0; //CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE; 1362 1363 void crServerDumpCheckTerm() 1364 { 1365 if (!CrBltIsInitialized(&cr_server.RecorderBlitter)) 1366 return; 1367 1368 CrBltTerm(&cr_server.RecorderBlitter); 1369 } 1370 1371 int crServerDumpCheckInit() 1372 { 1373 int rc; 1374 CR_BLITTER_WINDOW BltWin; 1375 CR_BLITTER_CONTEXT BltCtx; 1376 CRMuralInfo *pBlitterMural; 1377 1378 if (CrBltIsInitialized(&cr_server.RecorderBlitter)) 1379 return VINF_SUCCESS; 1380 1381 pBlitterMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits); 1382 if (!pBlitterMural) 1383 { 1384 crWarning("crServerGetDummyMural failed"); 1385 return VERR_GENERAL_FAILURE; 1386 } 1387 1388 crServerVBoxBlitterWinInit(&BltWin, pBlitterMural); 1389 crServerVBoxBlitterCtxInit(&BltCtx, &cr_server.MainContextInfo); 1390 1391 rc = CrBltInit(&cr_server.RecorderBlitter, &BltCtx, true, true, &cr_server.TmpCtxDispatch); 1392 if (!RT_SUCCESS(rc)) 1393 { 1394 crWarning("CrBltInit failed rc %d", rc); 1395 return rc; 1396 } 1397 1398 rc = CrBltMuralSetCurrent(&cr_server.RecorderBlitter, &BltWin); 1399 if (!RT_SUCCESS(rc)) 1400 { 1401 crWarning("CrBltMuralSetCurrent failed rc %d", rc); 1402 return rc; 1403 } 1404 1405 #if 0 1406 crDmpDbgPrintInit(&cr_server.DbgPrintDumper); 1407 cr_server.pDumper = &cr_server.DbgPrintDumper.Base; 1408 #else 1409 crDmpHtmlInit(&cr_server.HtmlDumper, "S:\\projects\\virtualbox\\3d\\dumps\\1", "index.html"); 1410 cr_server.pDumper = &cr_server.HtmlDumper.Base; 1411 #endif 1412 1413 crRecInit(&cr_server.Recorder, &cr_server.RecorderBlitter, &cr_server.TmpCtxDispatch, cr_server.pDumper); 1414 return VINF_SUCCESS; 1415 } 1416 1417 void crServerDumpBuffer() 1418 { 1419 CRContextInfo *pCtxInfo = cr_server.currentCtxInfo; 1420 CR_BLITTER_WINDOW BltWin; 1421 CR_BLITTER_CONTEXT BltCtx; 1422 CRContext *ctx = crStateGetCurrent(); 1423 GLint idx = crServerMuralFBOIdxFromBufferName(cr_server.currentMural, pCtxInfo->pContext->buffer.drawBuffer); 1424 GLint idFBO; 1425 GLint idTex; 1426 VBOXVR_TEXTURE RedirTex; 1427 int rc = crServerDumpCheckInit(); 1428 if (!RT_SUCCESS(rc)) 1429 { 1430 crWarning("crServerDumpCheckInit failed, rc %d", rc); 1431 return; 1432 } 1433 1434 if (idx < 0) 1435 { 1436 crWarning("neg idx, unsupported"); 1437 return; 1438 } 1439 1440 idFBO = CR_SERVER_FBO_FOR_IDX(cr_server.currentMural, idx); 1441 idTex = CR_SERVER_FBO_TEX_FOR_IDX(cr_server.currentMural, idx); 1442 1443 crServerVBoxBlitterWinInit(&BltWin, cr_server.currentMural); 1444 crServerVBoxBlitterCtxInit(&BltCtx, pCtxInfo); 1445 1446 RedirTex.width = cr_server.currentMural->fboWidth; 1447 RedirTex.height = cr_server.currentMural->fboHeight; 1448 RedirTex.target = GL_TEXTURE_2D; 1449 RedirTex.hwid = idTex; 1450 1451 crRecDumpBuffer(&cr_server.Recorder, ctx, &BltCtx, &BltWin, idFBO, idTex ? &RedirTex : NULL); 1452 } 1453 1454 void crServerDumpTextures() 1455 { 1456 CRContextInfo *pCtxInfo = cr_server.currentCtxInfo; 1457 CR_BLITTER_WINDOW BltWin; 1458 CR_BLITTER_CONTEXT BltCtx; 1459 CRContext *ctx = crStateGetCurrent(); 1460 int rc = crServerDumpCheckInit(); 1461 if (!RT_SUCCESS(rc)) 1462 { 1463 crWarning("crServerDumpCheckInit failed, rc %d", rc); 1464 return; 1465 } 1466 1467 crServerVBoxBlitterWinInit(&BltWin, cr_server.currentMural); 1468 crServerVBoxBlitterCtxInit(&BltCtx, pCtxInfo); 1469 1470 crRecDumpTextures(&cr_server.Recorder, ctx, &BltCtx, &BltWin); 1471 } 1472 1473 bool crServerDumpFilter(int event) 1474 { 1475 return true; 1476 } 1477 #endif 1478 /* */ -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r46229 r46343 914 914 crServerRpwEntryDrawSettingsToTex(&mural->RpwEntry, &DstTex); 915 915 916 cr _serverCtxSwitchPrepare(&CtxSwitch, NULL);916 crServerCtxSwitchPrepare(&CtxSwitch, NULL); 917 917 918 918 crServerVBoxBlitterWinInit(&CurrentBltInfo, pCurrentMural); … … 933 933 } 934 934 935 cr _serverCtxSwitchPostprocess(&CtxSwitch);935 crServerCtxSwitchPostprocess(&CtxSwitch); 936 936 937 937 #if 1 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_rpw.cpp
r45376 r46343 368 368 CR_SERVER_CTX_SWITCH CtxSwitch; 369 369 370 cr _serverCtxSwitchPrepare(&CtxSwitch, NULL);370 crServerCtxSwitchPrepare(&CtxSwitch, NULL); 371 371 372 372 cr_server.head_spu->dispatch_table.Flush(); … … 383 383 cr_server.head_spu->dispatch_table.MakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID); 384 384 385 cr _serverCtxSwitchPostprocess(&CtxSwitch);385 crServerCtxSwitchPostprocess(&CtxSwitch); 386 386 387 387 rc = RTThreadCreate(&pWorker->hThread, crServerRpwWorkerThread, pWorker, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "CrServerDw"); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r45942 r46343 465 465 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 466 466 /* CrVrScrCompositorLock(&mural->Compositor); */ 467 #if 0468 467 if (!mural->bReceivedRects) 469 468 { … … 489 488 } 490 489 else 491 #endif492 490 { 493 491 rc = CrVrScrCompositorEntryTexUpdate(&mural->Compositor, &mural->CEntry, &Tex); -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r45921 r46343 679 679 DstRect.xRight = paDstRegions[i].xRight * scaleX; 680 680 DstRect.yBottom = paDstRegions[i].yBottom * scaleY; 681 CrBltBlitTexMural(pBlitter, &pEntry->Tex, &paSrcRegions[i], &DstRect, 1, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS);681 CrBltBlitTexMural(pBlitter, true, &pEntry->Tex, &paSrcRegions[i], &DstRect, 1, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS); 682 682 } 683 683 } … … 701 701 if (RT_SUCCESS(rc)) 702 702 { 703 CrBltBlitTexMural(pBlitter, &pEntry->Tex, paSrcRegions, paDstRegions, cRegions, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS);703 CrBltBlitTexMural(pBlitter, true, &pEntry->Tex, paSrcRegions, paDstRegions, cRegions, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS); 704 704 } 705 705 else -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r45673 r46343 1284 1284 } 1285 1285 1286 CrBltBlitTexMural(m_pBlitter, &pEntry->Tex, pSrcRect, pDstRect, 1, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS);1286 CrBltBlitTexMural(m_pBlitter, true, &pEntry->Tex, pSrcRect, pDstRect, 1, CRBLT_F_LINEAR | CRBLT_F_INVERT_YCOORDS); 1287 1287 } 1288 1288 CrBltLeave(m_pBlitter); … … 1407 1407 } 1408 1408 1409 CrBltBlitTexMural(m_pBlitter, &pEntry->Tex, pSrcRect, pDstRect, 1, CRBLT_F_LINEAR | CRBLT_F_INVERT_SRC_YCOORDS);1409 CrBltBlitTexMural(m_pBlitter, true, &pEntry->Tex, pSrcRect, pDstRect, 1, CRBLT_F_LINEAR | CRBLT_F_INVERT_SRC_YCOORDS); 1410 1410 } 1411 1411 CrBltLeave(m_pBlitter);
Note:
See TracChangeset
for help on using the changeset viewer.