Changeset 46368 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Jun 3, 2013 5:24:51 PM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r46343 r46368 386 386 void crServerInitTmpCtxDispatch(); 387 387 388 //#define VBOX_WITH_CRSERVER_DUMPER 388 389 #ifdef VBOX_WITH_CRSERVER_DUMPER 389 390 void crServerDumpCheckTerm(); 390 391 int crServerDumpCheckInit(); 391 void crServerDumpBuffer( );392 void crServerDumpBuffer(int idx); 392 393 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); 394 void crServerDumpShader(GLint id); 395 void crServerDumpProgram(GLint id); 396 void crServerDumpCurrentProgram(); 397 void crServerDumpFramesCheck(); 398 399 extern unsigned long g_CrDbgDumpDraw; 400 extern unsigned long g_CrDbgDumpDrawFramesSettings; 401 extern unsigned long g_CrDbgDumpDrawFramesAppliedSettings; 402 extern unsigned long g_CrDbgDumpDrawFramesCount; 403 bool crServerDumpFilter(unsigned long event); 404 405 #define CR_SERVER_DUMP_F_DRAW_BUFF_ENTER 0x00000001 406 #define CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE 0x00000002 407 #define CR_SERVER_DUMP_F_DRAW_TEX_ENTER 0x00000010 408 #define CR_SERVER_DUMP_F_DRAW_TEX_LEAVE 0x00000020 409 #define CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER 0x00000100 410 #define CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE 0x00000200 411 412 #define CR_SERVER_DUMP_F_DRAW_ALL (CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE \ 413 | CR_SERVER_DUMP_F_DRAW_TEX_ENTER | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE \ 414 | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER | CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE) 415 416 #define CR_SERVER_DUMP_F_COMPILE_SHADER 0x00001000 417 #define CR_SERVER_DUMP_F_LINK_PROGRAM 0x00002000 418 #define CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER 0x00010000 419 #define CR_SERVER_DUMP_F_SWAPBUFFERS_LEAVE 0x00020000 401 420 402 421 #define CR_SERVER_DUMP_IF_ANY(_ev) ((g_CrDbgDumpDraw & (_ev)) && crServerDumpFilter((_ev))) 403 422 404 423 #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; \424 if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_TEX_ENTER | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER)) break; \ 406 425 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 } \ 426 crDmpStrF(cr_server.Recorder.pDumper, "==> %s", __FUNCTION__); \ 427 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER)) { crServerDumpCurrentProgram(); } \ 428 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_ENTER)) { crServerDumpTextures(); } \ 429 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER)) { crServerDumpBuffer(-1); } \ 430 crDmpStrF(cr_server.Recorder.pDumper, "=================="); \ 414 431 } while (0) 415 432 416 433 #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; \434 if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE | CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE)) break; \ 418 435 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 } \ 436 crDmpStrF(cr_server.Recorder.pDumper, "<== %s", __FUNCTION__); \ 437 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE)) { crServerDumpBuffer(-1); } \ 438 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_LEAVE)) { crServerDumpTextures(); } \ 439 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE)) { crServerDumpCurrentProgram(); } \ 440 crDmpStrF(cr_server.Recorder.pDumper, "=================="); \ 426 441 } while (0) 442 443 #define CR_SERVER_DUMP_COMPILE_SHADER(_id) do { \ 444 if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_COMPILE_SHADER)) break; \ 445 crServerDumpCheckInit(); \ 446 crServerDumpShader((_id)); \ 447 } while (0) 448 449 #define CR_SERVER_DUMP_LINK_PROGRAM(_id) do { \ 450 if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_LINK_PROGRAM)) break; \ 451 crServerDumpCheckInit(); \ 452 crServerDumpProgram((_id)); \ 453 } while (0) 454 455 #define CR_SERVER_DUMP_SWAPBUFFERS_ENTER() do { \ 456 if (!g_CrDbgDumpDrawFramesCount && !CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER)) break; \ 457 crServerDumpCheckInit(); \ 458 crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \ 459 if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER)) { crServerDumpBuffer(CR_SERVER_FBO_BB_IDX(cr_server.currentMural)); } \ 460 if (g_CrDbgDumpDrawFramesCount) { crServerDumpFramesCheck(); } \ 461 } while (0) 462 463 #define CR_SERVER_DUMP_SWAPBUFFERS_LEAVE() do {} while (0) 427 464 #else /* if !defined VBOX_WITH_CRSERVER_DUMPER */ 428 465 #define CR_SERVER_DUMP_DRAW_ENTER() do {} while (0) 429 466 #define CR_SERVER_DUMP_DRAW_LEAVE() do {} while (0) 467 #define CR_SERVER_DUMP_COMPILE_SHADER(_id) do {} while (0) 468 #define CR_SERVER_DUMP_LINK_PROGRAM(_id) do {} while (0) 469 #define CR_SERVER_DUMP_SWAPBUFFERS_ENTER() do {} while (0) 470 #define CR_SERVER_DUMP_SWAPBUFFERS_LEAVE() do {} while (0) 430 471 #endif /* !VBOX_WITH_CRSERVER_DUMPER */ 431 472 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_clear.c
r45148 r46368 434 434 mural->bFbDraw = GL_FALSE; 435 435 436 CR_SERVER_DUMP_SWAPBUFFERS_ENTER(); 437 436 438 if (crServerIsRedirectedToFBO()) 437 439 { … … 445 447 mural->fDataPresented = GL_TRUE; 446 448 } 449 450 CR_SERVER_DUMP_SWAPBUFFERS_LEAVE(); 447 451 } 448 452 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c
r45027 r46368 51 51 Assert(iCompileStatus == GL_TRUE); 52 52 #endif 53 CR_SERVER_DUMP_COMPILE_SHADER(shader); 53 54 } 54 55 … … 79 80 crStateLinkProgram(program); 80 81 cr_server.head_spu->dispatch_table.LinkProgram(crStateGetProgramHWID(program)); 82 CR_SERVER_DUMP_LINK_PROGRAM(program); 81 83 } 82 84 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r46343 r46368 50 50 CRASSERT(bytes < 4096); 51 51 52 cr_server.head_spu->dispatch_table.GetChromiumParametervCR( target, index, type, count, local_storage ); 52 switch (target) 53 { 54 case GL_DBG_CHECK_BREAK_CR: 55 { 56 if (bytes > 0) 57 { 58 GLubyte *pbRc = local_storage; 59 GLuint *puRc = (GLuint *)(bytes >=4 ? local_storage : NULL); 60 int rc; 61 memset(local_storage, 0, bytes); 62 if (cr_server.RcToGuestOnce) 63 { 64 rc = cr_server.RcToGuestOnce; 65 cr_server.RcToGuestOnce = 0; 66 } 67 else 68 { 69 rc = cr_server.RcToGuest; 70 } 71 if (puRc) 72 *puRc = rc; 73 else 74 *pbRc = !!rc; 75 } 76 else 77 { 78 crWarning("zero bytes for GL_DBG_CHECK_BREAK_CR"); 79 } 80 break; 81 } 82 default: 83 cr_server.head_spu->dispatch_table.GetChromiumParametervCR( target, index, type, count, local_storage ); 84 break; 85 } 53 86 54 87 crServerReturnValue( local_storage, bytes ); … … 1359 1392 * 0x03 - dump buffer on enter and exit 1360 1393 * 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; 1394 1395 unsigned long g_CrDbgDumpDraw = CR_SERVER_DUMP_F_COMPILE_SHADER | CR_SERVER_DUMP_F_LINK_PROGRAM; //CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE; 1396 unsigned long g_CrDbgDumpDrawFramesSettings = CR_SERVER_DUMP_F_DRAW_BUFF_ENTER 1397 | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE 1398 | CR_SERVER_DUMP_F_DRAW_TEX_ENTER 1399 | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER 1400 | CR_SERVER_DUMP_F_COMPILE_SHADER 1401 | CR_SERVER_DUMP_F_LINK_PROGRAM 1402 | CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER; 1403 unsigned long g_CrDbgDumpDrawFramesAppliedSettings = 0; 1404 unsigned long g_CrDbgDumpDrawFramesSavedInitSettings = 0; 1405 unsigned long g_CrDbgDumpDrawFramesCount = 0; 1362 1406 1363 1407 void crServerDumpCheckTerm() … … 1415 1459 } 1416 1460 1417 void crServerDumpBuffer() 1461 void crServerDumpShader(GLint id) 1462 { 1463 CRContext *ctx = crStateGetCurrent(); 1464 crRecDumpShader(&cr_server.Recorder, ctx, id, 0); 1465 } 1466 1467 void crServerDumpProgram(GLint id) 1468 { 1469 CRContext *ctx = crStateGetCurrent(); 1470 crRecDumpProgram(&cr_server.Recorder, ctx, id, 0); 1471 } 1472 1473 void crServerDumpCurrentProgram() 1474 { 1475 CRContext *ctx = crStateGetCurrent(); 1476 crRecDumpCurrentProgram(&cr_server.Recorder, ctx); 1477 } 1478 1479 void crServerDumpBuffer(int idx) 1418 1480 { 1419 1481 CRContextInfo *pCtxInfo = cr_server.currentCtxInfo; … … 1421 1483 CR_BLITTER_CONTEXT BltCtx; 1422 1484 CRContext *ctx = crStateGetCurrent(); 1423 GLint idx = crServerMuralFBOIdxFromBufferName(cr_server.currentMural, pCtxInfo->pContext->buffer.drawBuffer);1424 1485 GLint idFBO; 1425 1486 GLint idTex; 1426 1487 VBOXVR_TEXTURE RedirTex; 1427 1488 int rc = crServerDumpCheckInit(); 1489 idx = idx >= 0 ? idx : crServerMuralFBOIdxFromBufferName(cr_server.currentMural, pCtxInfo->pContext->buffer.drawBuffer); 1428 1490 if (!RT_SUCCESS(rc)) 1429 1491 { … … 1471 1533 } 1472 1534 1473 bool crServerDumpFilter(int event) 1474 { 1535 bool crServerDumpFilter(unsigned long event) 1536 { 1537 CRContext *ctx = crStateGetCurrent(); 1538 if ((event & CR_SERVER_DUMP_F_DRAW_ALL) 1539 && (!ctx->glsl.activeProgram || ctx->glsl.activeProgram->id != 21)) 1540 return false; 1475 1541 return true; 1542 } 1543 1544 void crServerDumpFramesCheck() 1545 { 1546 if (!g_CrDbgDumpDrawFramesCount) 1547 return; 1548 1549 if (!g_CrDbgDumpDrawFramesAppliedSettings) 1550 { 1551 if (!g_CrDbgDumpDrawFramesSettings) 1552 { 1553 crWarning("g_CrDbgDumpDrawFramesSettings is NULL, bump will not be started"); 1554 g_CrDbgDumpDrawFramesCount = 0; 1555 return; 1556 } 1557 1558 g_CrDbgDumpDrawFramesSavedInitSettings = g_CrDbgDumpDraw; 1559 g_CrDbgDumpDrawFramesAppliedSettings = g_CrDbgDumpDrawFramesSettings; 1560 g_CrDbgDumpDraw = g_CrDbgDumpDrawFramesSettings; 1561 g_CrDbgDumpDrawFramesSettings = 0; 1562 crDmpStrF(cr_server.Recorder.pDumper, "***Starting draw dump for %d frames, settings(0x%x)", g_CrDbgDumpDrawFramesCount, g_CrDbgDumpDraw); 1563 return; 1564 } 1565 1566 --g_CrDbgDumpDrawFramesCount; 1567 1568 if (!g_CrDbgDumpDrawFramesCount) 1569 { 1570 crDmpStrF(cr_server.Recorder.pDumper, "***Stop draw dump"); 1571 g_CrDbgDumpDraw = g_CrDbgDumpDrawFramesSavedInitSettings; 1572 g_CrDbgDumpDrawFramesAppliedSettings = 0; 1573 } 1476 1574 } 1477 1575 #endif
Note:
See TracChangeset
for help on using the changeset viewer.