VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_dump.h@ 46368

Last change on this file since 46368 was 46368, checked in by vboxsync, 12 years ago

crOpenGL: more debugging

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: cr_dump.h 46368 2013-06-03 17:24:51Z vboxsync $ */
2
3/** @file
4 * Debugging: Dump API
5 */
6/*
7 * Copyright (C) 2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#ifndef ___cr_dump_h__
18#define ___cr_dump_h__
19
20/* dump stuff */
21//#define VBOX_WITH_CRDUMPER
22#ifdef VBOX_WITH_CRDUMPER
23
24#include <iprt/cdefs.h>
25#include <iprt/string.h>
26#include <cr_spu.h>
27#include <cr_glstate.h>
28#include <cr_blitter.h>
29
30# define VBOXDUMPDECL(_type) DECLEXPORT(_type)
31
32RT_C_DECLS_BEGIN
33
34DECLEXPORT(void) crDmpDumpImgDmlBreak(struct CR_DUMPER * pDumper, CR_BLITTER_IMG *pImg, const char*pszEntryDesc);
35
36DECLEXPORT(void) crDmpDumpStrDbgPrint(struct CR_DUMPER * pDumper, const char*pszStr);
37
38struct CR_DUMPER;
39
40typedef DECLCALLBACKPTR(void, PFNCRDUMPIMG)(struct CR_DUMPER * pDumper, CR_BLITTER_IMG *pImg, const char*pszEntryDesc);
41typedef DECLCALLBACKPTR(void, PFNCRDUMPSTR)(struct CR_DUMPER * pDumper, const char*pszStr);
42
43typedef struct CR_DUMPER
44{
45 PFNCRDUMPIMG pfnDumpImg;
46 PFNCRDUMPSTR pfnDumpStr;
47} CR_DUMPER;
48
49#define crDmpImg(_pDumper, _pImg, _pDesc) do { \
50 (_pDumper)->pfnDumpImg((_pDumper), (_pImg), (_pDesc)); \
51 } while (0)
52
53#define crDmpStr(_pDumper, _pDesc) do { \
54 (_pDumper)->pfnDumpStr((_pDumper), (_pDesc)); \
55 } while (0)
56
57DECLINLINE(void) crDmpStrV(CR_DUMPER *pDumper, const char *pszStr, va_list pArgList)
58{
59 char szBuffer[4096] = {0};
60 RTStrPrintfV(szBuffer, sizeof (szBuffer), pszStr, pArgList);
61 crDmpStr(pDumper, szBuffer);
62}
63
64DECLINLINE(void) crDmpStrF(CR_DUMPER *pDumper, const char *pszStr, ...)
65{
66 va_list pArgList;
67 va_start(pArgList, pszStr);
68 crDmpStrV(pDumper, pszStr, pArgList);
69 va_end(pArgList);
70}
71
72DECLINLINE(void) crDmpImgV(CR_DUMPER *pDumper, CR_BLITTER_IMG *pImg, const char *pszStr, va_list pArgList)
73{
74 char szBuffer[4096] = {0};
75 RTStrPrintfV(szBuffer, sizeof (szBuffer), pszStr, pArgList);
76 crDmpImg(pDumper, pImg, szBuffer);
77}
78
79DECLINLINE(void) crDmpImgF(CR_DUMPER *pDumper, CR_BLITTER_IMG *pImg, const char *pszStr, ...)
80{
81 va_list pArgList;
82 va_start(pArgList, pszStr);
83 crDmpImgV(pDumper, pImg, pszStr, pArgList);
84 va_end(pArgList);
85}
86
87typedef struct CR_DBGPRINT_DUMPER
88{
89 CR_DUMPER Base;
90} CR_DBGPRINT_DUMPER;
91
92typedef struct CR_HTML_DUMPER
93{
94 CR_DUMPER Base;
95 const char* pszFile;
96 const char* pszDir;
97 FILE *pFile;
98 uint32_t cImg;
99} CR_HTML_DUMPER;
100
101DECLEXPORT(int) crDmpHtmlInit(struct CR_HTML_DUMPER * pDumper, const char *pszDir, const char *pszFile);
102
103DECLINLINE(void) crDmpDbgPrintInit(CR_DBGPRINT_DUMPER *pDumper)
104{
105 pDumper->Base.pfnDumpImg = crDmpDumpImgDmlBreak;
106 pDumper->Base.pfnDumpStr = crDmpDumpStrDbgPrint;
107}
108
109typedef struct CR_RECORDER
110{
111 CR_BLITTER *pBlitter;
112 SPUDispatchTable *pDispatch;
113 CR_DUMPER *pDumper;
114} CR_RECORDER;
115
116DECLINLINE(void) crRecInit(CR_RECORDER *pRec, CR_BLITTER *pBlitter, SPUDispatchTable *pDispatch, CR_DUMPER *pDumper)
117{
118 pRec->pBlitter = pBlitter;
119 pRec->pDispatch = pDispatch;
120 pRec->pDumper = pDumper;
121}
122
123VBOXDUMPDECL(void) crRecDumpBuffer(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, GLint idRedirFBO, VBOXVR_TEXTURE *pRedirTex);
124VBOXDUMPDECL(void) crRecDumpTextures(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin);
125VBOXDUMPDECL(void) crRecDumpShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
126VBOXDUMPDECL(void) crRecDumpProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
127VBOXDUMPDECL(void) crRecDumpCurrentProgram(CR_RECORDER *pRec, CRContext *ctx);
128
129
130typedef DECLCALLBACKPTR(GLuint, PFNCRDUMPGETHWID)(void *pvObj);
131void* crDmpHashtableSearchByHwid(CRHashTable *pHash, GLuint hwid, PFNCRDUMPGETHWID pfnGetHwid, unsigned long *pKey);
132
133RT_C_DECLS_END
134
135#endif /* VBOX_WITH_CRDUMPER */
136/* */
137
138#endif /* #ifndef ___cr_dump_h__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette