VirtualBox

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

Last change on this file since 48292 was 48292, checked in by vboxsync, 11 years ago

crOpenGL: dumper fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1/* $Id: cr_dump.h 48292 2013-09-05 07:27:54Z 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
34#ifdef RT_OS_WINDOWS
35DECLEXPORT(void) crDmpDumpImgDmlBreak(struct CR_DUMPER * pDumper, CR_BLITTER_IMG *pImg, const char*pszEntryDesc);
36
37DECLEXPORT(void) crDmpDumpStrDbgPrint(struct CR_DUMPER * pDumper, const char*pszStr);
38#endif
39
40struct CR_DUMPER;
41
42typedef DECLCALLBACKPTR(void, PFNCRDUMPIMG)(struct CR_DUMPER * pDumper, CR_BLITTER_IMG *pImg, const char*pszEntryDesc);
43typedef DECLCALLBACKPTR(void, PFNCRDUMPSTR)(struct CR_DUMPER * pDumper, const char*pszStr);
44
45typedef struct CR_DUMPER
46{
47 PFNCRDUMPIMG pfnDumpImg;
48 PFNCRDUMPSTR pfnDumpStr;
49} CR_DUMPER;
50
51#define crDmpImg(_pDumper, _pImg, _pDesc) do { \
52 (_pDumper)->pfnDumpImg((_pDumper), (_pImg), (_pDesc)); \
53 } while (0)
54
55#define crDmpStr(_pDumper, _pDesc) do { \
56 (_pDumper)->pfnDumpStr((_pDumper), (_pDesc)); \
57 } while (0)
58
59#ifndef RT_OS_WINDOWS
60# define vsprintf_s vsnprintf
61# define sprintf_s snprintf
62#endif
63
64DECLINLINE(void) crDmpStrV(CR_DUMPER *pDumper, const char *pszStr, va_list pArgList)
65{
66 char szBuffer[4096] = {0};
67 vsprintf_s(szBuffer, sizeof (szBuffer), pszStr, pArgList);
68 crDmpStr(pDumper, szBuffer);
69}
70
71DECLINLINE(void) crDmpStrF(CR_DUMPER *pDumper, const char *pszStr, ...)
72{
73 va_list pArgList;
74 va_start(pArgList, pszStr);
75 crDmpStrV(pDumper, pszStr, pArgList);
76 va_end(pArgList);
77}
78
79DECLINLINE(void) crDmpImgV(CR_DUMPER *pDumper, CR_BLITTER_IMG *pImg, const char *pszStr, va_list pArgList)
80{
81 char szBuffer[4096] = {0};
82 vsprintf_s(szBuffer, sizeof (szBuffer), pszStr, pArgList);
83 crDmpImg(pDumper, pImg, szBuffer);
84}
85
86DECLINLINE(void) crDmpImgF(CR_DUMPER *pDumper, CR_BLITTER_IMG *pImg, const char *pszStr, ...)
87{
88 va_list pArgList;
89 va_start(pArgList, pszStr);
90 crDmpImgV(pDumper, pImg, pszStr, pArgList);
91 va_end(pArgList);
92}
93
94VBOXDUMPDECL(size_t) crDmpFormatArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pVal, uint32_t cVal);
95VBOXDUMPDECL(size_t) crDmpFormatRawArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pVal, uint32_t cVal);
96VBOXDUMPDECL(size_t) crDmpFormatMatrixArray(char *pString, size_t cbString, const char *pszElFormat, uint32_t cbEl, const void *pVal, uint32_t cX, uint32_t cY);
97
98typedef struct CR_DBGPRINT_DUMPER
99{
100 CR_DUMPER Base;
101} CR_DBGPRINT_DUMPER;
102
103typedef struct CR_HTML_DUMPER
104{
105 CR_DUMPER Base;
106 const char* pszFile;
107 const char* pszDir;
108 FILE *pFile;
109 uint32_t cImg;
110} CR_HTML_DUMPER;
111
112DECLEXPORT(int) crDmpHtmlInit(struct CR_HTML_DUMPER * pDumper, const char *pszDir, const char *pszFile);
113
114#ifdef RT_OS_WINDOWS
115DECLINLINE(void) crDmpDbgPrintInit(CR_DBGPRINT_DUMPER *pDumper)
116{
117 pDumper->Base.pfnDumpImg = crDmpDumpImgDmlBreak;
118 pDumper->Base.pfnDumpStr = crDmpDumpStrDbgPrint;
119}
120#endif
121
122typedef struct CR_RECORDER
123{
124 CR_BLITTER *pBlitter;
125 SPUDispatchTable *pDispatch;
126 CR_DUMPER *pDumper;
127} CR_RECORDER;
128
129DECLINLINE(void) crRecInit(CR_RECORDER *pRec, CR_BLITTER *pBlitter, SPUDispatchTable *pDispatch, CR_DUMPER *pDumper)
130{
131 pRec->pBlitter = pBlitter;
132 pRec->pDispatch = pDispatch;
133 pRec->pDumper = pDumper;
134}
135
136VBOXDUMPDECL(void) crRecDumpBuffer(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, GLint idRedirFBO, VBOXVR_TEXTURE *pRedirTex);
137VBOXDUMPDECL(void) crRecDumpTextures(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin);
138VBOXDUMPDECL(void) crRecDumpShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
139VBOXDUMPDECL(void) crRecDumpProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
140VBOXDUMPDECL(void) crRecRecompileShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
141VBOXDUMPDECL(void) crRecRecompileProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
142VBOXDUMPDECL(void) crRecDumpCurrentProgram(CR_RECORDER *pRec, CRContext *ctx);
143VBOXDUMPDECL(void) crRecDumpProgramUniforms(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
144VBOXDUMPDECL(void) crRecDumpCurrentProgramUniforms(CR_RECORDER *pRec, CRContext *ctx);
145VBOXDUMPDECL(void) crRecRecompileCurrentProgram(CR_RECORDER *pRec, CRContext *ctx);
146VBOXDUMPDECL(void) crRecDumpProgramAttribs(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
147VBOXDUMPDECL(void) crRecDumpCurrentProgramAttribs(CR_RECORDER *pRec, CRContext *ctx);
148VBOXDUMPDECL(void) crRecDumpGlGetState(CR_RECORDER *pRec, CRContext *ctx);
149VBOXDUMPDECL(void) crRecDumpGlEnableState(CR_RECORDER *pRec, CRContext *ctx);
150VBOXDUMPDECL(void) crRecDumpVertAttrv(CR_RECORDER *pRec, CRContext *ctx, GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal);
151VBOXDUMPDECL(void) crRecDumpVertAttrF(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, ...);
152VBOXDUMPDECL(void) crRecDumpVertAttrV(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, va_list pArgList);
153VBOXDUMPDECL(void) crRecDumpTexParam(CR_RECORDER *pRec, CRContext *ctx, GLenum enmTarget);
154VBOXDUMPDECL(void) crRecDumpTexEnv(CR_RECORDER *pRec, CRContext *ctx);
155VBOXDUMPDECL(void) crRecDumpTexGen(CR_RECORDER *pRec, CRContext *ctx);
156
157typedef DECLCALLBACKPTR(GLuint, PFNCRDUMPGETHWID)(void *pvObj);
158void* crDmpHashtableSearchByHwid(CRHashTable *pHash, GLuint hwid, PFNCRDUMPGETHWID pfnGetHwid, unsigned long *pKey);
159
160RT_C_DECLS_END
161
162#endif /* VBOX_WITH_CRDUMPER */
163/* */
164
165#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