Changeset 46453 in vbox
- Timestamp:
- Jun 7, 2013 9:27:03 PM (11 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/cr_dump.h
r46395 r46453 85 85 } 86 86 87 VBOXDUMPDECL(size_t) crDmpFormatArray f(char *pString, size_t cbString, const float*pVal, uint32_t cVal);88 VBOXDUMPDECL(size_t) crDmpFormatRawArray f(char *pString, size_t cbString, const float*pVal, uint32_t cVal);89 VBOXDUMPDECL(size_t) crDmpFormatMatrixArray f(char *pString, size_t cbString, const float*pVal, uint32_t cX, uint32_t cY);87 VBOXDUMPDECL(size_t) crDmpFormatArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pVal, uint32_t cVal); 88 VBOXDUMPDECL(size_t) crDmpFormatRawArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pVal, uint32_t cVal); 89 VBOXDUMPDECL(size_t) crDmpFormatMatrixArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pVal, uint32_t cX, uint32_t cY); 90 90 91 91 typedef struct CR_DBGPRINT_DUMPER … … 134 134 VBOXDUMPDECL(void) crRecDumpGlGetState(CR_RECORDER *pRec, CRContext *ctx); 135 135 VBOXDUMPDECL(void) crRecDumpGlEnableState(CR_RECORDER *pRec, CRContext *ctx); 136 VBOXDUMPDECL(void) crRecDumpVertAttrv(CR_RECORDER *pRec, CRContext *ctx, GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal); 137 VBOXDUMPDECL(void) crRecDumpVertAttrF(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, ...); 138 VBOXDUMPDECL(void) crRecDumpVertAttrV(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, va_list pArgList); 136 139 137 140 typedef DECLCALLBACKPTR(GLuint, PFNCRDUMPGETHWID)(void *pvObj); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump.cpp
r46402 r46453 165 165 } 166 166 167 VBOXDUMPDECL(size_t) crDmpFormatRawArrayf(char *pString, size_t cbString, const float *pVal, uint32_t cVal) 167 DECLINLINE(size_t) crDmpFormatVal(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbVal, const void *pvVal) 168 { 169 if (pszElFormat[0] != '%' || pszElFormat[1] == '\0') 170 { 171 crWarning("invalid format %s", pszElFormat); 172 return 0; 173 } 174 switch (cbVal) 175 { 176 case 8: 177 return sprintf_s(pString, cbString, pszElFormat, *((double*)pvVal)); 178 case 4: 179 { 180 /* we do not care only about type specifiers, all the rest is not accepted */ 181 switch (pszElFormat[1]) 182 { 183 case 'f': 184 /* float would be promoted to double */ 185 return sprintf_s(pString, cbString, pszElFormat, *((float*)pvVal)); 186 default: 187 return sprintf_s(pString, cbString, pszElFormat, *((uint32_t*)pvVal)); 188 } 189 } 190 case 2: 191 return sprintf_s(pString, cbString, pszElFormat, *((uint16_t*)pvVal)); 192 case 1: 193 return sprintf_s(pString, cbString, pszElFormat, *((uint8_t*)pvVal)); 194 default: 195 crWarning("unsupported size %d", cbVal); 196 return 0; 197 } 198 } 199 200 VBOXDUMPDECL(size_t) crDmpFormatRawArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal) 168 201 { 169 202 if (cbString < 2) … … 177 210 --cbString; 178 211 size_t cbWritten; 212 const uint8_t *pu8Val = (const uint8_t *)pvVal; 179 213 for (uint32_t i = 0; i < cVal; ++i) 180 214 { 181 cbWritten = sprintf_s(pString, cbString,182 (i != cVal - 1) ? "%f, " : "%f", *pVal);215 cbWritten = crDmpFormatVal(pString, cbString, pszElFormat, cbEl, (const void *)pu8Val); 216 pu8Val += cbEl; 183 217 Assert(cbString >= cbWritten); 184 218 pString += cbWritten; 185 219 cbString -= cbWritten; 220 if (i != cVal - 1) 221 { 222 cbWritten = sprintf_s(pString, cbString, ", "); 223 Assert(cbString >= cbWritten); 224 pString += cbWritten; 225 cbString -= cbWritten; 226 } 186 227 } 187 228 … … 204 245 } 205 246 206 VBOXDUMPDECL(size_t) crDmpFormatMatrixArray f(char *pString, size_t cbString, const float *pVal, uint32_t cX, uint32_t cY)247 VBOXDUMPDECL(size_t) crDmpFormatMatrixArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cX, uint32_t cY) 207 248 { 208 249 if (cbString < 2) … … 216 257 --cbString; 217 258 size_t cbWritten; 259 const uint8_t *pu8Val = (const uint8_t *)pvVal; 218 260 for (uint32_t i = 0; i < cY; ++i) 219 261 { 220 cbWritten = crDmpFormatRawArrayf(pString, cbString, pVal, cX); 262 cbWritten = crDmpFormatRawArray(pString, cbString, pszElFormat, cbEl, (const void *)pu8Val, cX); 263 pu8Val += (cbEl * cX); 221 264 Assert(cbString >= cbWritten); 222 265 pString += cbWritten; … … 253 296 } 254 297 255 VBOXDUMPDECL(size_t) crDmpFormatArray f(char *pString, size_t cbString, const float *pVal, uint32_t cVal)298 VBOXDUMPDECL(size_t) crDmpFormatArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal) 256 299 { 257 300 switch(cVal) 258 301 { 259 302 case 1: 260 return sprintf_s(pString, cbString, "%f", *pVal);303 return crDmpFormatVal(pString, cbString, pszElFormat, cbEl, pvVal); 261 304 case 16: 262 return crDmpFormatMatrixArray f(pString, cbString, pVal, 4, 4);305 return crDmpFormatMatrixArray(pString, cbString, pszElFormat, cbEl, pvVal, 4, 4); 263 306 case 9: 264 return crDmpFormatMatrixArray f(pString, cbString, pVal, 3, 3);307 return crDmpFormatMatrixArray(pString, cbString, pszElFormat, cbEl, pvVal, 3, 3); 265 308 case 0: 266 309 crWarning("value array is empty"); 267 310 return 0; 268 311 default: 269 return crDmpFormatRawArrayf(pString, cbString, pVal, cVal); 270 } 312 return crDmpFormatRawArray(pString, cbString, pszElFormat, cbEl, pvVal, cVal); 313 } 314 } 315 316 VBOXDUMPDECL(void) crRecDumpVertAttrv(CR_RECORDER *pRec, CRContext *ctx, GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal) 317 { 318 char aBuf[1024]; 319 crDmpFormatRawArray(aBuf, sizeof (aBuf), pszElFormat, cbEl, pvVal, cVal); 320 crDmpStrF(pRec->pDumper, "(%u, %s)", idx, aBuf); 321 } 322 323 VBOXDUMPDECL(void) crRecDumpVertAttrV(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, va_list pArgList) 324 { 325 crDmpStrV(pRec->pDumper, pszFormat, pArgList); 326 } 327 328 VBOXDUMPDECL(void) crRecDumpVertAttrF(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, ...) 329 { 330 va_list pArgList; 331 va_start(pArgList, pszFormat); 332 crRecDumpVertAttrV(pRec, ctx, pszFormat, pArgList); 333 va_end(pArgList); 271 334 } 272 335 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py
r46401 r46453 73 73 { 74 74 char aBuf[4096]; 75 crDmpFormatArray f(aBuf, sizeof (aBuf), pfData, pDesc->num_values);75 crDmpFormatArray(aBuf, sizeof (aBuf), "%f", sizeof (float), pfData, pDesc->num_values); 76 76 crDmpStrF(pDumper, "%s = %s;", pDesc->pszName, aBuf); 77 77 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r46395 r46453 398 398 void crServerDumpFramesCheck(); 399 399 void crServerDumpState(); 400 void crServerDumpDrawel(const char*pszFormat, ...); 401 void crServerDumpDrawelv(GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal); 402 400 403 401 404 extern unsigned long g_CrDbgDumpEnabled; … … 461 464 #define CR_SERVER_DUMP_F_DRAW_STATE_ENTER 0x00000004 462 465 #define CR_SERVER_DUMP_F_DRAW_STATE_LEAVE 0x00000008 463 464 466 #define CR_SERVER_DUMP_F_DRAW_ENTER_ALL (CR_SERVER_DUMP_F_DRAW_BUFF_ENTER \ 465 467 | CR_SERVER_DUMP_F_DRAW_TEX_ENTER \ … … 477 479 478 480 #define CR_SERVER_DUMP_F_COMPILE_SHADER 0x00001000 479 #define CR_SERVER_DUMP_F_LINK_PROGRAM 0x00002000 481 #define CR_SERVER_DUMP_F_SHADER_SOURCE 0x00002000 482 #define CR_SERVER_DUMP_F_LINK_PROGRAM 0x00004000 480 483 #define CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER 0x00010000 481 484 #define CR_SERVER_DUMP_F_SWAPBUFFERS_LEAVE 0x00020000 485 #define CR_SERVER_DUMP_F_DRAWEL 0x00100000 486 482 487 483 488 #define CR_SERVER_DUMP_DEFAULT_FILTER_OP(_ev) ((((_ev) & g_CrDbgDumpDraw) != 0) \ … … 505 510 crServerDumpCheckInit(); \ 506 511 crDmpStrF(cr_server.Recorder.pDumper, "<== %s", __FUNCTION__); \ 512 if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_TEX_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpTextures(); } \ 507 513 if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpBuffer(-1); } \ 508 if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_TEX_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpTextures(); } \509 514 if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgramUniforms(); } \ 510 515 if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgram(); } \ … … 516 521 if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_COMPILE_SHADER, cr_server.Recorder.pDumper)) break; \ 517 522 crServerDumpCheckInit(); \ 523 crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \ 518 524 crServerDumpShader((_id)); \ 525 crDmpStrF(cr_server.Recorder.pDumper, "====="); \ 526 } while (0) 527 528 #define CR_SERVER_DUMP_SHADER_SOURCE(_id) do { \ 529 if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_SHADER_SOURCE, cr_server.Recorder.pDumper)) break; \ 530 crServerDumpCheckInit(); \ 531 crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \ 532 crServerDumpShader((_id)); \ 533 crDmpStrF(cr_server.Recorder.pDumper, "====="); \ 519 534 } while (0) 520 535 … … 522 537 if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_LINK_PROGRAM, cr_server.Recorder.pDumper)) break; \ 523 538 crServerDumpCheckInit(); \ 539 crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \ 524 540 crServerDumpProgram((_id)); \ 541 crDmpStrF(cr_server.Recorder.pDumper, "====="); \ 525 542 } while (0) 526 543 … … 536 553 if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_SWAPBUFFERS_LEAVE, cr_server.Recorder.pDumper)) break; \ 537 554 crServerDumpCheckInit(); \ 538 } while (0) 555 crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \ 556 } while (0) 557 558 #define CR_SERVER_DUMP_DRAWEL_F(_msg) do { \ 559 if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_DRAWEL, cr_server.Recorder.pDumper)) break; \ 560 crServerDumpCheckInit(); \ 561 crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \ 562 crServerDumpDrawel _msg; \ 563 } while (0) 564 565 #define CR_SERVER_DUMP_DRAWEL_V(_index, _pszElFormat, _cbEl, _pvVal, _cVal) do { \ 566 if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_DRAWEL, cr_server.Recorder.pDumper)) break; \ 567 crServerDumpCheckInit(); \ 568 crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \ 569 crServerDumpDrawelv((_index), (_pszElFormat), (_cbEl), (_pvVal), (_cVal)); \ 570 } while (0) 539 571 #else /* if !defined VBOX_WITH_CRSERVER_DUMPER */ 540 572 #define CR_SERVER_DUMP_DRAW_ENTER() do {} while (0) … … 544 576 #define CR_SERVER_DUMP_SWAPBUFFERS_ENTER() do {} while (0) 545 577 #define CR_SERVER_DUMP_SWAPBUFFERS_LEAVE() do {} while (0) 578 #define CR_SERVER_DUMP_SHADER_SOURCE() do {} while (0) 579 #define CR_SERVER_DUMP_DRAWEL_F(_msg) do {} while (0) 580 #define CR_SERVER_DUMP_DRAWEL_V(_pszElFormat, _cbEl, _pvVal, _cVal) do {} while (0) 546 581 #endif /* !VBOX_WITH_CRSERVER_DUMPER */ 547 582 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c
r46368 r46453 38 38 CRASSERT(err == GL_NO_ERROR); 39 39 #endif 40 CR_SERVER_DUMP_SHADER_SOURCE(shader); 40 41 } 41 42 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r46396 r46453 1398 1398 | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE 1399 1399 | CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_ENTER 1400 | CR_SERVER_DUMP_F_DRAW_TEX_ ENTER1400 | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE 1401 1401 | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER 1402 1402 | CR_SERVER_DUMP_F_DRAW_STATE_ENTER 1403 1403 | CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER 1404 | CR_SERVER_DUMP_F_DRAWEL 1404 1405 ; //CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE; 1405 1406 unsigned long g_CrDbgDumpDrawFramesSettings = CR_SERVER_DUMP_F_DRAW_BUFF_ENTER … … 1495 1496 { 1496 1497 CRContext *ctx = crStateGetCurrent(); 1497 Assert(0);1498 1498 crRecDumpGlGetState(&cr_server.Recorder, ctx); 1499 1499 crRecDumpGlEnableState(&cr_server.Recorder, ctx); 1500 } 1501 1502 void crServerDumpDrawel(const char*pszFormat, ...) 1503 { 1504 CRContext *ctx = crStateGetCurrent(); 1505 va_list pArgList; 1506 va_start(pArgList, pszFormat); 1507 crRecDumpVertAttrV(&cr_server.Recorder, ctx, pszFormat, pArgList); 1508 va_end(pArgList); 1509 } 1510 1511 void crServerDumpDrawelv(GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal) 1512 { 1513 CRContext *ctx = crStateGetCurrent(); 1514 crRecDumpVertAttrv(&cr_server.Recorder, ctx, idx, pszElFormat, cbEl, pvVal, cVal); 1500 1515 } 1501 1516 … … 1556 1571 } 1557 1572 1558 static uint32_t g_VDbgCDraws = 0;1559 static uint32_t g_VDbgCFrames = 0;1560 static uint32_t g_VDbgDoFrameDump = 0;1561 static uint32_t g_VDbgInitFrameDump = 0;1562 1563 1564 1573 bool crServerDumpFilterOp(unsigned long event, CR_DUMPER *pDumper) 1565 1574 { 1566 CRContext *ctx = crStateGetCurrent();1567 if (event & CR_SERVER_DUMP_F_DRAW_ALL)1568 {1569 if(!ctx->glsl.activeProgram || ctx->glsl.activeProgram->id != 21)1570 return false;1571 1572 if (event & CR_SERVER_DUMP_F_DRAW_ENTER_ALL)1573 {1574 ++g_VDbgCDraws;1575 // crDmpStrF(cr_server.Recorder.pDumper, "DRAW(%d:%d)", g_VDbgCFrames, g_VDbgCDraws);1576 }1577 1578 if (!g_VDbgDoFrameDump)1579 return false;1580 1581 #define CR_SERVER_DUMP_MARKER_ENTER_STR "VBox.Cr.DrawEnter"1582 #define CR_SERVER_DUMP_MARKER_LEAVE_STR "VBox.Cr.DrawLeave"1583 1584 if (0)//(g_VDbgCFrames == 53 && g_VDbgCDraws == 13)1585 {1586 if (event & CR_SERVER_DUMP_F_DRAW_ENTER_ALL)1587 cr_server.head_spu->dispatch_table.StringMarkerGREMEDY(sizeof (CR_SERVER_DUMP_MARKER_ENTER_STR), CR_SERVER_DUMP_MARKER_ENTER_STR);1588 else1589 cr_server.head_spu->dispatch_table.StringMarkerGREMEDY(sizeof (CR_SERVER_DUMP_MARKER_LEAVE_STR), CR_SERVER_DUMP_MARKER_LEAVE_STR);1590 }1591 }1592 else if (event & CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER)1593 {1594 bool fSkip = true;1595 ++g_VDbgCFrames;1596 // crDmpStrF(cr_server.Recorder.pDumper, "FRAME(%d)", g_VDbgCFrames);1597 g_VDbgCDraws = 0;1598 if (g_VDbgDoFrameDump)1599 {1600 g_VDbgDoFrameDump = 0;1601 fSkip = false;1602 }1603 1604 if (g_VDbgInitFrameDump)1605 {1606 g_VDbgDoFrameDump = 1;1607 g_VDbgInitFrameDump = 0;1608 }1609 1610 if (fSkip)1611 return false;1612 }1613 1614 1575 return CR_SERVER_DUMP_DEFAULT_FILTER_OP(event); 1615 1576 }
Note:
See TracChangeset
for help on using the changeset viewer.